Some bug fixes for r83634.
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 10 Mar 2011 04:47:21 +0000 (04:47 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 10 Mar 2011 04:47:21 +0000 (04:47 +0000)
maintenance/nextJobDB.php

index 5d01650..2d3608d 100644 (file)
@@ -62,6 +62,7 @@ class nextJobDB extends Maintenance {
                                return;
                        }
 
+                       $candidates = array_values( $candidates );
                        $db = $candidates[ mt_rand( 0, count( $candidates ) - 1 ) ];
                        if ( !$this->checkJob( $type, $db ) ) {
                                // This job is not available in the current database. Remove it from 
@@ -86,9 +87,9 @@ class nextJobDB extends Maintenance {
         * Check if the specified database has a job of the specified type in it.
         * The type may be false to indicate "all". 
         */
-       function checkJob( $type, $db ) {
-               $lb = wfGetLB( $db );
-               $db = $lb->getConnection( DB_MASTER );
+       function checkJob( $type, $dbName ) {
+               $lb = wfGetLB( $dbName );
+               $db = $lb->getConnection( DB_MASTER, array(), $dbName );
                if ( $type === false ) {
                        $conds = array();
                } else {