Changeset 1279

Show
Ignore:
Timestamp:
01/19/08 15:15:36 (7 months ago)
Author:
Neal
Message:

Make the reindexing process more efficient for forums which do not have sequential post IDs.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/punbb-1.3-dev/upload/admin/reindex.php

    r1236 r1279  
    6565        } 
    6666 
    67         $end_at = $start_at + $per_page; 
    68  
    6967?> 
    7068<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     
    9290 
    9391        // Fetch posts to process 
    94         $result = $db->query('SELECT p.id, p.message, t.id, t.subject, t.first_post_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.id>='.$start_at.' AND p.id<'.$end_at.' ORDER BY p.id') or error(__FILE__, __LINE__); 
     92        $result = $db->query('SELECT p.id, p.message, t.id, t.subject, t.first_post_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.id>='.$start_at.' ORDER BY p.id LIMIT '.$per_page) or error(__FILE__, __LINE__); 
    9593 
     94        $post_id = 0; 
    9695        echo '<p>'; 
    9796        while ($cur_post = $db->fetch_row($result)) 
     
    103102                else 
    104103                        update_search_index('post', $cur_post[0], $cur_post[1]); 
     104 
     105                $post_id = $cur_post[0]; 
    105106        } 
    106107        echo '</p>'; 
    107108 
    108109        // Check if there is more work to do 
    109         $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id>'.$end_at.' ORDER BY id ASC LIMIT 1') or error(__FILE__, __LINE__); 
     110        $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id>'.$post_id.' ORDER BY id ASC LIMIT 1') or error(__FILE__, __LINE__); 
    110111 
    111112        $query_str = ($db->num_rows($result)) ? '?i_per_page='.$per_page.'&i_start_at='.$db->result($result) : '';