You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Mulitple Gitea Doctor improvements (#10943)
Backport #10943
* Add `gitea doctor --list` flag to list the checks that will be run, including those by default
* Add `gitea doctor --run` to run specific checks
* Add `gitea doctor --all` to run all checks
* Add db version checker
* Add non-default recalculate merge bases check/fixer to doctor
* Add hook checker (Fix#9878) and ensure hooks are executable (Fix#6319)
* Fix authorized_keys checker - slight change of functionality here because parsing the command is fragile and we should just check if the authorized_keys file is essentially the same as what gitea would produce. (This is still not perfect as order matters - we should probably just md5sum the two files.)
* Add SCRIPT_TYPE check (Fix#10977)
* Add `gitea doctor --fix` to attempt to fix what is possible to easily fix
* Add `gitea doctor --log-file` to set the log-file, be it a file, stdout or to switch off completely. (Fixes previously undetected bug with certain xorm logging configurations - see @6543 comment.)
Signed-off-by: Andrew Thornton <[email protected]>
* Switch to io.Writer instead of io.StringWriter
Signed-off-by: Andrew Thornton <[email protected]>
// ExpectedVersion returns the expected db version
313
+
funcExpectedVersion() int64 {
314
+
returnint64(minDBVersion+len(migrations))
315
+
}
316
+
317
+
// EnsureUpToDate will check if the db is at the correct version
318
+
funcEnsureUpToDate(x*xorm.Engine) error {
319
+
currentDB, err:=GetCurrentDBVersion(x)
320
+
iferr!=nil {
321
+
returnerr
322
+
}
323
+
324
+
ifcurrentDB<0 {
325
+
returnfmt.Errorf("Database has not been initialised")
326
+
}
327
+
328
+
ifminDBVersion>currentDB {
329
+
returnfmt.Errorf("DB version %d (<= %d) is too old for auto-migration. Upgrade to Gitea 1.6.4 first then upgrade to this version", currentDB, minDBVersion)
330
+
}
331
+
332
+
expected:=ExpectedVersion()
333
+
334
+
ifcurrentDB!=expected {
335
+
returnfmt.Errorf(`Current database version %d is not equal to the expected version %d. Please run "gitea [--config /path/to/app.ini] migrate" to update the database version`, currentDB, expected)
0 commit comments