rebuilding

This commit is contained in:
Michael Save 2012-04-16 17:33:13 +10:00
parent 41e1a2481b
commit 7101fa540b

View File

@ -447,20 +447,26 @@ function mod_rebuild() {
continue; continue;
openBoard($board['uri']); openBoard($board['uri']);
$log[] = '<strong>' . sprintf($config['board_abbreviation'], $board['uri']) . '</strong>: Creating index pages';
if (!in_array($config['file_script'], $rebuilt_scripts)) { if (isset($_POST['rebuild_index'])) {
buildIndex();
$log[] = '<strong>' . sprintf($config['board_abbreviation'], $board['uri']) . '</strong>: Creating index pages';
}
if (isset($_POST['rebuild_javascript']) && !in_array($config['file_script'], $rebuilt_scripts)) {
$log[] = '<strong>' . sprintf($config['board_abbreviation'], $board['uri']) . '</strong>: Rebuilding <strong>' . $config['file_script'] . '</strong>'; $log[] = '<strong>' . sprintf($config['board_abbreviation'], $board['uri']) . '</strong>: Rebuilding <strong>' . $config['file_script'] . '</strong>';
buildJavascript(); buildJavascript();
$rebuilt_scripts[] = $config['file_script']; $rebuilt_scripts[] = $config['file_script'];
} }
if (isset($_POST['rebuild_thread'])) {
$query = query(sprintf("SELECT `id` FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); $query = query(sprintf("SELECT `id` FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error());
while ($post = $query->fetch(PDO::FETCH_ASSOC)) { while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
$log[] = '<strong>' . sprintf($config['board_abbreviation'], $board['uri']) . '</strong>: Rebuilding thread #' . $post['id']; $log[] = '<strong>' . sprintf($config['board_abbreviation'], $board['uri']) . '</strong>: Rebuilding thread #' . $post['id'];
buildThread($post['id']); buildThread($post['id']);
} }
} }
}
mod_page("Rebuild", 'mod/rebuilt.html', array('logs' => $log)); mod_page("Rebuild", 'mod/rebuilt.html', array('logs' => $log));
return; return;