From df203c33756838c92c9623ef1e68f1ce9fc22cbb Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 18 Sep 2022 12:06:30 +0800 Subject: [PATCH] fix: storage --- docker-compose.yml | 2 +- web/app/libs/uoj-rand-lib.php | 2 +- web/install.sh | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b470f2e..db4b5b3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,6 +48,6 @@ services: - uoj-judger volumes: - ./uoj_data/web/data:/var/uoj_data - - ./uoj_data/web/storage_submission:/opt/uoj/web/app/storage/submission + - ./uoj_data/web/storage:/opt/uoj/web/app/storage ports: - "80:80" diff --git a/web/app/libs/uoj-rand-lib.php b/web/app/libs/uoj-rand-lib.php index 2e221c1..d39c527 100644 --- a/web/app/libs/uoj-rand-lib.php +++ b/web/app/libs/uoj-rand-lib.php @@ -27,7 +27,7 @@ function uojRandAvaiableTmpFileName() { function uojRandAvaiableSubmissionFileName() { $num = uojRand(1, 10000); if (!file_exists(UOJContext::storagePath()."/submission/$num")) { - system("mkdir ".UOJContext::storagePath()."/submission/$num"); + mkdir(UOJContext::storagePath()."/submission/$num", 0777, true); } return uojRandAvaiableFileName("/submission/$num/"); } diff --git a/web/install.sh b/web/install.sh index b5c191b..5ec5b8d 100644 --- a/web/install.sh +++ b/web/install.sh @@ -48,6 +48,7 @@ UOJEOF #Create UOJ session save dir and make PHP extensions available mkdir --mode=733 /var/lib/php/uoj_sessions && chmod +t /var/lib/php/uoj_sessions sed -i -e '912a\extension=v8js.so\nextension=yaml.so' /etc/php/7.4/apache2/php.ini + sed -i 's|;sys_temp_dir = "/tmp"|sys_temp_dir = "/tmp"|g' /etc/php/7.4/apache2/php.ini } setWebConf(){ @@ -88,6 +89,9 @@ initProgress(){ service apache2 restart #Touch SetupDone flag file touch /var/uoj_data/.UOJSetupDone + mkdir -p /opt/uoj/web/app/storage/submission + mkdir -p /opt/uoj/web/app/storage/tmp + chmod -R 777 /opt/uoj/web/app/storage printf "\n\n***Installation complete. Enjoy!***\n" }