Fix prune storage script with some configs

pull/2034/head
Chocobozzz 2019-08-15 11:56:54 +02:00
parent 7ef6783ecb
commit 40b8906957
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 8 additions and 0 deletions

View File

@ -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[] = []