diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/clean/server/test.sh | 29 | ||||
-rw-r--r-- | scripts/create-import-video-file-job.ts | 2 | ||||
-rwxr-xr-x | scripts/create-transcoding-job.ts | 2 | ||||
-rwxr-xr-x | scripts/prune-storage.ts | 2 |
4 files changed, 24 insertions, 11 deletions
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh index 3b8fe39ed..235ff52cc 100755 --- a/scripts/clean/server/test.sh +++ b/scripts/clean/server/test.sh | |||
@@ -2,15 +2,28 @@ | |||
2 | 2 | ||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | for i in $(seq 1 6); do | 5 | recreateDB () { |
6 | dbname="peertube_test$i" | 6 | dbname="peertube_test$1" |
7 | 7 | ||
8 | dropdb --if-exists "$dbname" | 8 | dropdb --if-exists "$dbname" |
9 | rm -rf "./test$i" | 9 | |
10 | rm -f "./config/local-test.json" | ||
11 | rm -f "./config/local-test-$i.json" | ||
12 | createdb -O peertube "$dbname" | 10 | createdb -O peertube "$dbname" |
13 | psql -c "CREATE EXTENSION pg_trgm;" "$dbname" | 11 | psql -c "CREATE EXTENSION pg_trgm;" "$dbname" & |
14 | psql -c "CREATE EXTENSION unaccent;" "$dbname" | 12 | psql -c "CREATE EXTENSION unaccent;" "$dbname" & |
15 | redis-cli KEYS "bull-localhost:900$i*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL | 13 | } |
14 | |||
15 | removeFiles () { | ||
16 | rm -rf "./test$1" "./config/local-test.json" "./config/local-test-$1.json" | ||
17 | } | ||
18 | |||
19 | dropRedis () { | ||
20 | redis-cli KEYS "bull-localhost:900$1*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL | ||
21 | } | ||
22 | |||
23 | for i in $(seq 1 6); do | ||
24 | recreateDB "$i" & | ||
25 | dropRedis "$i" & | ||
26 | removeFiles "$i" & | ||
16 | done | 27 | done |
28 | |||
29 | wait | ||
diff --git a/scripts/create-import-video-file-job.ts b/scripts/create-import-video-file-job.ts index 2b636014a..c8c6c6429 100644 --- a/scripts/create-import-video-file-job.ts +++ b/scripts/create-import-video-file-job.ts | |||
@@ -25,7 +25,7 @@ run() | |||
25 | async function run () { | 25 | async function run () { |
26 | await initDatabaseModels(true) | 26 | await initDatabaseModels(true) |
27 | 27 | ||
28 | const video = await VideoModel.loadByUUID(program['video']) | 28 | const video = await VideoModel.loadByUUIDWithFile(program['video']) |
29 | if (!video) throw new Error('Video not found.') | 29 | if (!video) throw new Error('Video not found.') |
30 | if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.') | 30 | if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.') |
31 | 31 | ||
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts index 3ea30f98e..7e5b687bb 100755 --- a/scripts/create-transcoding-job.ts +++ b/scripts/create-transcoding-job.ts | |||
@@ -28,7 +28,7 @@ run() | |||
28 | async function run () { | 28 | async function run () { |
29 | await initDatabaseModels(true) | 29 | await initDatabaseModels(true) |
30 | 30 | ||
31 | const video = await VideoModel.loadByUUID(program['video']) | 31 | const video = await VideoModel.loadByUUIDWithFile(program['video']) |
32 | if (!video) throw new Error('Video not found.') | 32 | if (!video) throw new Error('Video not found.') |
33 | 33 | ||
34 | const dataInput = { | 34 | const dataInput = { |
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts index 572283868..b00f20934 100755 --- a/scripts/prune-storage.ts +++ b/scripts/prune-storage.ts | |||
@@ -56,7 +56,7 @@ async function pruneDirectory (directory: string) { | |||
56 | const uuid = getUUIDFromFilename(file) | 56 | const uuid = getUUIDFromFilename(file) |
57 | let video: VideoModel | 57 | let video: VideoModel |
58 | 58 | ||
59 | if (uuid) video = await VideoModel.loadByUUID(uuid) | 59 | if (uuid) video = await VideoModel.loadByUUIDWithFile(uuid) |
60 | 60 | ||
61 | if (!uuid || !video) toDelete.push(join(directory, file)) | 61 | if (!uuid || !video) toDelete.push(join(directory, file)) |
62 | } | 62 | } |