You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmd.go 1.1 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package private
  5. import (
  6. "gitea.com/macaron/macaron"
  7. "net/http"
  8. "code.gitea.io/gitea/models"
  9. "code.gitea.io/gitea/modules/log"
  10. )
  11. func UpdateAllRepoCommitCnt(ctx *macaron.Context) {
  12. repos, err := models.GetAllRepositories()
  13. if err != nil {
  14. log.Error("GetAllRepositories failed:%v", err.Error(), ctx.Data["MsgID"])
  15. ctx.JSON(http.StatusInternalServerError, map[string]string{
  16. "error_msg": "GetAllRepositories failed",
  17. })
  18. return
  19. }
  20. for i, repo := range repos {
  21. log.Info("%d:begin updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
  22. if err = updateRepoCommitCnt(ctx, repo); err != nil {
  23. log.Error("updateRepoCommitCnt(id = %d, name = %s) failed:%v", repo.ID, repo.Name, err.Error(), ctx.Data["MsgID"])
  24. continue
  25. }
  26. log.Info("%d:finish updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
  27. }
  28. ctx.JSON(http.StatusOK, map[string]string{
  29. "error_msg": "",
  30. })
  31. }