X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fprune-storage.ts;h=4953a74399eb47a7239646bc5fee59b798149cca;hb=d00dc28dd73ad9dd419d5a5ac6ac747cefbc6e8b;hp=4ab0b4863fd1ccff1aaaf4ff16652272be98787b;hpb=6d8c8ea73a774c3568e6d28a4cbebcf7979d5c2a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts index 4ab0b4863..4953a7439 100755 --- a/scripts/prune-storage.ts +++ b/scripts/prune-storage.ts @@ -1,6 +1,6 @@ import * as prompt from 'prompt' import { join } from 'path' -import { CONFIG } from '../server/initializers/constants' +import { CONFIG } from '../server/initializers/config' import { VideoModel } from '../server/models/video/video' import { initDatabaseModels } from '../server/initializers' import { remove, readdir } from 'fs-extra' @@ -19,7 +19,8 @@ async function run () { const storageOnlyOwnedToPrune = [ CONFIG.STORAGE.VIDEOS_DIR, - CONFIG.STORAGE.TORRENTS_DIR + CONFIG.STORAGE.TORRENTS_DIR, + CONFIG.STORAGE.REDUNDANCY_DIR ] const storageForAllToPrune = [ @@ -36,6 +37,9 @@ async function run () { toDelete = toDelete.concat(await pruneDirectory(directory, false)) } + const tmpFiles = await readdir(CONFIG.STORAGE.TMP_DIR) + toDelete = toDelete.concat(tmpFiles.map(t => join(CONFIG.STORAGE.TMP_DIR, t))) + if (toDelete.length === 0) { console.log('No files to delete.') return @@ -91,6 +95,7 @@ async function askConfirmation () { confirm: { type: 'string', description: 'These following unused files can be deleted, but please check your backups first (bugs happen).' + + ' Notice PeerTube must have been stopped when your ran this script.' + ' Can we delete these files?', default: 'n', required: true