aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xscripts/prune-storage.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts
index d6dff8247..df4bdeebe 100755
--- a/scripts/prune-storage.ts
+++ b/scripts/prune-storage.ts
@@ -9,6 +9,7 @@ import * as Bluebird from 'bluebird'
9import { getUUIDFromFilename } from '../server/helpers/utils' 9import { getUUIDFromFilename } from '../server/helpers/utils'
10import { ThumbnailModel } from '../server/models/video/thumbnail' 10import { ThumbnailModel } from '../server/models/video/thumbnail'
11import { AvatarModel } from '../server/models/avatar/avatar' 11import { AvatarModel } from '../server/models/avatar/avatar'
12import { uniq, values } from 'lodash'
12 13
13run() 14run()
14 .then(() => process.exit(0)) 15 .then(() => process.exit(0))
@@ -18,6 +19,13 @@ run()
18 }) 19 })
19 20
20async function run () { 21async function run () {
22 const dirs = values(CONFIG.STORAGE)
23
24 if (uniq(dirs).length !== dirs.length) {
25 console.error('Cannot prune storage because you put multiple storage keys in the same directory.')
26 process.exit(0)
27 }
28
21 await initDatabaseModels(true) 29 await initDatabaseModels(true)
22 30
23 let toDelete: string[] = [] 31 let toDelete: string[] = []