From: River Tarnell Date: Fri, 11 May 2007 07:44:40 +0000 (+0000) Subject: nextJobDB should have a way to pick a db having specific type of job in the queue X-Git-Tag: 1.31.0-rc.0~52953 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=efc54ce3f1cab72c546dcbf2b7e67301929dba41;p=lhc%2Fweb%2Fwiklou.git nextJobDB should have a way to pick a db having specific type of job in the queue --- diff --git a/maintenance/nextJobDB.php b/maintenance/nextJobDB.php index 7aa05a27f5..3073227ebb 100644 --- a/maintenance/nextJobDB.php +++ b/maintenance/nextJobDB.php @@ -4,8 +4,14 @@ * 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(); @@ -22,6 +28,7 @@ if ( !$pendingDBs ) { foreach ( $dbsByMaster as $master => $dbs ) { $dbConn = new Database( $master, $wgDBuser, $wgDBpassword ); + $stype = $dbConn->addQuotes($type); # Padding row for MySQL bug $sql = "(SELECT '-------------------------------------------')"; @@ -29,7 +36,10 @@ if ( !$pendingDBs ) { 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