* Pick a database that has pending jobs
*/
+$options = array( 'type' );
+
require_once( 'commandLine.inc' );
+$type = isset($options['type'])
+ ? $options['type']
+ : false;
+
$pendingDBs = $wgMemc->get( 'jobqueue:dbs' );
if ( !$pendingDBs ) {
$pendingDBs = array();
foreach ( $dbsByMaster as $master => $dbs ) {
$dbConn = new Database( $master, $wgDBuser, $wgDBpassword );
+ $stype = $dbConn->addQuotes($type);
# Padding row for MySQL bug
$sql = "(SELECT '-------------------------------------------')";
if ( $sql != '' ) {
$sql .= ' UNION ';
}
- $sql .= "(SELECT '$dbName' FROM `$dbName`.job LIMIT 1)";
+ if ($type === false)
+ $sql .= "(SELECT '$dbName' FROM `$dbName`.job LIMIT 1)";
+ else
+ $sql .= "(SELECT '$dbName' FROM `$dbName`.job WHERE job_cmd='$stype' LIMIT 1)";
}
$res = $dbConn->query( $sql, 'nextJobDB.php' );
$row = $dbConn->fetchRow( $res ); // discard padding row