Add system setting table with cache and also add cache supports for user setting (#18058)

This commit is contained in:
Lunny Xiao 2022-10-17 07:29:26 +08:00 committed by GitHub
parent 5d3dbffa15
commit f860a6d2e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 1117 additions and 436 deletions

View file

@ -11,7 +11,6 @@ import (
"code.gitea.io/gitea/models"
asymkey_model "code.gitea.io/gitea/models/asymkey"
"code.gitea.io/gitea/modules/appstate"
"code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/eventsource"
"code.gitea.io/gitea/modules/git"
@ -27,6 +26,7 @@ import (
"code.gitea.io/gitea/modules/ssh"
"code.gitea.io/gitea/modules/storage"
"code.gitea.io/gitea/modules/svg"
"code.gitea.io/gitea/modules/system"
"code.gitea.io/gitea/modules/templates"
"code.gitea.io/gitea/modules/translation"
"code.gitea.io/gitea/modules/util"
@ -76,8 +76,8 @@ func InitGitServices() {
}
func syncAppPathForGit(ctx context.Context) error {
runtimeState := new(appstate.RuntimeState)
if err := appstate.AppState.Get(runtimeState); err != nil {
runtimeState := new(system.RuntimeState)
if err := system.AppState.Get(runtimeState); err != nil {
return err
}
if runtimeState.LastAppPath != setting.AppPath {
@ -90,7 +90,7 @@ func syncAppPathForGit(ctx context.Context) error {
mustInit(asymkey_model.RewriteAllPublicKeys)
runtimeState.LastAppPath = setting.AppPath
return appstate.AppState.Set(runtimeState)
return system.AppState.Set(runtimeState)
}
return nil
}
@ -133,10 +133,10 @@ func GlobalInitInstalled(ctx context.Context) {
mustInitCtx(ctx, common.InitDBEngine)
log.Info("ORM engine initialization successful!")
mustInit(appstate.Init)
mustInit(system.Init)
mustInit(oauth2.Init)
models.NewRepoContext()
mustInit(models.Init)
mustInit(repo_service.Init)
// Booting long running goroutines.