Merge "Fixed ArrayUtils::pickRandom() when $rand=0."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 5 Mar 2013 23:53:36 +0000 (23:53 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 5 Mar 2013 23:54:53 +0000 (23:54 +0000)
includes/DefaultSettings.php
includes/HTMLForm.php
includes/api/ApiQuerySiteinfo.php
includes/job/JobQueueGroup.php
maintenance/nextJobDB.php

index 73c097e..7b80715 100644 (file)
@@ -5546,6 +5546,8 @@ $wgJobTypesExcludedFromDefaultQueue = array( 'AssembleUploadChunks', 'PublishSta
 
 /**
  * Map of job types to configuration arrays.
+ * This determines which queue class and storage system is used for each job type.
+ * Job types that do not have explicit configuration will use the 'default' config.
  * These settings should be global to all wikis.
  */
 $wgJobTypeConf = array(
index 684866f..5af813b 100644 (file)
@@ -957,7 +957,7 @@ class HTMLForm extends ContextSource {
                                        $hasLabel = true;
                                }
                        } elseif ( is_array( $value ) ) {
-                               $section = $this->displaySection( $value, $key );
+                               $section = $this->displaySection( $value, $key, "$fieldsetIDPrefix$key-" );
                                $legend = $this->getLegend( $key );
                                if ( isset( $this->mSectionHeaders[$key] ) ) {
                                        $section = $this->mSectionHeaders[$key] . $section;
index ac13589..596fd06 100644 (file)
@@ -139,11 +139,15 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
                if ( $wgContLang->linkPrefixExtension() ) {
                        $data['linkprefix'] = wfMessage( 'linkprefix' )->inContentLanguage()->text();
+               } else {
+                       $data['linkprefix'] = '';
                }
 
                $linktrail = $wgContLang->linkTrail();
                if ( $linktrail ) {
                        $data['linktrail'] = $linktrail;
+               } else {
+                       $data['linktrail'] = '';
                }
 
                $git = SpecialVersion::getGitHeadSha1( $GLOBALS['IP'] );
index 23a5494..dae026c 100644 (file)
@@ -236,6 +236,23 @@ class JobQueueGroup {
                return $types;
        }
 
+       /**
+        * Check if jobs should not be popped of a queue right now.
+        * This is only used for performance, such as to avoid spamming
+        * the queue with many sub-jobs before they actually get run.
+        *
+        * @param $type string
+        * @return bool
+        */
+       public function isQueueDeprioritized( $type ) {
+               if ( $type === 'refreshLinks2' ) {
+                       // Don't keep converting refreshLinks2 => refreshLinks jobs if the
+                       // later jobs have not been done yet. This helps throttle queue spam.
+                       return !$this->get( 'refreshLinks' )->isEmpty();
+               }
+               return false;
+       }
+
        /**
         * Execute any due periodic queue maintenance tasks for all queues.
         *
index f5bf4da..1be5146 100644 (file)
@@ -77,10 +77,9 @@ class nextJobDB extends Maintenance {
                                return; // no jobs for this type
                        }
 
-                       list( $type, $db ) = $candidates[ mt_rand( 0, count( $candidates ) - 1 ) ];
-                       if ( !$this->checkJob( $type, $db ) ) { // queue is actually empty?
-                               $pendingDBs[$type] = array_diff( $pendingDBs[$type], $db );
-                               JobQueueAggregator::singleton()->notifyQueueEmpty( $db, $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 );
@@ -92,17 +91,6 @@ 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".
-        * @param $type string
-        * @param $dbName string
-        * @return bool
-        */
-       private function checkJob( $type, $dbName ) {
-               return !JobQueueGroup::singleton( $dbName )->get( $type )->isEmpty();
-       }
-
        /**
         * Do all ready periodic jobs for all databases every 5 minutes (and .1% of the time)
         * @return integer