mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Adjust gitea doctor --run storages to check all storage types (#21785)
The doctor check `storages` currently only checks the attachment storage. This PR adds some basic garbage collection functionality for the other types of storage. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		@@ -62,6 +62,13 @@ func GetBlobByID(ctx context.Context, blobID int64) (*PackageBlob, error) {
 | 
			
		||||
	return pb, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExistPackageBlobWithSHA returns if a package blob exists with the provided sha
 | 
			
		||||
func ExistPackageBlobWithSHA(ctx context.Context, blobSha256 string) (bool, error) {
 | 
			
		||||
	return db.GetEngine(ctx).Exist(&PackageBlob{
 | 
			
		||||
		HashSHA256: blobSha256,
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FindExpiredUnreferencedBlobs gets all blobs without associated files older than the specific duration
 | 
			
		||||
func FindExpiredUnreferencedBlobs(ctx context.Context, olderThan time.Duration) ([]*PackageBlob, error) {
 | 
			
		||||
	pbs := make([]*PackageBlob, 0, 10)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user