S2OJ/web/app/upgrade/42_acm_team_account/upgrade.php
Baoshuo 353ee59c07
All checks were successful
continuous-integration/drone/push Build is passing
fix: 2cd81ab055
2023-02-15 17:17:14 +08:00

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";
}
}
};