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.

tool.go 1.2 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. "net/http"
  7. "code.gitea.io/gitea/models"
  8. "code.gitea.io/gitea/modules/log"
  9. "code.gitea.io/gitea/routers/repo"
  10. "gitea.com/macaron/macaron"
  11. )
  12. func UpdateAllRepoCommitCnt(ctx *macaron.Context) {
  13. repos, err := models.GetAllRepositories()
  14. if err != nil {
  15. log.Error("GetAllRepositories failed:%v", err.Error(), ctx.Data["MsgID"])
  16. ctx.JSON(http.StatusInternalServerError, map[string]string{
  17. "error_msg": "GetAllRepositories failed",
  18. })
  19. return
  20. }
  21. for i, repo := range repos {
  22. log.Info("%d:begin updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
  23. if err = updateRepoCommitCnt(ctx, repo); err != nil {
  24. log.Error("updateRepoCommitCnt(id = %d, name = %s) failed:%v", repo.ID, repo.Name, err.Error(), ctx.Data["MsgID"])
  25. continue
  26. }
  27. log.Info("%d:finish updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
  28. }
  29. ctx.JSON(http.StatusOK, map[string]string{
  30. "error_msg": "",
  31. })
  32. }
  33. func RepoStatisticManually(ctx *macaron.Context) {
  34. date := ctx.Query("date")
  35. repo.RepoStatisticDaily(date)
  36. }