diff options
author | Unknown <joe2010xtmf@163.com> | 2014-05-06 13:47:47 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-05-06 13:47:47 -0400 |
commit | 7cb5a15c9b7a2a118d756d15cb745743f207a318 (patch) | |
tree | dba01566116b8ad49f0762812ecb3ab96597090f /routers/admin/admin.go | |
parent | e573855a4f040abd4aa6a2afa9ce610a1ec2670f (diff) | |
download | gitea-7cb5a15c9b7a2a118d756d15cb745743f207a318.tar.gz gitea-7cb5a15c9b7a2a118d756d15cb745743f207a318.zip |
Batch of mirror fixes
Diffstat (limited to 'routers/admin/admin.go')
-rw-r--r-- | routers/admin/admin.go | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 96721bfdeb..910027881d 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -98,9 +98,36 @@ func updateSystemStatus() { sysStatus.NumGC = m.NumGC } +// Operation types. +const ( + OT_CLEAN_OAUTH = iota + 1 +) + func Dashboard(ctx *middleware.Context) { ctx.Data["Title"] = "Admin Dashboard" ctx.Data["PageIsDashboard"] = true + + // Run operation. + op, _ := base.StrTo(ctx.Query("op")).Int() + if op > 0 { + var err error + var success string + + switch op { + case OT_CLEAN_OAUTH: + success = "All unbind OAuthes have been deleted." + err = models.CleanUnbindOauth() + } + + if err != nil { + ctx.Flash.Error(err.Error()) + } else { + ctx.Flash.Success(success) + } + ctx.Redirect("/admin") + return + } + ctx.Data["Stats"] = models.GetStatistic() updateSystemStatus() ctx.Data["SysStatus"] = sysStatus @@ -153,7 +180,7 @@ func Config(ctx *middleware.Context) { ctx.Data["AppUrl"] = base.AppUrl ctx.Data["Domain"] = base.Domain ctx.Data["OfflineMode"] = base.OfflineMode - ctx.Data["RouterLog"] = base.RouterLog + ctx.Data["DisableRouterLog"] = base.DisableRouterLog ctx.Data["RunUser"] = base.RunUser ctx.Data["RunMode"] = strings.Title(martini.Env) ctx.Data["RepoRootPath"] = base.RepoRootPath |