'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__);
}
?>
- Rebuilding search index …
'p.id, p.message, t.id, t.subject, t.first_post_id',
'FROM' => 'posts AS p',
'JOINS' => array(
array(
'INNER JOIN' => 'topics AS t',
'ON' => 't.id=p.topic_id'
)
),
'WHERE' => 'p.id>='.$start_at,
'ORDER BY' => 'p.id',
'LIMIT' => $per_page
);
($hook = get_hook('ari_qr_fetch_posts')) ? eval($hook) : null;
$result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
$post_id = 0;
echo '';
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 '
';
// Check if there is more work to do
$query = array(
'SELECT' => 'p.id',
'FROM' => 'posts AS p',
'WHERE' => 'p.id>'.$post_id,
'ORDER BY' => 'p.id',
'LIMIT' => '1'
);
($hook = get_hook('ari_qr_find_next_post')) ? eval($hook) : null;
$result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
$query_str = ($pun_db->num_rows($result)) ? '?i_per_page='.$per_page.'&i_start_at='.$pun_db->result($result).'&csrf_token='.generate_form_token('reindex'.$pun_user['id']) : '';
($hook = get_hook('ari_cycle_end')) ? eval($hook) : null;
$pun_db->end_transaction();
$pun_db->close();
exit('
'.$lang_admin['Javascript redirect'].' '.$lang_admin['Click to continue'].'.');
}
// Get the first post ID from the db
$query = array(
'SELECT' => 'p.id',
'FROM' => 'posts AS p',
'ORDER BY' => 'p.id',
'LIMIT' => '1'
);
($hook = get_hook('ari_qr_find_lowest_post_id')) ? eval($hook) : null;
$result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
if ($pun_db->num_rows($result))
$first_id = $pun_db->result($result);
// Setup form
$pun_page['set_count'] = $pun_page['fld_count'] = 0;
// Setup breadcrumbs
$pun_page['crumbs'] = array(
array($pun_config['o_board_title'], pun_link($pun_url['index'])),
array($lang_admin['Forum administration'], pun_link($pun_url['admin_index'])),
$lang_admin['Rebuild index']
);
define('PUN_PAGE_SECTION', 'management');
define('PUN_PAGE', 'admin-reindex');
require PUN_ROOT.'header.php';
?>