3 * @addtogroup Maintenance
7 require_once "commandLine.inc";
9 define( 'REPORTING_INTERVAL', 1000 );
11 function populateCategory( $begin, $maxlag, $throttle, $force ) {
12 $dbw = wfGetDB( DB_MASTER );
15 $row = $dbw->selectRow(
18 array( 'ul_key' => 'populate category' ),
22 echo "Category table already populated. Use php ".
23 "maintenace/populateCategory.php\n--force from the command line ".
29 $maxlag = intval( $maxlag );
30 $throttle = intval( $throttle );
31 $force = (bool)$force;
33 $where = 'cl_to > '.$dbw->addQuotes( $begin );
40 # Find which category to update
41 $row = $dbw->selectRow(
55 $where = 'cl_to > '.$dbw->addQuotes( $name );
57 # Use the row to update the category count
58 $cat = Category::newFromName( $name );
59 if( !is_object( $cat ) ) {
61 throw new MWException( "The category named $name is not valid?!" );
63 $cat->refreshCounts();
66 if( !($i % REPORTING_INTERVAL) ) {
68 wfWaitForSlaves( $maxlag );
70 usleep( $throttle*1000 );
75 array( 'ul_key' => 'populate category' ),
80 echo "Category population complete.\n";
83 echo "Could not insert category population row.\n";