1
0
Fork 0
forked from forgejo/forgejo
This commit is contained in:
Unknwon 2014-11-18 19:05:33 -05:00
parent ce8d4cc80b
commit 2d8c414f8c
9 changed files with 55 additions and 10 deletions

View file

@ -1171,6 +1171,18 @@ func SearchRepositoryByName(opt SearchOption) (repos []*Repository, err error) {
return repos, err
}
// DeleteRepositoryArchives deletes all repositories' archives.
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
}
return os.RemoveAll(filepath.Join(RepoPath(repo.Owner.Name, repo.Name), "archives"))
})
}
// __ __ __ .__
// / \ / \_____ _/ |_ ____ | |__
// \ \/\/ /\__ \\ __\/ ___\| | \