mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-29 21:06:20 +00:00
28 lines
497 B
PHP
28 lines
497 B
PHP
<?php
|
|
|
|
return function ($type) {
|
|
DB::init();
|
|
|
|
if ($type == 'up') {
|
|
$users = DB::selectAll("select * from user_info");
|
|
|
|
foreach ($users as $user) {
|
|
$extra = UOJUser::getExtra($user);
|
|
|
|
$extra['school'] = $user['school'];
|
|
|
|
DB::update([
|
|
"update user_info",
|
|
"set", [
|
|
"extra" => json_encode($extra, JSON_UNESCAPED_UNICODE),
|
|
],
|
|
"where", [
|
|
"username" => $user['username']
|
|
]
|
|
]);
|
|
|
|
echo "Updated user {$user['username']} ({$extra['school']}).\n";
|
|
}
|
|
}
|
|
};
|