From efc54ce3f1cab72c546dcbf2b7e67301929dba41 Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Fri, 11 May 2007 07:44:40 +0000 Subject: [PATCH] nextJobDB should have a way to pick a db having specific type of job in the queue --- maintenance/nextJobDB.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 -- 2.20.1