Fix pageExists when passed invalid title
[lhc/web/wiklou.git] / maintenance / nextJobDB.php
index 06ccccb..d172363 100644 (file)
@@ -57,32 +57,24 @@ class NextJobDB extends Maintenance {
                        return; // no DBs with jobs or cache is both empty and locked
                }
 
-               do {
-                       $again = false;
-
-                       $candidates = array(); // list of (type, db)
-                       // Flatten the tree of candidates into a flat list so that a random
-                       // item can be selected, weighing each queue (type/db tuple) equally.
-                       foreach ( $pendingDBs as $type => $dbs ) {
-                               if (
-                                       ( is_array( $types ) && in_array( $type, $types ) ) ||
-                                       ( $types === false && !in_array( $type, $wgJobTypesExcludedFromDefaultQueue ) )
-                               ) {
-                                       foreach ( $dbs as $db ) {
-                                               $candidates[] = array( $type, $db );
-                                       }
+               $candidates = array(); // list of (type, db)
+               // Flatten the tree of candidates into a flat list so that a random
+               // item can be selected, weighing each queue (type/db tuple) equally.
+               foreach ( $pendingDBs as $type => $dbs ) {
+                       if (
+                               ( is_array( $types ) && in_array( $type, $types ) ) ||
+                               ( $types === false && !in_array( $type, $wgJobTypesExcludedFromDefaultQueue ) )
+                       ) {
+                               foreach ( $dbs as $db ) {
+                                       $candidates[] = array( $type, $db );
                                }
                        }
-                       if ( !count( $candidates ) ) {
-                               return; // no jobs for this type
-                       }
+               }
+               if ( !count( $candidates ) ) {
+                       return; // no jobs for this 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 );
+               list( $type, $db ) = $candidates[mt_rand( 0, count( $candidates ) - 1 )];
 
                if ( $this->hasOption( 'types' ) ) {
                        $this->output( $db . " " . $type . "\n" );
@@ -93,7 +85,7 @@ class NextJobDB extends Maintenance {
 
        /**
         * Do all ready periodic jobs for all databases every 5 minutes (and .1% of the time)
-        * @return integer
+        * @return int
         */
        private function executeReadyPeriodicTasks() {
                global $wgLocalDatabases, $wgMemc;