* @ingroup Maintenance
*/
-require_once( __DIR__ . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
/**
* Maintenance script that picks a database that has pending jobs.
}
public function execute() {
- global $wgMemc, $wgJobTypesExcludedFromDefaultQueue;
-
- $type = false; // job type required/picked
+ global $wgJobTypesExcludedFromDefaultQueue;
+ // job type required/picked
if ( $this->hasOption( 'types' ) ) {
$types = explode( ' ', $this->getOption( 'types' ) );
} elseif ( $this->hasOption( 'type' ) ) {
return; // no jobs for this type
}
- list( $type, $db ) = $candidates[ mt_rand( 0, count( $candidates ) - 1 ) ];
- if ( !$this->checkJob( $type, $db ) ) { // queue is actually empty?
- $pendingDBs[$type] = array_diff( $pendingDBs[$type], $db );
- JobQueueAggregator::singleton()->notifyQueueEmpty( $db, $type );
+ list( $type, $db ) = $candidates[mt_rand( 0, count( $candidates ) - 1 )];
+ if ( JobQueueGroup::singleton( $db )->isQueueDeprioritized( $type ) ) {
+ $pendingDBs[$type] = array_diff( $pendingDBs[$type], array( $db ) );
$again = true;
}
} while ( $again );
}
}
- /**
- * Check if the specified database has a job of the specified type in it.
- * The type may be false to indicate "all".
- * @param $type string
- * @param $dbName string
- * @return bool
- */
- private function checkJob( $type, $dbName ) {
- return !JobQueueGroup::singleton( $dbName )->get( $type )->isEmpty();
- }
-
/**
* Do all ready periodic jobs for all databases every 5 minutes (and .1% of the time)
* @return integer
}
$maintClass = "nextJobDb";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;