fix: storage

This commit is contained in:
Baoshuo Ren 2022-09-18 12:06:30 +08:00
parent af58465477
commit df203c3375
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 6 additions and 2 deletions

View File

@ -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"

View File

@ -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/");
}

View File

@ -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"
}