2016-07-18 16:39:37 +00:00
|
|
|
<?php
|
2022-11-06 02:26:21 +00:00
|
|
|
// Actually, these things should be done by main_judger so that the code would be much simpler.
|
|
|
|
// However, this lib exists due to some history issues.
|
|
|
|
|
|
|
|
function dataNewProblem($id) {
|
|
|
|
mkdir("/var/uoj_data/upload/$id");
|
|
|
|
mkdir("/var/uoj_data/$id");
|
2023-01-30 10:52:36 +00:00
|
|
|
mkdir(UOJContext::storagePath() . "/problem_resources/$id");
|
2022-11-06 02:26:21 +00:00
|
|
|
|
|
|
|
UOJLocalRun::execAnd([
|
|
|
|
['cd', '/var/uoj_data'],
|
|
|
|
['rm', "$id.zip"],
|
|
|
|
['zip', "$id.zip", $id, '-r', '-q']
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
function dataClearProblemData($problem) {
|
|
|
|
$id = $problem['id'];
|
|
|
|
if (!validateUInt($id)) {
|
|
|
|
UOJLog::error("dataClearProblemData: hacker detected");
|
|
|
|
return "invalid problem id";
|
2016-07-18 16:39:37 +00:00
|
|
|
}
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
UOJLocalRun::exec(['rm', "/var/uoj_data/$id", '-r']);
|
|
|
|
UOJLocalRun::exec(['rm', "/var/uoj_data/upload/$id", '-r']);
|
|
|
|
dataNewProblem($id);
|
|
|
|
}
|