summaryrefslogtreecommitdiff
path: root/internal/media/manager.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-11-25 18:23:42 +0100
committerLibravatar GitHub <noreply@github.com>2022-11-25 17:23:42 +0000
commit13e9abd02a1f4003c7be922a22e8f1d095a55d61 (patch)
treeccc7b7bbb0d040dc1db84d581849a0e443f91698 /internal/media/manager.go
parent[bugfix] Change emailVerified to true for admin account create (#1140) (diff)
downloadgotosocial-13e9abd02a1f4003c7be922a22e8f1d095a55d61.tar.xz
[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
Diffstat (limited to 'internal/media/manager.go')
-rw-r--r--internal/media/manager.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/media/manager.go b/internal/media/manager.go
index d04f161d4..67c03fb31 100644
--- a/internal/media/manager.go
+++ b/internal/media/manager.go
@@ -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.