getRecordNum() / 250); $score = Option::get('user_initial_score'); // chunked (optionally) for ($i = 0; $i <= $steps; $i++) { $start = $i * 250; $sql = "SELECT * FROM `$v2_table_name` ORDER BY `uid` LIMIT $start, 250"; $result = $db->query($sql); while ($row = $result->fetch_array()) { if (!$db->has('player_name', $row['username'], $v3_players)) { // generate random nickname $nickname = $row['username']."_".time(); $db->insert([ 'email' => '', 'nickname' => $nickname, 'score' => $score, 'password' => $row['password'], 'avatar' => '0', 'ip' => $row['ip'], 'permission' => '0', 'last_sign_at' => Utils::getTimeFormatted(time() - 86400), 'register_at' => Utils::getTimeFormatted() ], $v3_users); $uid = $db->select('nickname', $nickname, null, $v3_users)['uid']; $db->insert([ 'uid' => $uid, 'player_name' => $row['username'], 'preference' => $row['preference'], 'last_modified' => Utils::getTimeFormatted() ], $v3_players); $db->insert([ 'uid' => $uid, 'textures' => '' ], $v3_closets); $imported++; // echo $row['username']." saved.
"; } else { $duplicated++; // echo $row['username']." duplicated.
"; } } } return [ 'imported' => $imported, 'duplicated' => $duplicated ];