Merge "Improved handling of pending queue delisting."
authorDemon <chadh@wikimedia.org>
Mon, 28 Jan 2013 19:10:47 +0000 (19:10 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 28 Jan 2013 19:10:47 +0000 (19:10 +0000)
1  2 
maintenance/nextJobDB.php

@@@ -124,13 -106,22 +118,26 @@@ class nextJobDB extends Maintenance 
                        }
                } while ( $again );
  
 -              $this->output( $db . "\n" );
 +              if ( $this->hasOption( 'types' ) ) {
 +                      $this->output( $db . " " . $type . "\n" );
 +              } else {
 +                      $this->output( $db . "\n" );
 +              }
        }
  
+       private function delistDB( array $pendingDBs, $db, $type ) {
+               if ( $type === false ) {
+                       // There are no jobs available in the current database
+                       foreach ( $pendingDBs as $type2 => $dbs ) {
+                               $pendingDBs[$type2] = array_diff( $pendingDBs[$type2], array( $db ) );
+                       }
+               } else {
+                       // There are no jobs of this type available in the current database
+                       $pendingDBs[$type] = array_diff( $pendingDBs[$type], array( $db ) );
+               }
+               return $pendingDBs;
+       }
        /**
         * Check if the specified database has a job of the specified type in it.
         * The type may be false to indicate "all".