S2OJ/web/app/upgrade/42_acm_team_account/upgrade.php

28 lines
497 B
PHP
Raw Normal View History

2023-02-15 08:58:53 +00:00
<?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),
2023-02-15 08:58:53 +00:00
],
"where", [
"username" => $user['username']
]
]);
echo "Updated user {$user['username']} ({$extra['school']}).\n";
2023-02-15 08:58:53 +00:00
}
}
};