1
0
Fork 0
forked from forgejo/forgejo

Refactor update checker to use AppState (#17387)

We have the `AppState` module now, it can store app related data easily. We do not need to create separate tables for each feature.

So the update checker can use `AppState` instead of a one-row dedicate table.

And the code of update checker is moved from `models` to `modules`.
This commit is contained in:
wxiaoguang 2021-10-22 00:10:49 +08:00 committed by GitHub
parent 67561e79f1
commit 960c322586
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 61 deletions

View file

@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/models"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/updatechecker"
)
func registerDeleteInactiveUsers() {
@ -145,7 +146,7 @@ func registerUpdateGiteaChecker() {
HTTPEndpoint: "https://dl.gitea.io/gitea/version.json",
}, func(ctx context.Context, _ *models.User, config Config) error {
updateCheckerConfig := config.(*UpdateCheckerConfig)
return models.GiteaUpdateChecker(updateCheckerConfig.HTTPEndpoint)
return updatechecker.GiteaUpdateChecker(updateCheckerConfig.HTTPEndpoint)
})
}