|
12345678910111213141516171819202122232425262728293031323334353637 |
- // Copyright 2020 The Gitea Authors. All rights reserved.
- // Use of this source code is governed by a MIT-style
- // license that can be found in the LICENSE file.
-
- package private
-
- import (
- "gitea.com/macaron/macaron"
- "net/http"
-
- "code.gitea.io/gitea/models"
- "code.gitea.io/gitea/modules/log"
- )
-
- func UpdateAllRepoCommitCnt(ctx *macaron.Context) {
- repos, err := models.GetAllRepositories()
- if err != nil {
- log.Error("GetAllRepositories failed:%v", err.Error(), ctx.Data["MsgID"])
- ctx.JSON(http.StatusInternalServerError, map[string]string{
- "error_msg": "GetAllRepositories failed",
- })
- return
- }
-
- for i, repo := range repos {
- log.Info("%d:begin updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
- if err = updateRepoCommitCnt(ctx, repo); err != nil {
- log.Error("updateRepoCommitCnt(id = %d, name = %s) failed:%v", repo.ID, repo.Name, err.Error(), ctx.Data["MsgID"])
- continue
- }
- log.Info("%d:finish updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
- }
-
- ctx.JSON(http.StatusOK, map[string]string{
- "error_msg": "",
- })
- }
|