From 13e9abd02a1f4003c7be922a22e8f1d095a55d61 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 25 Nov 2022 18:23:42 +0100 Subject: [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 --- internal/media/manager.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/media/manager.go') 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. -- cgit v1.2.3