diff options
Diffstat (limited to 'services/repository/repository.go')
-rw-r--r-- | services/repository/repository.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/services/repository/repository.go b/services/repository/repository.go index 685a3c7601..6799ca586e 100644 --- a/services/repository/repository.go +++ b/services/repository/repository.go @@ -9,6 +9,8 @@ import ( "fmt" "code.gitea.io/gitea/models" + admin_model "code.gitea.io/gitea/models/admin" + "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/organization" packages_model "code.gitea.io/gitea/models/packages" repo_model "code.gitea.io/gitea/models/repo" @@ -16,7 +18,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/notification" repo_module "code.gitea.io/gitea/modules/repository" - cfg "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/setting" pull_service "code.gitea.io/gitea/services/pull" ) @@ -67,7 +69,7 @@ func PushCreateRepo(authUser, owner *user_model.User, repoName string) (*repo_mo repo, err := CreateRepository(authUser, owner, models.CreateRepoOptions{ Name: repoName, - IsPrivate: cfg.Repository.DefaultPushCreatePrivate, + IsPrivate: setting.Repository.DefaultPushCreatePrivate, }) if err != nil { return nil, err @@ -76,8 +78,10 @@ func PushCreateRepo(authUser, owner *user_model.User, repoName string) (*repo_mo return repo, nil } -// NewContext start repository service -func NewContext() error { +// Init start repository service +func Init() error { repo_module.LoadRepoConfig() + admin_model.RemoveAllWithNotice(db.DefaultContext, "Clean up temporary repository uploads", setting.Repository.Upload.TempPath) + admin_model.RemoveAllWithNotice(db.DefaultContext, "Clean up temporary repositories", repo_module.LocalCopyPath()) return initPushQueue() } |