DeleteRepositoryArchives deletes all repositories' archives.
()
| 1973 | |
| 1974 | // DeleteRepositoryArchives deletes all repositories' archives. |
| 1975 | func DeleteRepositoryArchives() error { |
| 1976 | if taskStatusTable.IsRunning(taskNameCleanOldArchives) { |
| 1977 | return nil |
| 1978 | } |
| 1979 | taskStatusTable.Start(taskNameCleanOldArchives) |
| 1980 | defer taskStatusTable.Stop(taskNameCleanOldArchives) |
| 1981 | |
| 1982 | return x.Where("id > 0").Iterate(new(Repository), |
| 1983 | func(idx int, bean any) error { |
| 1984 | repo := bean.(*Repository) |
| 1985 | return os.RemoveAll(filepath.Join(repo.RepoPath(), "archives")) |
| 1986 | }) |
| 1987 | } |
| 1988 | |
| 1989 | func gatherMissingRepoRecords() ([]*Repository, error) { |
| 1990 | repos := make([]*Repository, 0, 10) |