When reinitialising DBConfig reset the database use flags (#13796)

One perennial issue is users running the install page,
changing the database dialect and then suffering with issues

This PR simply resets all of the database.Use flags on
initDBConfig. This should prevent this issue from occuring.

Fix #13788
Fix #5480

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
zeripath 2020-12-03 00:39:48 +00:00 committed by GitHub
parent c3893a8bd1
commit 5e0a3784ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,6 +62,11 @@ func InitDBConfig() {
sec := Cfg.Section("database") sec := Cfg.Section("database")
Database.Type = sec.Key("DB_TYPE").String() Database.Type = sec.Key("DB_TYPE").String()
defaultCharset := "utf8" defaultCharset := "utf8"
Database.UseMySQL = false
Database.UseSQLite3 = false
Database.UsePostgreSQL = false
Database.UseMSSQL = false
switch Database.Type { switch Database.Type {
case "sqlite3": case "sqlite3":
Database.UseSQLite3 = true Database.UseSQLite3 = true