chore(problem/resources): add upgrader

This commit is contained in:
Baoshuo Ren 2023-01-30 18:53:20 +08:00
parent 799bec0e5b
commit 1e775d0d02
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 15 additions and 1 deletions

View File

@ -993,7 +993,8 @@ INSERT INTO `upgrades` (`name`, `status`, `updated_at`) VALUES
('18_user_permissions', 'up', now()),
('20_problem_difficulty', 'up', now()),
('21_problem_difficulty', 'up', now()),
('28_remote_judge', 'up', now());
('28_remote_judge', 'up', now()),
('31_problem_resources', 'up', now());
/*!40000 ALTER TABLE `upgrades` ENABLE KEYS */;
UNLOCK TABLES;

View File

@ -0,0 +1,13 @@
<?php
return function ($type) {
if ($type == 'up') {
DB::init();
$problems = DB::selectAll("select id from problems");
foreach ($problems as $id) {
mkdir(UOJContext::storagePath() . "/problem_resources/$id");
}
}
};