Merge "MalformedTitleException should call parent::__construct"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 7 May 2015 13:07:25 +0000 (13:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 7 May 2015 13:07:25 +0000 (13:07 +0000)
16 files changed:
includes/htmlform/HTMLForm.php
includes/htmlform/HTMLFormField.php
includes/htmlform/HTMLTextField.php
includes/jobqueue/JobQueueRedis.php
includes/logging/LogFormatter.php
includes/logging/LogPager.php
includes/specials/SpecialLinkSearch.php
maintenance/cleanupRemovedModules.php
maintenance/cleanupTable.inc
maintenance/populateCategory.php
maintenance/rebuildImages.php
maintenance/update.php
maintenance/updateCollation.php
maintenance/waitForSlave.php
resources/src/startup.js
tests/qunit/suites/resources/startup.test.js

index ce14003..738fec3 100644 (file)
@@ -51,6 +51,7 @@
  *    'id'                  -- HTML id attribute
  *    'cssclass'            -- CSS class
  *    'csshelpclass'        -- CSS class used to style help text
+ *    'dir'                 -- Direction of the element.
  *    'options'             -- associative array mapping labels to values.
  *                             Some field types support multi-level arrays.
  *    'options-messages'    -- associative array mapping message keys to values.
index 9576c77..0c3fe44 100644 (file)
@@ -10,6 +10,7 @@ abstract class HTMLFormField {
        protected $mValidationCallback;
        protected $mFilterCallback;
        protected $mName;
+       protected $mDir;
        protected $mLabel; # String label.  Set on construction
        protected $mID;
        protected $mClass = '';
@@ -377,6 +378,10 @@ abstract class HTMLFormField {
                        $this->mName = $params['name'];
                }
 
+               if ( isset( $params['dir'] ) ) {
+                       $this->mDir = $params['dir'];
+               }
+
                $validName = Sanitizer::escapeId( $this->mName );
                $validName = str_replace( array( '.5B', '.5D' ), array( '[', ']' ), $validName );
                if ( $this->mName != $validName && !isset( $params['nodata'] ) ) {
index 88df49d..a67e52e 100644 (file)
@@ -11,6 +11,7 @@ class HTMLTextField extends HTMLFormField {
                                'name' => $this->mName,
                                'size' => $this->getSize(),
                                'value' => $value,
+                               'dir' => $this->mDir,
                        ) + $this->getTooltipAndAccessKey();
 
                if ( $this->mClass !== '' ) {
index 275d027..c0d3bec 100644 (file)
@@ -611,13 +611,6 @@ LUA;
                }
        }
 
-       /**
-        * @return array
-        */
-       protected function doGetPeriodicTasks() {
-               return array(); // managed in the runner loop
-       }
-
        /**
         * @param IJobSpecification $job
         * @return array
index 9c2fdd3..119492b 100644 (file)
@@ -193,6 +193,8 @@ class LogFormatter {
         * @return string Text
         */
        public function getIRCActionText() {
+               global $wgContLang;
+
                $this->plaintext = true;
                $this->irctext = true;
 
@@ -338,7 +340,6 @@ class LogFormatter {
                        case 'block':
                                switch ( $entry->getSubtype() ) {
                                        case 'block':
-                                               global $wgContLang;
                                                // Keep compatibility with extensions by checking for
                                                // new key (5::duration/6::flags) or old key (0/optional 1)
                                                if ( $entry->isLegacy() ) {
@@ -358,7 +359,6 @@ class LogFormatter {
                                                        ->rawParams( $target )->inContentLanguage()->escaped();
                                                break;
                                        case 'reblock':
-                                               global $wgContLang;
                                                $duration = $wgContLang->translateBlockExpiry( $parameters['5::duration'] );
                                                $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'], $wgContLang );
                                                $text = wfMessage( 'reblock-logentry' )
index bf489ab..c4ce7b3 100644 (file)
@@ -192,7 +192,7 @@ class LogPager extends ReverseChronologicalPager {
         * @return void
         */
        private function limitTitle( $page, $pattern ) {
-               global $wgMiserMode;
+               global $wgMiserMode, $wgUserrightsInterwikiDelimiter;
 
                if ( $page instanceof Title ) {
                        $title = $page;
@@ -209,7 +209,6 @@ class LogPager extends ReverseChronologicalPager {
 
                $doUserRightsLogLike = false;
                if ( $this->types == array( 'rights' ) ) {
-                       global $wgUserrightsInterwikiDelimiter;
                        $parts = explode( $wgUserrightsInterwikiDelimiter, $title->getDBKey() );
                        if ( count( $parts ) == 2 ) {
                                list( $name, $database ) = array_map( 'trim', $parts );
index 75ff8f3..0c02628 100644 (file)
@@ -121,43 +121,39 @@ class LinkSearchPage extends QueryPage {
                        '<nowiki>' . $this->getLanguage()->commaList( $protocols_list ) . '</nowiki>',
                        count( $protocols_list )
                );
-               $s = Html::openElement(
-                       'form',
-                       array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => wfScript() )
-               ) . "\n" .
-                       Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) . "\n" .
-                       Html::openElement( 'fieldset' ) . "\n" .
-                       Html::element( 'legend', array(), $this->msg( 'linksearch' )->text() ) . "\n" .
-                       Xml::inputLabel(
-                               $this->msg( 'linksearch-pat' )->text(),
-                               'target',
-                               'target',
-                               50,
-                               $target,
-                               array(
-                                       // URLs are always ltr
-                                       'dir' => 'ltr',
-                               )
-                       ) . "\n";
-
+               $fields = array(
+                       'target' => array(
+                               'type' => 'text',
+                               'name' => 'target',
+                               'id' => 'target',
+                               'size' => 50,
+                               'label-message' => 'linksearch-pat',
+                               'default' => $target,
+                               'dir' => 'ltr',
+                       )
+               );
                if ( !$this->getConfig()->get( 'MiserMode' ) ) {
-                       $s .= Html::namespaceSelector(
-                               array(
-                                       'selected' => $namespace,
-                                       'all' => '',
-                                       'label' => $this->msg( 'linksearch-ns' )->text()
-                               ), array(
+                       $fields += array(
+                               'namespace' => array(
+                                       'class' => 'HTMLSelectNamespace',
                                        'name' => 'namespace',
+                                       'label-message' => 'linksearch-ns',
+                                       'default' => $namespace,
                                        'id' => 'namespace',
-                                       'class' => 'namespaceselector',
-                               )
+                                       'cssclass' => 'namespaceselector',
+                               ),
                        );
                }
-
-               $s .= Xml::submitButton( $this->msg( 'linksearch-ok' )->text() ) . "\n" .
-                       Html::closeElement( 'fieldset' ) . "\n" .
-                       Html::closeElement( 'form' ) . "\n";
-               $out->addHTML( $s );
+               $hiddenFields = array(
+                       'title' => $this->getPageTitle()->getPrefixedDBkey(),
+               );
+               $htmlForm = HTMLForm::factory( 'inline', $fields, $this->getContext() );
+               $htmlForm->addHiddenFields( $hiddenFields );
+               $htmlForm->setSubmitTextMsg( 'linksearch-ok' );
+               $htmlForm->setWrapperLegendMsg( 'linksearch' );
+               $htmlForm->setAction( wfScript() );
+               $htmlForm->setMethod( 'get' );
+               $htmlForm->prepareForm()->displayForm( false );
 
                if ( $target != '' ) {
                        $this->setParams( array(
index e1d0ed6..a4e66ca 100644 (file)
@@ -36,13 +36,6 @@ class CleanupRemovedModules extends Maintenance {
                parent::__construct();
                $this->mDescription = 'Remove cache entries for removed ResourceLoader modules from the database';
                $this->addOption( 'batchsize', 'Delete rows in batches of this size. Default: 500', false, true );
-               $this->addOption(
-                       'max-slave-lag',
-                       'If the slave lag exceeds this many seconds, wait until it drops below this value. '
-                               . 'Default: 5',
-                       false,
-                       true
-               );
        }
 
        public function execute() {
@@ -51,7 +44,6 @@ class CleanupRemovedModules extends Maintenance {
                $moduleNames = $rl->getModuleNames();
                $moduleList = implode( ', ', array_map( array( $dbw, 'addQuotes' ), $moduleNames ) );
                $limit = max( 1, intval( $this->getOption( 'batchsize', 500 ) ) );
-               $maxlag = intval( $this->getOption( 'max-slave-lag', 5 ) );
 
                $this->output( "Cleaning up module_deps table...\n" );
                $i = 1;
@@ -63,7 +55,7 @@ class CleanupRemovedModules extends Maintenance {
                        $numRows = $dbw->affectedRows();
                        $this->output( "Batch $i: $numRows rows\n" );
                        $i++;
-                       wfWaitForSlaves( $maxlag );
+                       wfWaitForSlaves();
                } while ( $numRows > 0 );
                $this->output( "done\n" );
 
@@ -77,7 +69,7 @@ class CleanupRemovedModules extends Maintenance {
                        $numRows = $dbw->affectedRows();
                        $this->output( "Batch $i: $numRows rows\n" );
                        $i++;
-                       wfWaitForSlaves( $maxlag );
+                       wfWaitForSlaves();
                } while ( $numRows > 0 );
                $this->output( "done\n" );
 
@@ -90,7 +82,7 @@ class CleanupRemovedModules extends Maintenance {
                        $numRows = $dbw->affectedRows();
                        $this->output( "Batch $i: $numRows rows\n" );
                        $i++;
-                       wfWaitForSlaves( $maxlag );
+                       wfWaitForSlaves();
                } while ( $numRows > 0 );
                $this->output( "done\n" );
        }
index cbd1be6..f6259e9 100644 (file)
@@ -37,7 +37,6 @@ class TableCleanup extends Maintenance {
        );
 
        protected $dryrun = false;
-       protected $maxLag = 10; # if slaves are lagged more than 10 secs, wait
        public $batchSize = 100;
        public $reportInterval = 100;
 
index ab0ca1e..66553bc 100644 (file)
@@ -57,12 +57,6 @@ TEXT;
                        false,
                        true
                );
-               $this->addOption(
-                       'max-slave-lag',
-                       'If slave lag exceeds this many seconds, wait until it drops before continuing. Default: 10',
-                       false,
-                       true
-               );
                $this->addOption(
                        'throttle',
                        'Wait this many milliseconds after each category. Default: 0',
@@ -74,13 +68,9 @@ TEXT;
 
        public function execute() {
                $begin = $this->getOption( 'begin', '' );
-               $maxSlaveLag = $this->getOption( 'max-slave-lag', 10 );
                $throttle = $this->getOption( 'throttle', 0 );
                $force = $this->getOption( 'force', false );
-               $this->doPopulateCategory( $begin, $maxSlaveLag, $throttle, $force );
-       }
 
-       private function doPopulateCategory( $begin, $maxlag, $throttle, $force ) {
                $dbw = wfGetDB( DB_MASTER );
 
                if ( !$force ) {
index 5a14967..8e39978 100644 (file)
@@ -59,7 +59,6 @@ class ImageBuilder extends Maintenance {
 
        public function execute() {
                $this->dbw = wfGetDB( DB_MASTER );
-               $this->maxLag = 10; # if slaves are lagged more than 10 secs, wait
                $this->dryrun = $this->hasOption( 'dry-run' );
                if ( $this->dryrun ) {
                        $GLOBALS['wgReadOnly'] = 'Dry run mode, image upgrades are suppressed';
index 0fd1fd8..2ba5daf 100755 (executable)
@@ -126,7 +126,7 @@ class UpdateMediaWiki extends Maintenance {
 
                $this->output( "MediaWiki {$wgVersion} Updater\n\n" );
 
-               wfWaitForSlaves( 5 ); // let's not kill databases, shall we? ;) --tor
+               wfWaitForSlaves();
 
                if ( !$this->hasOption( 'skip-compat-checks' ) ) {
                        $this->compatChecks();
index 342ffba..5cf8afa 100644 (file)
@@ -24,8 +24,6 @@
  * @author Aryeh Gregor (Simetrical)
  */
 
-#$optionsWithArgs = array( 'begin', 'max-slave-lag' );
-
 require_once __DIR__ . '/Maintenance.php';
 
 /**
index c9b1abb..50665ef 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Wait until slave lag goes under a certain value.
+ * Wait for the slaves to catch up to the master position.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 require_once __DIR__ . '/Maintenance.php';
 
 /**
- * Maintenance script to wait until slave lag goes under a certain value.
+ * Maintenance script to wait for the slaves to catch up to the master position.
  *
  * @ingroup Maintenance
  */
 class WaitForSlave extends Maintenance {
-       public function __construct() {
-               parent::__construct();
-               $this->addArg( 'maxlag', 'How long to wait for the slaves, default 10 seconds', false );
-       }
-
        public function execute() {
-               wfWaitForSlaves( $this->getArg( 0, 10 ) );
+               wfWaitForSlaves();
        }
 }
 
index a62cc9d..80cc7d9 100644 (file)
@@ -52,6 +52,8 @@ function isCompatible( ua ) {
                ua.match( /Opera Mini/ ) ||
                // Nokia's Ovi Browser
                ua.match( /S40OviBrowser/ ) ||
+               // MeeGo's browser
+               ua.match( /MeeGo/ ) ||
                // Google Glass browser groks JS but UI is too limited
                ( ua.match( /Glass/ ) && ua.match( /Android/ ) )
        );
index 6011961..5ea7a81 100644 (file)
@@ -86,7 +86,9 @@
                        'Mozilla/5.0 (Series40; NokiaX3-02/05.60; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/3.2.0.0.6',
                        'Mozilla/5.0 (Series40; Nokia305/05.92; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/3.7.0.0.11',
                        // Google Glass
-                       'Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Glass 1 Build/IMM76L; XE11) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'
+                       'Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Glass 1 Build/IMM76L; XE11) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
+                       // MeeGo
+                       'Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13'
                ],
                // No explicit support for or against these browsers, they're given a shot at Grade A.
                gradeX: [