MCPcopy Create free account
hub / github.com/gogs/gogs / Operation

Function Operation

internal/route/admin/admin.go:138–171  ·  view source on GitHub ↗
(c *context.Context)

Source from the content-addressed store, hash-verified

136)
137
138func Operation(c *context.Context) {
139 var err error
140 var success string
141 switch AdminOperation(c.QueryInt("op")) {
142 case CleanInactivateUser:
143 success = c.Tr("admin.dashboard.delete_inactivate_accounts_success")
144 err = database.Handle.Users().DeleteInactivated()
145 case CleanRepoArchives:
146 success = c.Tr("admin.dashboard.delete_repo_archives_success")
147 err = database.DeleteRepositoryArchives()
148 case CleanMissingRepos:
149 success = c.Tr("admin.dashboard.delete_missing_repos_success")
150 err = database.DeleteMissingRepositories()
151 case GitGCRepos:
152 success = c.Tr("admin.dashboard.git_gc_repos_success")
153 err = database.GitGcRepos()
154 case SyncSSHAuthorizedKey:
155 success = c.Tr("admin.dashboard.resync_all_sshkeys_success")
156 err = database.RewriteAuthorizedKeys()
157 case SyncRepositoryHooks:
158 success = c.Tr("admin.dashboard.resync_all_hooks_success")
159 err = database.SyncRepositoryHooks()
160 case ReinitMissingRepository:
161 success = c.Tr("admin.dashboard.reinit_missing_repos_success")
162 err = database.ReinitMissingRepositories()
163 }
164
165 if err != nil {
166 c.Flash.Error(err.Error())
167 } else {
168 c.Flash.Success(success)
169 }
170 c.RedirectSubpath("/admin")
171}
172
173func SendTestMail(c *context.Context) {
174 emailAddr := c.Query("email")

Callers

nothing calls this directly

Calls 13

DeleteRepositoryArchivesFunction · 0.92
GitGcReposFunction · 0.92
RewriteAuthorizedKeysFunction · 0.92
SyncRepositoryHooksFunction · 0.92
AdminOperationTypeAlias · 0.85
TrMethod · 0.80
DeleteInactivatedMethod · 0.80
UsersMethod · 0.80
SuccessMethod · 0.80
RedirectSubpathMethod · 0.80

Tested by

no test coverage detected