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