mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-23 16:18:42 +00:00
29 lines
575 B
PHP
29 lines
575 B
PHP
|
<?php
|
||
|
|
||
|
return function (string $type) {
|
||
|
if ($type == 'up_after_sql') {
|
||
|
DB::init();
|
||
|
|
||
|
$lists = DB::selectAll([
|
||
|
"select * from lists",
|
||
|
]);
|
||
|
$parsedown = HTML::parsedown();
|
||
|
$purifier = HTML::purifier();
|
||
|
|
||
|
foreach ($lists as $info) {
|
||
|
DB::insert([
|
||
|
"insert into lists_contents",
|
||
|
DB::bracketed_fields(['id', 'content', 'content_md']),
|
||
|
"values",
|
||
|
DB::tuple([
|
||
|
$info['id'],
|
||
|
$purifier->purify($parsedown->text($info['description'])),
|
||
|
$info['description'],
|
||
|
]),
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
DB::query("alter table lists drop column description");
|
||
|
}
|
||
|
};
|