diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-15 11:56:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-15 11:56:54 +0200 |
commit | 40b8906957719bf8ece5d5f8179136bc604dbf84 (patch) | |
tree | 60cfe083fe4e613e520642087434f07c70e0595c /scripts/prune-storage.ts | |
parent | 7ef6783ecbeee2867a4e947bc5de78df8e6f0f1d (diff) | |
download | PeerTube-40b8906957719bf8ece5d5f8179136bc604dbf84.tar.gz PeerTube-40b8906957719bf8ece5d5f8179136bc604dbf84.tar.zst PeerTube-40b8906957719bf8ece5d5f8179136bc604dbf84.zip |
Fix prune storage script with some configs
Diffstat (limited to 'scripts/prune-storage.ts')
-rwxr-xr-x | scripts/prune-storage.ts | 8 |
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' | |||
9 | import { getUUIDFromFilename } from '../server/helpers/utils' | 9 | import { getUUIDFromFilename } from '../server/helpers/utils' |
10 | import { ThumbnailModel } from '../server/models/video/thumbnail' | 10 | import { ThumbnailModel } from '../server/models/video/thumbnail' |
11 | import { AvatarModel } from '../server/models/avatar/avatar' | 11 | import { AvatarModel } from '../server/models/avatar/avatar' |
12 | import { uniq, values } from 'lodash' | ||
12 | 13 | ||
13 | run() | 14 | run() |
14 | .then(() => process.exit(0)) | 15 | .then(() => process.exit(0)) |
@@ -18,6 +19,13 @@ run() | |||
18 | }) | 19 | }) |
19 | 20 | ||
20 | async function run () { | 21 | async 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[] = [] |