mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 06:58:41 +00:00
chore(problem/resources): add upgrader
This commit is contained in:
parent
799bec0e5b
commit
1e775d0d02
@ -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;
|
||||
|
||||
|
13
web/app/upgrade/31_problem_resources/upgrade.php
Normal file
13
web/app/upgrade/31_problem_resources/upgrade.php
Normal 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");
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user