diff options
author | Unknwon <u@gogs.io> | 2015-10-23 11:03:15 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-10-23 11:03:15 -0400 |
commit | db7ac8bc1d4cfb2890a11784d49814c230a7b3e6 (patch) | |
tree | a44f2d0432fe796963fc98bfa98267416d4543ed | |
parent | c6ce6bd4c2e51d2282b5810d49683d34113cf0c7 (diff) | |
download | gitea-db7ac8bc1d4cfb2890a11784d49814c230a7b3e6.tar.gz gitea-db7ac8bc1d4cfb2890a11784d49814c230a7b3e6.zip |
use notice instead of suspend delete archives
-rw-r--r-- | models/repo.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/models/repo.go b/models/repo.go index e02b78b328..ae1e9b7497 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1125,7 +1125,7 @@ func DeleteRepository(uid, repoID int64) error { desc := fmt.Sprintf("delete repository files[%s]: %v", repoPath, err) log.Warn(desc) if err = CreateRepositoryNotice(desc); err != nil { - log.Error(4, "add notice: %v", err) + log.Error(4, "CreateRepositoryNotice: %v", err) } } @@ -1268,10 +1268,14 @@ func DeleteRepositoryArchives() error { return x.Where("id > 0").Iterate(new(Repository), func(idx int, bean interface{}) error { repo := bean.(*Repository) - if err := repo.GetOwner(); err != nil { - return err + repoPath, err := repo.RepoPath() + if err != nil { + if err2 := CreateRepositoryNotice(fmt.Sprintf("DeleteRepositoryArchives[%d]: %v", repo.ID, err)); err2 != nil { + log.Error(4, "CreateRepositoryNotice: %v", err2) + } + return nil } - return os.RemoveAll(filepath.Join(RepoPath(repo.Owner.Name, repo.Name), "archives")) + return os.RemoveAll(filepath.Join(repoPath, "archives")) }) } |