public function execute() {
$begin = $this->getOption( 'begin', '' );
$throttle = $this->getOption( 'throttle', 0 );
- $force = $this->getOption( 'force', false );
+ $force = $this->hasOption( 'force' );
$dbw = $this->getDB( DB_MASTER );
$row = $dbw->selectRow(
'updatelog',
'1',
- array( 'ul_key' => 'populate category' ),
+ [ 'ul_key' => 'populate category' ],
__METHOD__
);
if ( $row ) {
$throttle = intval( $throttle );
if ( $begin !== '' ) {
- $where = 'cl_to > ' . $dbw->addQuotes( $begin );
+ $where = [ 'cl_to > ' . $dbw->addQuotes( $begin ) ];
} else {
- $where = null;
+ $where = [ '1 = 1' ];
}
$i = 0;
'cl_to',
$where,
__METHOD__,
- array(
+ [
'ORDER BY' => 'cl_to'
- )
+ ]
);
if ( !$row ) {
# Done, hopefully.
usleep( $throttle * 1000 );
}
- if ( $dbw->insert(
+ $dbw->insert(
'updatelog',
- array( 'ul_key' => 'populate category' ),
+ [ 'ul_key' => 'populate category' ],
__METHOD__,
'IGNORE'
- ) ) {
- $this->output( "Category population complete.\n" );
-
- return true;
- } else {
- $this->output( "Could not insert category population row.\n" );
+ );
- return false;
- }
+ return true;
}
}
-$maintClass = "PopulateCategory";
+$maintClass = PopulateCategory::class;
require_once RUN_MAINTENANCE_IF_MAIN;