aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-15 11:56:54 +0200
committerChocobozzz <me@florianbigard.com>2019-08-15 11:56:54 +0200
commit40b8906957719bf8ece5d5f8179136bc604dbf84 (patch)
tree60cfe083fe4e613e520642087434f07c70e0595c
parent7ef6783ecbeee2867a4e947bc5de78df8e6f0f1d (diff)
downloadPeerTube-40b8906957719bf8ece5d5f8179136bc604dbf84.tar.gz
PeerTube-40b8906957719bf8ece5d5f8179136bc604dbf84.tar.zst
PeerTube-40b8906957719bf8ece5d5f8179136bc604dbf84.zip
Fix prune storage script with some configs
-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[] = []