diff options
author | Allen Wild <aswild@users.noreply.github.com> | 2018-03-02 04:09:43 -0500 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-03-02 11:09:43 +0200 |
commit | 8606d9f5bc01fce90159c9bdef9989a31a865e38 (patch) | |
tree | ddac9956aa33be65d7acf7f733c87c6893a6b083 | |
parent | 2cd3622ddc340a67d95e1471f1e13bda383ef95b (diff) | |
download | gitea-8606d9f5bc01fce90159c9bdef9989a31a865e38.tar.gz gitea-8606d9f5bc01fce90159c9bdef9989a31a865e38.zip |
Add admin dashboard option to run health checks (#3606)
There's one for git gc, why not git fsck too?
Also add a couple more trace logs to GitFsck to see progress
-rw-r--r-- | models/repo.go | 2 | ||||
-rw-r--r-- | options/locale/locale_en-US.ini | 2 | ||||
-rw-r--r-- | routers/admin/admin.go | 4 | ||||
-rw-r--r-- | templates/admin/dashboard.tmpl | 4 |
4 files changed, 12 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index ba5b7b36af..cddd57dc38 100644 --- a/models/repo.go +++ b/models/repo.go @@ -2172,6 +2172,7 @@ func GitFsck() { func(idx int, bean interface{}) error { repo := bean.(*Repository) repoPath := repo.RepoPath() + log.Trace(fmt.Sprintf("Running health check for repository %s", repoPath)) if err := git.Fsck(repoPath, setting.Cron.RepoHealthCheck.Timeout, setting.Cron.RepoHealthCheck.Args...); err != nil { desc := fmt.Sprintf("Failed to health check repository (%s): %v", repoPath, err) log.Warn(desc) @@ -2183,6 +2184,7 @@ func GitFsck() { }); err != nil { log.Error(4, "GitFsck: %v", err) } + log.Trace("Finished: GitFsck") } // GitGcRepos calls 'git gc' to remove unnecessary files and optimize the local repository diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index a7c338c101..8f1f4f5f5b 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1220,6 +1220,8 @@ dashboard.reinit_missing_repos = Reinitialize all missing Git repositories for w dashboard.reinit_missing_repos_success = All missing Git repositories for which records existed have been reinitialized. dashboard.sync_external_users = Synchronize external user data dashboard.sync_external_users_started = External user synchronization started +dashboard.git_fsck = Execute health checks on all repositories +dashboard.git_fsck_started = Repository health checks started dashboard.server_uptime = Server Uptime dashboard.current_goroutine = Current Goroutines dashboard.current_memory_usage = Current Memory Usage diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 39a8f718ca..9b18847d6c 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -122,6 +122,7 @@ const ( syncRepositoryUpdateHook reinitMissingRepository syncExternalUsers + gitFsck ) // Dashboard show admin panel dashboard @@ -161,6 +162,9 @@ func Dashboard(ctx *context.Context) { case syncExternalUsers: success = ctx.Tr("admin.dashboard.sync_external_users_started") go models.SyncExternalUsers() + case gitFsck: + success = ctx.Tr("admin.dashboard.git_fsck_started") + go models.GitFsck() } if err != nil { diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl index 23fc4a422d..9ab23f887a 100644 --- a/templates/admin/dashboard.tmpl +++ b/templates/admin/dashboard.tmpl @@ -49,6 +49,10 @@ <td>{{.i18n.Tr "admin.dashboard.sync_external_users"}}</td> <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=8">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> </tr> + <tr> + <td>{{.i18n.Tr "admin.dashboard.git_fsck"}}</td> + <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=9">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> + </tr> </tbody> </table> </div> |