From 960c322586eceb9598bb0a9985a8dd987dc74807 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 22 Oct 2021 00:10:49 +0800 Subject: 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`. --- routers/web/admin/admin.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'routers/web') diff --git a/routers/web/admin/admin.go b/routers/web/admin/admin.go index ca5b157523..223114dae1 100644 --- a/routers/web/admin/admin.go +++ b/routers/web/admin/admin.go @@ -26,6 +26,7 @@ import ( "code.gitea.io/gitea/modules/queue" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/updatechecker" "code.gitea.io/gitea/modules/web" "code.gitea.io/gitea/services/forms" "code.gitea.io/gitea/services/mailer" @@ -125,8 +126,8 @@ func Dashboard(ctx *context.Context) { ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminDashboard"] = true ctx.Data["Stats"] = models.GetStatistic() - ctx.Data["NeedUpdate"] = models.GetNeedUpdate() - ctx.Data["RemoteVersion"] = models.GetRemoteVersion() + ctx.Data["NeedUpdate"] = updatechecker.GetNeedUpdate() + ctx.Data["RemoteVersion"] = updatechecker.GetRemoteVersion() // FIXME: update periodically updateSystemStatus() ctx.Data["SysStatus"] = sysStatus -- cgit v1.2.3