getRecordNum() / 250); $public = isset($_POST['import_as_private']) ? '1' : '0'; // chunked 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()) { // compile patterns $name = str_replace('{username}', $row['username'], $_POST['texture_name_pattern']); if ($row['hash_steve'] != "") { $name = str_replace('{model}', 'steve', $name); if (!$db->has('hash', $row['hash_steve'], $v3_table_name)) { $db->insert([ 'name' => $name, 'type' => 'steve', 'likes' => 0, 'hash' => $row['hash_steve'], 'size' => 0, 'uploader' => $_POST['uploader_uid'], 'public' => $public, 'upload_at' => Utils::getTimeFormatted() ], $v3_table_name); $imported++; // echo $row['hash_steve']." saved.
"; } else { $duplicated++; // echo $row['hash_steve']." duplicated.
"; } } if ($row['hash_alex'] != "") { $name = str_replace('{model}', 'alex', $name); if (!$db->has('hash', $row['hash_alex'], $v3_table_name)) { $db->insert([ 'name' => $name, 'type' => 'alex', 'likes' => 0, 'hash' => $row['hash_alex'], 'size' => 0, 'uploader' => $_POST['uploader_uid'], 'public' => $public, 'upload_at' => Utils::getTimeFormatted() ], $v3_table_name); $imported++; // echo $row['hash_alex']." saved.
"; } else { $duplicated++; // echo $row['hash_alex']." duplicated.
"; } } if ($row['hash_cape'] != "") { $name = str_replace('{model}', 'cape', $name); if (!$db->has('hash', $row['hash_cape'], $v3_table_name)) { $db->insert([ 'name' => $name, 'type' => 'cape', 'likes' => 0, 'hash' => $row['hash_cape'], 'size' => 0, 'uploader' => $_POST['uploader_uid'], 'public' => $public, 'upload_at' => Utils::getTimeFormatted() ], $v3_table_name); $imported++; // echo $row['hash_cape']." saved.
"; } else { $duplicated++; // echo $row['hash_cape']." duplicated.
"; } } } } return [ 'imported' => $imported, 'duplicated' => $duplicated ];