[feature] Add admin media prune orphaned CLI command (#1146)

* add FilePath regex

* add `admin media prune orphaned` command

* add prune orphaned function to media manager

* don't mark flag as required

* document admin media prune orphaned cmd

* oh envparsing.sh you coy minx
This commit is contained in:
tobi 2022-11-25 18:23:42 +01:00 committed by GitHub
commit 13e9abd02a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 441 additions and 45 deletions

View file

@ -91,6 +91,12 @@ type Manager interface {
//
// The returned int is the amount of media that was pruned by this function.
PruneUnusedLocalAttachments(ctx context.Context) (int, error)
// PruneOrphaned prunes files that exist in storage but which do not have a corresponding
// entry in the database.
//
// If dry is true, then nothing will be changed, only the amount that *would* be removed
// is returned to the caller.
PruneOrphaned(ctx context.Context, dry bool) (int, error)
// Stop stops the underlying worker pool of the manager. It should be called
// when closing GoToSocial in order to cleanly finish any in-progress jobs.