diff options
-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[] = [] |