Forum Home Upgrading to phpBB 2.0


sql_query($sql)) ) { print "
\n"; print "$errormsg
"; $sql_error = $db->sql_error(); print $sql_error['code'] .": ". $sql_error['message']. "
\n"; print "
$sql
"; print "
\n"; return FALSE; } else { return $result; } } common_header(); // // Generate search word list // // Fetch a batch of posts_text entries // $sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id FROM " . POSTS_TEXT_TABLE; $result = query($sql, "Couldn't get post count totals"); $max_post_id = $db->sql_fetchrow($result); $totalposts = $max_post_id['total']; $max_post_id = $max_post_id['max_post_id']; $per_percent = round(( $totalposts / 500 ) * 10); $postcounter = ( !isset($HTTP_GET_VARS['batchstart']) ) ? 0 : $HTTP_GET_VARS['batchstart']; $batchsize = 150; // Process this many posts per loop $batchcount = 0; $total_percent = 0; for(;$postcounter <= $max_post_id; $postcounter += $batchsize) { $batchstart = $postcounter + 1; $batchend = $postcounter + $batchsize; $batchcount++; print " * Fulltext Indexing ( $batchstart to $batchend ) :: "; flush(); $sql = "SELECT * FROM " . POSTS_TEXT_TABLE ." WHERE post_id BETWEEN $batchstart AND $batchend"; $posts_result = query($sql, "Couldn't obtain post_text"); $per_pct = ceil( $db->sql_numrows($posts_result) / 40 ); $inc = 0; if ( $row = $db->sql_fetchrow($posts_result) ) { do { add_search_words('global', $row['post_id'], $row['post_text'], $row['post_subject']); $inc++; if ( $inc == $per_pct ) { print "."; flush(); $inc = 0; } } while( $row = $db->sql_fetchrow($posts_result) ); } $db->sql_freeresult($posts_result); // Remove common words after the first 2 batches and after every 4th batch after that. if ( $batchcount % 4 == 3 ) { remove_common('global', 0.4); } print " OK
\n"; } common_footer(); ?>