summaryrefslogtreecommitdiff
path: root/cmd/gotosocial/admin.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 /cmd/gotosocial/admin.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 'cmd/gotosocial/admin.go')
-rw-r--r--cmd/gotosocial/admin.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/cmd/gotosocial/admin.go b/cmd/gotosocial/admin.go
index 4bf71d612..0575452fb 100644
--- a/cmd/gotosocial/admin.go
+++ b/cmd/gotosocial/admin.go
@@ -21,6 +21,7 @@ package main
import (
"github.com/spf13/cobra"
"github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action/admin/account"
+ "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action/admin/media/prune"
"github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action/admin/trans"
"github.com/superseriousbusiness/gotosocial/internal/config"
)
@@ -152,5 +153,40 @@ func adminCommands() *cobra.Command {
config.AddAdminTrans(adminImportCmd)
adminCmd.AddCommand(adminImportCmd)
+ /*
+ ADMIN MEDIA COMMANDS
+ */
+
+ adminMediaCmd := &cobra.Command{
+ Use: "media",
+ Short: "admin commands related stored media attachments/emojis",
+ }
+
+ /*
+ ADMIN MEDIA PRUNE COMMANDS
+ */
+ adminMediaPruneCmd := &cobra.Command{
+ Use: "prune",
+ Short: "admin commands for pruning unused/orphaned media from storage",
+ }
+ config.AddAdminMediaPrune(adminMediaPruneCmd)
+
+ adminMediaPruneOrphanedCmd := &cobra.Command{
+ Use: "orphaned",
+ Short: "prune orphaned media from storage",
+ PreRunE: func(cmd *cobra.Command, args []string) error {
+ return preRun(preRunArgs{cmd: cmd})
+ },
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return run(cmd.Context(), prune.Orphaned)
+ },
+ }
+ config.AddAdminMediaPrune(adminMediaPruneOrphanedCmd)
+ adminMediaPruneCmd.AddCommand(adminMediaPruneOrphanedCmd)
+
+ adminMediaCmd.AddCommand(adminMediaPruneCmd)
+
+ adminCmd.AddCommand(adminMediaCmd)
+
return adminCmd
}