diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-06 11:35:56 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-04-08 10:07:53 +0200 |
commit | f479685678406a5df864d89615b33d29085ebfc6 (patch) | |
tree | 8de15e90cd8d97d8810715df8585c61f48d5282a /scripts/prune-storage.ts | |
parent | 968aaed2066873fc1c39f95168284122d9d15e21 (diff) | |
download | PeerTube-f479685678406a5df864d89615b33d29085ebfc6.tar.gz PeerTube-f479685678406a5df864d89615b33d29085ebfc6.tar.zst PeerTube-f479685678406a5df864d89615b33d29085ebfc6.zip |
Agnostic actor image storage
Diffstat (limited to 'scripts/prune-storage.ts')
-rwxr-xr-x | scripts/prune-storage.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts index dcb1fcf90..bdfb335c6 100755 --- a/scripts/prune-storage.ts +++ b/scripts/prune-storage.ts | |||
@@ -11,7 +11,7 @@ import { VideoRedundancyModel } from '../server/models/redundancy/video-redundan | |||
11 | import * as Bluebird from 'bluebird' | 11 | import * as Bluebird from 'bluebird' |
12 | import { getUUIDFromFilename } from '../server/helpers/utils' | 12 | import { getUUIDFromFilename } from '../server/helpers/utils' |
13 | import { ThumbnailModel } from '../server/models/video/thumbnail' | 13 | import { ThumbnailModel } from '../server/models/video/thumbnail' |
14 | import { AvatarModel } from '../server/models/avatar/avatar' | 14 | import { ActorImageModel } from '../server/models/account/actor-image' |
15 | import { uniq, values } from 'lodash' | 15 | import { uniq, values } from 'lodash' |
16 | import { ThumbnailType } from '@shared/models' | 16 | import { ThumbnailType } from '@shared/models' |
17 | 17 | ||
@@ -43,7 +43,7 @@ async function run () { | |||
43 | await pruneDirectory(CONFIG.STORAGE.PREVIEWS_DIR, doesThumbnailExist(true, ThumbnailType.PREVIEW)), | 43 | await pruneDirectory(CONFIG.STORAGE.PREVIEWS_DIR, doesThumbnailExist(true, ThumbnailType.PREVIEW)), |
44 | await pruneDirectory(CONFIG.STORAGE.THUMBNAILS_DIR, doesThumbnailExist(false, ThumbnailType.MINIATURE)), | 44 | await pruneDirectory(CONFIG.STORAGE.THUMBNAILS_DIR, doesThumbnailExist(false, ThumbnailType.MINIATURE)), |
45 | 45 | ||
46 | await pruneDirectory(CONFIG.STORAGE.AVATARS_DIR, doesAvatarExist) | 46 | await pruneDirectory(CONFIG.STORAGE.ACTOR_IMAGES, doesActorImageExist) |
47 | ) | 47 | ) |
48 | 48 | ||
49 | const tmpFiles = await readdir(CONFIG.STORAGE.TMP_DIR) | 49 | const tmpFiles = await readdir(CONFIG.STORAGE.TMP_DIR) |
@@ -107,10 +107,10 @@ function doesThumbnailExist (keepOnlyOwned: boolean, type: ThumbnailType) { | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | async function doesAvatarExist (file: string) { | 110 | async function doesActorImageExist (file: string) { |
111 | const avatar = await AvatarModel.loadByName(file) | 111 | const image = await ActorImageModel.loadByName(file) |
112 | 112 | ||
113 | return !!avatar | 113 | return !!image |
114 | } | 114 | } |
115 | 115 | ||
116 | async function doesRedundancyExist (file: string) { | 116 | async function doesRedundancyExist (file: string) { |