3 * @addtogroup Maintenance
7 define( 'REPORTING_INTERVAL', 1000 );
9 function populateCategory( $begin, $maxlag, $throttle, $force ) {
10 $dbw = wfGetDB( DB_MASTER );
13 $row = $dbw->selectRow(
16 array( 'ul_key' => 'populate category' ),
20 echo "Category table already populated. Use php ".
21 "maintenance/populateCategory.php\n--force from the command line ".
27 $maxlag = intval( $maxlag );
28 $throttle = intval( $throttle );
29 $force = (bool)$force;
31 $where = 'cl_to > '.$dbw->addQuotes( $begin );
38 # Find which category to update
39 $row = $dbw->selectRow(
53 $where = 'cl_to > '.$dbw->addQuotes( $name );
55 # Use the row to update the category count
56 $cat = Category::newFromName( $name );
57 if( !is_object( $cat ) ) {
58 echo "The category named $name is not valid?!\n";
60 $cat->refreshCounts();
64 if( !($i % REPORTING_INTERVAL) ) {
66 wfWaitForSlaves( $maxlag );
68 usleep( $throttle*1000 );
73 array( 'ul_key' => 'populate category' ),
78 echo "Category population complete.\n";
81 echo "Could not insert category population row.\n";