use notice instead of suspend delete archives
This commit is contained in:
parent
c6ce6bd4c2
commit
db7ac8bc1d
1 changed files with 8 additions and 4 deletions
|
@ -1125,7 +1125,7 @@ func DeleteRepository(uid, repoID int64) error {
|
||||||
desc := fmt.Sprintf("delete repository files[%s]: %v", repoPath, err)
|
desc := fmt.Sprintf("delete repository files[%s]: %v", repoPath, err)
|
||||||
log.Warn(desc)
|
log.Warn(desc)
|
||||||
if err = CreateRepositoryNotice(desc); err != nil {
|
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),
|
return x.Where("id > 0").Iterate(new(Repository),
|
||||||
func(idx int, bean interface{}) error {
|
func(idx int, bean interface{}) error {
|
||||||
repo := bean.(*Repository)
|
repo := bean.(*Repository)
|
||||||
if err := repo.GetOwner(); err != nil {
|
repoPath, err := repo.RepoPath()
|
||||||
return err
|
if err != nil {
|
||||||
|
if err2 := CreateRepositoryNotice(fmt.Sprintf("DeleteRepositoryArchives[%d]: %v", repo.ID, err)); err2 != nil {
|
||||||
|
log.Error(4, "CreateRepositoryNotice: %v", err2)
|
||||||
}
|
}
|
||||||
return os.RemoveAll(filepath.Join(RepoPath(repo.Owner.Name, repo.Name), "archives"))
|
return nil
|
||||||
|
}
|
||||||
|
return os.RemoveAll(filepath.Join(repoPath, "archives"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue