From: Chocobozzz Date: Thu, 15 Aug 2019 09:56:54 +0000 (+0200) Subject: Fix prune storage script with some configs X-Git-Tag: test-tag-1.0.0~4 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=40b8906957719bf8ece5d5f8179136bc604dbf84;p=oweals%2Fpeertube.git Fix prune storage script with some configs --- 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' import { getUUIDFromFilename } from '../server/helpers/utils' import { ThumbnailModel } from '../server/models/video/thumbnail' import { AvatarModel } from '../server/models/avatar/avatar' +import { uniq, values } from 'lodash' run() .then(() => process.exit(0)) @@ -18,6 +19,13 @@ run() }) async function run () { + const dirs = values(CONFIG.STORAGE) + + if (uniq(dirs).length !== dirs.length) { + console.error('Cannot prune storage because you put multiple storage keys in the same directory.') + process.exit(0) + } + await initDatabaseModels(true) let toDelete: string[] = []