echo "<td>"; } $adminer->backwardKeysPrint($backward_keys, $rows[$n]); echo "</tr>\n"; // close to allow white-space: pre } if (is_ajax()) { exit; } echo "</table>\n"; echo !$group && $select ? "" : "<script type='text/javascript'>tableCheck();</script>\n"; } if (($rows || $page) && !is_ajax()) { $exact_count = true; if ($_GET["page"] != "last" && +$limit && !$is_group && ($found_rows >= $limit || $page)) { $found_rows = found_rows($table_status, $where); if ($found_rows < max(10000.0, 2 * ($page + 1) * $limit)) { // slow with big tables $found_rows = reset(slow_query("SELECT COUNT(*) FROM " . table($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : ""))); } else { $exact_count = false; } } echo "<p class='pages'>"; if (+$limit && ($found_rows === false || $found_rows > $limit)) { // display first, previous 4, next 4 and last page $max_page = $found_rows === false ? $page + (count($rows) >= $limit ? 2 : 1) : floor(($found_rows - 1) / $limit); echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "'), event); return false;\">" . lang('Page') . "</a>:"; echo pagination(0, $page) . ($page > 5 ? " ..." : ""); for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) { echo pagination($i, $page);
fwrite($handle, $html_head . $disclaimer); } else { echo $html_head . $disclaimer; } $query = 'SELECT SQL_CALC_FOUND_ROWS 1 FROM okato LIMIT 0'; mysqli_query($link, $query); $num_okato = found_rows($link); $query = 'SELECT SQL_CALC_FOUND_ROWS 1 FROM okato WHERE found=1 LIMIT 0'; mysqli_query($link, $query); $num_okato_found = found_rows($link); $query = 'SELECT SQL_CALC_FOUND_ROWS 1 FROM oktmo LIMIT 0'; mysqli_query($link, $query); $num_oktmo = found_rows($link); $query = 'SELECT SQL_CALC_FOUND_ROWS 1 FROM oktmo WHERE found=1 LIMIT 0'; mysqli_query($link, $query); $num_oktmo_found = found_rows($link); $status_okato = $num_okato_found . ' из ' . $num_okato . ' '; if (100 * $num_okato_found % $num_okato != 0) { $status_okato .= '~'; $percents = round(100 * $num_okato_found / $num_okato); } else { $percents = 100 * $num_okato_found / $num_okato; } $status_okato .= $percents . '%'; $status_oktmo = $num_oktmo_found . ' из ' . $num_oktmo . ' '; if (100 * $num_oktmo_found % $num_oktmo != 0) { $status_oktmo .= '~'; $percents = round(100 * $num_oktmo_found / $num_oktmo); } else { $percents = 100 * $num_oktmo_found / $num_oktmo; }
$adminer->backwardKeysPrint($backward_keys, $rows[$n]); echo "</tr>\n"; // close to allow white-space: pre } if (is_adminer_ajax()) { exit; } echo "</table>\n"; } if (($rows || $page) && !is_adminer_ajax()) { $exact_count = true; if ($_GET["page"] != "last") { if (!+$limit) { $found_rows = count($rows); } elseif ($jush != "sql" || !$is_group) { $found_rows = $is_group ? false : found_rows($table_status, $where); if ($found_rows < max(10000.0, 2 * ($page + 1) * $limit)) { // slow with big tables $found_rows = reset(slow_query(count_rows($TABLE, $where, $is_group, $group))); } else { $exact_count = false; } } } if (+$limit && ($found_rows === false || $found_rows > $limit || $page)) { echo "<p class='pages'>"; // display first, previous 4, next 4 and last page $max_page = $found_rows === false ? $page + (count($rows) >= $limit ? 2 : 1) : floor(($found_rows - 1) / $limit); if ($jush != "simpledb") { echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "'), event); return false;\">" . lang('Page') . "</a>:"; echo adminer_pagination(0, $page) . ($page > 5 ? " ..." : "");
for ($i = 1; $i <= $num_items; $i++) { $query = 'SELECT ate, centrum FROM wikidata WHERE id=' . $i; $result = mysqli_query($link, $query); $row = mysqli_fetch_array($result, MYSQLI_ASSOC); mysqli_free_result($result); if (isset($row['ate'])) { $num_added += get_lost($link, $handle, $row, 'ate'); } if (isset($row['centrum'])) { $num_added += get_lost($link, $handle, $row, 'centrum'); } fwrite(STDERR, "\r" . percents($num_items, $i) . ' Обработано ' . sprintf("%10d", $i) . ' элементов из ' . sprintf("%10d", $num_items) . ' добавлено элементов ' . sprintf("%5d", $num_added) . ' '); } $query = 'SELECT SQL_CALC_FOUND_ROWS 1 FROM types LIMIT 0'; mysqli_query($link, $query); $num_items = found_rows($link); $num_added = 0; echo "\n\n" . date("H:i:s") . " Выполняется поиск потерянных элементов для типов территорий\n\n"; for ($i = 1; $i <= $num_items; $i++) { $query = 'SELECT type FROM types WHERE id=' . $i; $result = mysqli_query($link, $query); $row = mysqli_fetch_array($result, MYSQLI_ASSOC); mysqli_free_result($result); if (isset($row['type'])) { $num_added += get_lost($link, $handle, $row, 'type'); } fwrite(STDERR, "\r" . percents($num_items, $i) . ' Обработано ' . sprintf("%10d", $i) . ' элементов из ' . sprintf("%10d", $num_items) . ' добавлено элементов ' . sprintf("%5d", $num_added) . ' '); } $time += time(); echo "\n\n" . date("H:i:s") . ' Поиск выполнен за ' . hms($time) . "\n\n"; mysqli_close($link);