8 define( 'REPORTING_INTERVAL', 1000 );
10 function populateCategory( $begin, $maxlag, $throttle, $force ) {
11 $dbw = wfGetDB( DB_MASTER );
14 $row = $dbw->selectRow(
17 array( 'ul_key' => 'populate category' ),
21 echo "Category table already populated. Use php ".
22 "maintenance/populateCategory.php\n--force from the command line ".
28 $maxlag = intval( $maxlag );
29 $throttle = intval( $throttle );
30 $force = (bool)$force;
32 $where = 'cl_to > '.$dbw->addQuotes( $begin );
39 # Find which category to update
40 $row = $dbw->selectRow(
54 $where = 'cl_to > '.$dbw->addQuotes( $name );
56 # Use the row to update the category count
57 $cat = Category::newFromName( $name );
58 if( !is_object( $cat ) ) {
59 echo "The category named $name is not valid?!\n";
61 $cat->refreshCounts();
65 if( !($i % REPORTING_INTERVAL) ) {
67 wfWaitForSlaves( $maxlag );
69 usleep( $throttle*1000 );
74 array( 'ul_key' => 'populate category' ),
79 echo "Category population complete.\n";
82 echo "Could not insert category population row.\n";