function optimize_tables($tbl_list = null) { if (!$tbl_list) { $tbl_list = get_fud_table_list(); } q('OPTIMIZE TABLE ' . implode(', ', $tbl_list)); }
<script language="Javascript1.2"> var intervalID; function scrolldown() { window.scroll(0, 30000); } intervalID = setInterval('scrolldown()', 100); </script> <?php $tbl = $DBHOST_TBL_PREFIX; draw_stat('Locking the database for checking'); if (__dbtype__ == 'mysql') { q('DROP TABLE IF EXISTS ' . $tbl . 'tmp_consist'); q('CREATE TABLE ' . $tbl . 'tmp_consist (p INT, ps INT UNSIGNED, c INT)'); } $tbls = get_fud_table_list(); // add the various table aliases array_push($tbls, $tbl . 'users u', $tbl . 'forum f', $tbl . 'thread t', $tbl . 'poll p', $tbl . 'poll_opt po', $tbl . 'poll_opt_track pot', $tbl . 'msg m', $tbl . 'pmsg pm', $tbl . 'mod mm', $tbl . 'thread_rate_track trt', $tbl . 'msg_report mr', $tbl . 'cat c', $tbl . 'forum_notify fn', $tbl . 'thread_notify tn', $tbl . 'buddy b', $tbl . 'user_ignore i', $tbl . 'msg m1', $tbl . 'msg m2', $tbl . 'users u1', $tbl . 'users u2', $tbl . 'attach a', $tbl . 'thr_exchange te', $tbl . 'read r', $tbl . 'mime mi', $tbl . 'group_members gm', $tbl . 'group_resources gr', $tbl . 'groups g', $tbl . 'group_members gm1', $tbl . 'group_members gm2', $tbl . 'themes thm'); db_lock(implode(' WRITE, ', $tbls) . ' WRITE'); draw_stat('Locked!'); draw_stat('Validating category order'); $i = 1; $c = q('SELECT id, view_order FROM ' . $tbl . 'cat ORDER BY view_order, id'); while ($r = db_rowarr($c)) { if ($r[1] != $i) { q('UPDATE ' . $tbl . 'cat SET view_order=' . $i . ' WHERE id=' . $id); } ++$i; } unset($r); draw_stat('Done: Validating category order');