diff -r e3d7322305bf -r 5e1f1e916419 punbb/admin/reindex.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/punbb/admin/reindex.php Sat Apr 05 23:56:45 2008 -0400 @@ -0,0 +1,252 @@ + $_ ) +{ + $$key =& $GLOBALS[$key]; +} + +($hook = get_hook('ari_start')) ? eval($hook) : null; + +if ($session->user_level < USER_LEVEL_ADMIN) + message($lang_common['No permission']); + +// The reindexer isn't used for MySQL +if ($db_type == 'mysql' || $db_type == 'mysqli') + message($lang_common['Bad request']); + +// Load the admin.php language file +require PUN_ROOT.'lang/'.$pun_user['language'].'/admin.php'; +$GLOBALS['lang_admin'] = $lang_admin; + + +if (isset($_GET['i_per_page']) && isset($_GET['i_start_at'])) +{ + $per_page = intval($_GET['i_per_page']); + $start_at = intval($_GET['i_start_at']); + if ($per_page < 1 || $start_at < 1) + message($lang_common['Bad request']); + + ($hook = get_hook('ari_cycle_start')) ? eval($hook) : null; + + @set_time_limit(0); + + // If this is the first cycle of posts we empty the search index before we proceed + if (isset($_GET['i_empty_index'])) + { + $query = array( + 'DELETE' => 'search_matches' + ); + + ($hook = get_hook('ari_qr_empty_search_matches')) ? eval($hook) : null; + $pun_db->query_build($query) or error(__FILE__, __LINE__); + + $query = array( + 'DELETE' => 'search_words' + ); + + ($hook = get_hook('ari_qr_empty_search_words')) ? eval($hook) : null; + $pun_db->query_build($query) or error(__FILE__, __LINE__); + + // Reset the sequence for the search words (not needed for SQLite) + if ($db_type == 'pgsql') + $result = $pun_db->query('SELECT setval(\''.$pun_db->prefix.'search_words_id_seq\', 1, false)') or error(__FILE__, __LINE__); + } + +?> + + + +
+ + +';
+ while ($cur_post = $pun_db->fetch_row($result))
+ {
+ printf($lang_admin['Processing post'], $cur_post[0], $cur_post[2]).'
'."\n";
+
+ if ($cur_post[0] == $cur_post[4]) // This is the "topic post" so we have to index the subject as well
+ update_search_index('post', $cur_post[0], $cur_post[1], $cur_post[3]);
+ else
+ update_search_index('post', $cur_post[0], $cur_post[1]);
+
+ $post_id = $cur_post[0];
+ }
+ echo '