forked from forgejo/forgejo
Fix #635
This commit is contained in:
parent
ce8d4cc80b
commit
2d8c414f8c
9 changed files with 55 additions and 10 deletions
|
@ -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"))
|
||||
})
|
||||
}
|
||||
|
||||
// __ __ __ .__
|
||||
// / \ / \_____ _/ |_ ____ | |__
|
||||
// \ \/\/ /\__ \\ __\/ ___\| | \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue