| 1987 | } |
| 1988 | |
| 1989 | func gatherMissingRepoRecords() ([]*Repository, error) { |
| 1990 | repos := make([]*Repository, 0, 10) |
| 1991 | if err := x.Where("id > 0").Iterate(new(Repository), |
| 1992 | func(idx int, bean any) error { |
| 1993 | repo := bean.(*Repository) |
| 1994 | if !com.IsDir(repo.RepoPath()) { |
| 1995 | repos = append(repos, repo) |
| 1996 | } |
| 1997 | return nil |
| 1998 | }); err != nil { |
| 1999 | if err2 := Handle.Notices().Create(context.TODO(), NoticeTypeRepository, fmt.Sprintf("gatherMissingRepoRecords: %v", err)); err2 != nil { |
| 2000 | return nil, errors.Newf("CreateRepositoryNotice: %v", err) |
| 2001 | } |
| 2002 | } |
| 2003 | return repos, nil |
| 2004 | } |
| 2005 | |
| 2006 | // DeleteMissingRepositories deletes all repository records that lost Git files. |
| 2007 | func DeleteMissingRepositories() error { |