Merge "Remove Title::escapeFragmentForURL, deprecated in 1.30, unused"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 9 Feb 2019 00:44:57 +0000 (00:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 9 Feb 2019 00:44:57 +0000 (00:44 +0000)
39 files changed:
.phpcs.xml
RELEASE-NOTES-1.33
autoload.php
includes/deferred/LinksUpdate.php
includes/http/HttpRequestFactory.php
includes/http/MWHttpRequest.php
includes/resourceloader/ResourceLoaderJqueryMsgModule.php [deleted file]
includes/resourceloader/ResourceLoaderLanguageNamesModule.php [deleted file]
includes/resourceloader/ResourceLoaderMediaWikiUtilModule.php [deleted file]
includes/resourceloader/ResourceLoaderSpecialCharacterDataModule.php [deleted file]
includes/resourceloader/ResourceLoaderUploadDialogModule.php [deleted file]
includes/specials/SpecialUploadStash.php
includes/specials/exception/SpecialUploadStashTooLargeException.php [new file with mode: 0644]
includes/templates/NoLocalSettings.mustache
includes/upload/UploadFromChunks.php
includes/upload/UploadStash.php
includes/upload/exception/UploadChunkFileException.php [new file with mode: 0644]
includes/upload/exception/UploadChunkVerificationException.php [new file with mode: 0644]
includes/upload/exception/UploadChunkZeroLengthFileException.php [new file with mode: 0644]
includes/upload/exception/UploadStashBadPathException.php [new file with mode: 0644]
includes/upload/exception/UploadStashException.php [new file with mode: 0644]
includes/upload/exception/UploadStashFileException.php [new file with mode: 0644]
includes/upload/exception/UploadStashFileNotFoundException.php [new file with mode: 0644]
includes/upload/exception/UploadStashNoSuchKeyException.php [new file with mode: 0644]
includes/upload/exception/UploadStashNotLoggedInException.php [new file with mode: 0644]
includes/upload/exception/UploadStashWrongOwnerException.php [new file with mode: 0644]
includes/upload/exception/UploadStashZeroLengthFileException.php [new file with mode: 0644]
includes/user/User.php
resources/Resources.php
resources/src/mediawiki.ForeignStructuredUpload.js
resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js
resources/src/mediawiki.language/mediawiki.language.names.js [new file with mode: 0644]
resources/src/mediawiki.language/mediawiki.language.specialCharacters.js [new file with mode: 0644]
resources/src/mediawiki.less/mediawiki.ui/variables.less
resources/src/mediawiki.ui/components/buttons.less
resources/src/mediawiki.util.js
tests/phpunit/includes/deferred/LinksUpdateTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js

index a525122..99afa3b 100644 (file)
                <exclude-pattern>*/includes/specials/forms/PreferencesFormLegacy\.php</exclude-pattern>
                <exclude-pattern>*/includes/specials/SpecialListusers\.php</exclude-pattern>
                <exclude-pattern>*/includes/specials/SpecialMyRedirectPages\.php</exclude-pattern>
-               <exclude-pattern>*/includes/specials/SpecialUploadStash\.php</exclude-pattern>
                <exclude-pattern>*/includes/StubObject\.php</exclude-pattern>
-               <exclude-pattern>*/includes/upload/UploadFromChunks\.php</exclude-pattern>
                <exclude-pattern>*/includes/upload/UploadStash\.php</exclude-pattern>
                <exclude-pattern>*/includes/utils/AutoloadGenerator\.php</exclude-pattern>
                <exclude-pattern>*/includes/WebResponse\.php</exclude-pattern>
index 51734cf..3155125 100644 (file)
@@ -48,6 +48,8 @@ production.
   Content::getNativeData() for text-based content models.
 * (T210814) SVGs are now by default displayed in wiki language on image
   pages.
+* (T214706) LinksUpdate::getAddedExternalLinks() and
+  LinksUpdate::getRemovedExternalLinks() were introduced.
 
 === External library changes in 1.33 ===
 
index 3b04dfc..37d113b 100644 (file)
@@ -1239,11 +1239,8 @@ $wgAutoloadLocalClasses = [
        'ResourceLoaderForeignApiModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderForeignApiModule.php',
        'ResourceLoaderImage' => __DIR__ . '/includes/resourceloader/ResourceLoaderImage.php',
        'ResourceLoaderImageModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderImageModule.php',
-       'ResourceLoaderJqueryMsgModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderJqueryMsgModule.php',
        'ResourceLoaderLanguageDataModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderLanguageDataModule.php',
-       'ResourceLoaderLanguageNamesModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderLanguageNamesModule.php',
        'ResourceLoaderLessVarFileModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderLessVarFileModule.php',
-       'ResourceLoaderMediaWikiUtilModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderMediaWikiUtilModule.php',
        'ResourceLoaderModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderModule.php',
        'ResourceLoaderOOUIFileModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderOOUIFileModule.php',
        'ResourceLoaderOOUIImageModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderOOUIImageModule.php',
@@ -1251,9 +1248,7 @@ $wgAutoloadLocalClasses = [
        'ResourceLoaderSiteModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderSiteModule.php',
        'ResourceLoaderSiteStylesModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderSiteStylesModule.php',
        'ResourceLoaderSkinModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderSkinModule.php',
-       'ResourceLoaderSpecialCharacterDataModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderSpecialCharacterDataModule.php',
        'ResourceLoaderStartUpModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderStartUpModule.php',
-       'ResourceLoaderUploadDialogModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderUploadDialogModule.php',
        'ResourceLoaderUserDefaultsModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderUserDefaultsModule.php',
        'ResourceLoaderUserModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderUserModule.php',
        'ResourceLoaderUserOptionsModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderUserOptionsModule.php',
@@ -1434,7 +1429,7 @@ $wgAutoloadLocalClasses = [
        'SpecialUnlockdb' => __DIR__ . '/includes/specials/SpecialUnlockdb.php',
        'SpecialUpload' => __DIR__ . '/includes/specials/SpecialUpload.php',
        'SpecialUploadStash' => __DIR__ . '/includes/specials/SpecialUploadStash.php',
-       'SpecialUploadStashTooLargeException' => __DIR__ . '/includes/specials/SpecialUploadStash.php',
+       'SpecialUploadStashTooLargeException' => __DIR__ . '/includes/specials/exception/SpecialUploadStashTooLargeException.php',
        'SpecialUserLogin' => __DIR__ . '/includes/specials/SpecialUserLogin.php',
        'SpecialUserLogout' => __DIR__ . '/includes/specials/SpecialUserLogout.php',
        'SpecialVersion' => __DIR__ . '/includes/specials/SpecialVersion.php',
@@ -1534,9 +1529,9 @@ $wgAutoloadLocalClasses = [
        'UpdateSearchIndex' => __DIR__ . '/maintenance/updateSearchIndex.php',
        'UpdateSpecialPages' => __DIR__ . '/maintenance/updateSpecialPages.php',
        'UploadBase' => __DIR__ . '/includes/upload/UploadBase.php',
-       'UploadChunkFileException' => __DIR__ . '/includes/upload/UploadFromChunks.php',
-       'UploadChunkVerificationException' => __DIR__ . '/includes/upload/UploadFromChunks.php',
-       'UploadChunkZeroLengthFileException' => __DIR__ . '/includes/upload/UploadFromChunks.php',
+       'UploadChunkFileException' => __DIR__ . '/includes/upload/exception/UploadChunkFileException.php',
+       'UploadChunkVerificationException' => __DIR__ . '/includes/upload/exception/UploadChunkVerificationException.php',
+       'UploadChunkZeroLengthFileException' => __DIR__ . '/includes/upload/exception/UploadChunkZeroLengthFileException.php',
        'UploadForm' => __DIR__ . '/includes/specials/forms/UploadForm.php',
        'UploadFromChunks' => __DIR__ . '/includes/upload/UploadFromChunks.php',
        'UploadFromFile' => __DIR__ . '/includes/upload/UploadFromFile.php',
@@ -1547,15 +1542,15 @@ $wgAutoloadLocalClasses = [
        'UploadSourceAdapter' => __DIR__ . '/includes/import/UploadSourceAdapter.php',
        'UploadSourceField' => __DIR__ . '/includes/specials/formfields/UploadSourceField.php',
        'UploadStash' => __DIR__ . '/includes/upload/UploadStash.php',
-       'UploadStashBadPathException' => __DIR__ . '/includes/upload/UploadStash.php',
-       'UploadStashException' => __DIR__ . '/includes/upload/UploadStash.php',
+       'UploadStashBadPathException' => __DIR__ . '/includes/upload/exception/UploadStashBadPathException.php',
+       'UploadStashException' => __DIR__ . '/includes/upload/exception/UploadStashException.php',
        'UploadStashFile' => __DIR__ . '/includes/upload/UploadStash.php',
-       'UploadStashFileException' => __DIR__ . '/includes/upload/UploadStash.php',
-       'UploadStashFileNotFoundException' => __DIR__ . '/includes/upload/UploadStash.php',
-       'UploadStashNoSuchKeyException' => __DIR__ . '/includes/upload/UploadStash.php',
-       'UploadStashNotLoggedInException' => __DIR__ . '/includes/upload/UploadStash.php',
-       'UploadStashWrongOwnerException' => __DIR__ . '/includes/upload/UploadStash.php',
-       'UploadStashZeroLengthFileException' => __DIR__ . '/includes/upload/UploadStash.php',
+       'UploadStashFileException' => __DIR__ . '/includes/upload/exception/UploadStashFileException.php',
+       'UploadStashFileNotFoundException' => __DIR__ . '/includes/upload/exception/UploadStashFileNotFoundException.php',
+       'UploadStashNoSuchKeyException' => __DIR__ . '/includes/upload/exception/UploadStashNoSuchKeyException.php',
+       'UploadStashNotLoggedInException' => __DIR__ . '/includes/upload/exception/UploadStashNotLoggedInException.php',
+       'UploadStashWrongOwnerException' => __DIR__ . '/includes/upload/exception/UploadStashWrongOwnerException.php',
+       'UploadStashZeroLengthFileException' => __DIR__ . '/includes/upload/exception/UploadStashZeroLengthFileException.php',
        'UppercaseCollation' => __DIR__ . '/includes/collation/UppercaseCollation.php',
        'User' => __DIR__ . '/includes/user/User.php',
        'UserArray' => __DIR__ . '/includes/user/UserArray.php',
index 937196d..7c7cabd 100644 (file)
@@ -84,6 +84,16 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
         */
        private $linkDeletions = null;
 
+       /**
+        * @var null|array Added external links if calculated.
+        */
+       private $externalLinkInsertions = null;
+
+       /**
+        * @var null|array Deleted external links if calculated.
+        */
+       private $externalLinkDeletions = null;
+
        /**
         * @var null|array Added properties if calculated.
         */
@@ -234,11 +244,14 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
 
                # External links
                $existingEL = $this->getExistingExternals();
+               $this->externalLinkDeletions = $this->getExternalDeletions( $existingEL );
+               $this->externalLinkInsertions = $this->getExternalInsertions(
+                       $existingEL );
                $this->incrTableUpdate(
                        'externallinks',
                        'el',
-                       $this->getExternalDeletions( $existingEL ),
-                       $this->getExternalInsertions( $existingEL ) );
+                       $this->externalLinkDeletions,
+                       $this->externalLinkInsertions );
 
                # Language links
                $existingLL = $this->getExistingInterlangs();
@@ -1099,6 +1112,36 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
                return $result;
        }
 
+       /**
+        * Fetch external links added by this LinksUpdate. Only available after
+        * the update is complete.
+        * @since 1.33
+        * @return null|array Array of Strings
+        */
+       public function getAddedExternalLinks() {
+               if ( $this->externalLinkInsertions === null ) {
+                       return null;
+               }
+               $result = [];
+               foreach ( $this->externalLinkInsertions as $key => $value ) {
+                       $result[] = $value['el_to'];
+               }
+               return $result;
+       }
+
+       /**
+        * Fetch external links removed by this LinksUpdate. Only available after
+        * the update is complete.
+        * @since 1.33
+        * @return null|array Array of Strings
+        */
+       public function getRemovedExternalLinks() {
+               if ( $this->externalLinkDeletions === null ) {
+                       return null;
+               }
+               return array_keys( $this->externalLinkDeletions );
+       }
+
        /**
         * Fetch page properties added by this LinksUpdate.
         * Only available after the update is complete.
index 0faef17..a3a14d0 100644 (file)
@@ -44,7 +44,7 @@ class HttpRequestFactory {
         */
        public function create( $url, array $options = [], $caller = __METHOD__ ) {
                if ( !Http::$httpEngine ) {
-                       Http::$httpEngine = function_exists( 'curl_init' ) ? 'curl' : 'php';
+                       Http::$httpEngine = 'guzzle';
                } elseif ( Http::$httpEngine == 'curl' && !function_exists( 'curl_init' ) ) {
                        throw new DomainException( __METHOD__ . ': curl (https://secure.php.net/curl) is not ' .
                           'installed, but Http::$httpEngine is set to "curl"' );
index 065667d..b4ac9a7 100644 (file)
@@ -129,6 +129,8 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
                        $this->setOriginalRequest( $options['originalRequest'] );
                }
 
+               $this->setHeader( 'X-Request-Id', WebRequest::getRequestId() );
+
                $members = [ "postData", "proxy", "noProxy", "sslVerifyHost", "caInfo",
                                "method", "followRedirects", "maxRedirects", "sslVerifyCert", "callback" ];
 
diff --git a/includes/resourceloader/ResourceLoaderJqueryMsgModule.php b/includes/resourceloader/ResourceLoaderJqueryMsgModule.php
deleted file mode 100644 (file)
index 8f4aa3b..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-/**
- * ResourceLoader module for mediawiki.jqueryMsg that provides generated data.
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * ResourceLoader module for mediawiki.jqueryMsg and its generated data
- */
-class ResourceLoaderJqueryMsgModule extends ResourceLoaderFileModule {
-
-       /**
-        * @param ResourceLoaderContext $context
-        * @return string JavaScript code
-        */
-       public function getScript( ResourceLoaderContext $context ) {
-               $fileScript = parent::getScript( $context );
-
-               $tagData = Sanitizer::getRecognizedTagData();
-               $allowedHtmlElements = array_merge(
-                       array_keys( $tagData['htmlpairs'] ),
-                       array_diff(
-                               array_keys( $tagData['htmlsingle'] ),
-                               array_keys( $tagData['htmlsingleonly'] )
-                       )
-               );
-
-               $magicWords = [
-                       'SITENAME' => $this->getConfig()->get( 'Sitename' ),
-               ];
-               Hooks::run( 'ResourceLoaderJqueryMsgModuleMagicWords', [ $context, &$magicWords ] );
-
-               $parserDefaults = [
-                       'allowedHtmlElements' => $allowedHtmlElements,
-                       'magic' => $magicWords,
-               ];
-
-               $setDataScript = Xml::encodeJsCall( 'mw.jqueryMsg.setParserDefaults', [
-                       $parserDefaults,
-                       // Pass deep=true because mediawiki.jqueryMsg.js contains
-                       // page-specific magic words that must not be overwritten.
-                       true,
-               ] );
-
-               return $fileScript . $setDataScript;
-       }
-
-       /**
-        * @param ResourceLoaderContext $context
-        * @return array
-        */
-       public function getScriptURLsForDebug( ResourceLoaderContext $context ) {
-               // Bypass file module urls
-               return ResourceLoaderModule::getScriptURLsForDebug( $context );
-       }
-
-       /**
-        * @return bool
-        */
-       public function enableModuleContentVersion() {
-               return true;
-       }
-}
diff --git a/includes/resourceloader/ResourceLoaderLanguageNamesModule.php b/includes/resourceloader/ResourceLoaderLanguageNamesModule.php
deleted file mode 100644 (file)
index eb09664..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * ResourceLoader module for providing language names.
- *
- * By default these names will be autonyms however other extensions may
- * provided language names in the context language (e.g. cldr extension)
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @author Ed Sanders
- * @author Trevor Parscal
- */
-
-/**
- * ResourceLoader module for populating language specific data.
- */
-class ResourceLoaderLanguageNamesModule extends ResourceLoaderFileModule {
-
-       protected $targets = [ 'desktop', 'mobile' ];
-
-       /**
-        * @param ResourceLoaderContext $context
-        * @return array
-        */
-       protected function getData( ResourceLoaderContext $context ) {
-               return Language::fetchLanguageNames(
-                       $context->getLanguage(),
-                       'all'
-               );
-       }
-
-       /**
-        * @param ResourceLoaderContext $context
-        * @return string JavaScript code
-        */
-       public function getScript( ResourceLoaderContext $context ) {
-               return Xml::encodeJsCall(
-                       'mw.language.setData',
-                       [
-                               $context->getLanguage(),
-                               'languageNames',
-                               $this->getData( $context )
-                       ],
-                       ResourceLoader::inDebugMode()
-               );
-       }
-
-       /**
-        * @param ResourceLoaderContext|null $context
-        * @return array
-        */
-       public function getDependencies( ResourceLoaderContext $context = null ) {
-               return [ 'mediawiki.language' ];
-       }
-
-       /**
-        * @return bool
-        */
-       public function enableModuleContentVersion() {
-               return true;
-       }
-
-}
diff --git a/includes/resourceloader/ResourceLoaderMediaWikiUtilModule.php b/includes/resourceloader/ResourceLoaderMediaWikiUtilModule.php
deleted file mode 100644 (file)
index d16a4ff..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * ResourceLoader mediawiki.util module
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * ResourceLoader module for mediawiki.util
- *
- * @since 1.30
- */
-class ResourceLoaderMediaWikiUtilModule extends ResourceLoaderFileModule {
-       /**
-        * @inheritDoc
-        */
-       public function getScript( ResourceLoaderContext $context ) {
-               return ResourceLoader::makeConfigSetScript(
-                               [ 'wgFragmentMode' => $this->getConfig()->get( 'FragmentMode' ) ]
-                       )
-                       . "\n"
-                       . parent::getScript( $context );
-       }
-
-       /**
-        * @inheritDoc
-        */
-       public function supportsURLLoading() {
-               return false;
-       }
-
-       /**
-        * @inheritDoc
-        */
-       public function enableModuleContentVersion() {
-               return true;
-       }
-}
diff --git a/includes/resourceloader/ResourceLoaderSpecialCharacterDataModule.php b/includes/resourceloader/ResourceLoaderSpecialCharacterDataModule.php
deleted file mode 100644 (file)
index 0ad7fe4..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/**
- * ResourceLoader module for populating special characters data for some
- * editing extensions to use.
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * ResourceLoader module for populating special characters data for some
- * editing extensions to use.
- */
-class ResourceLoaderSpecialCharacterDataModule extends ResourceLoaderModule {
-       private $path = "resources/src/mediawiki.language/specialcharacters.json";
-       protected $targets = [ 'desktop', 'mobile' ];
-
-       /**
-        * Get all the dynamic data.
-        *
-        * @return array
-        */
-       protected function getData() {
-               global $IP;
-               return json_decode( file_get_contents( "$IP/{$this->path}" ) );
-       }
-
-       /**
-        * @param ResourceLoaderContext $context
-        * @return string JavaScript code
-        */
-       public function getScript( ResourceLoaderContext $context ) {
-               return Xml::encodeJsCall(
-                       'mw.language.setSpecialCharacters',
-                       [
-                               $this->getData()
-                       ],
-                       ResourceLoader::inDebugMode()
-               );
-       }
-
-       /**
-        * @return bool
-        */
-       public function enableModuleContentVersion() {
-               return true;
-       }
-
-       /**
-        * @param ResourceLoaderContext|null $context
-        * @return array
-        */
-       public function getDependencies( ResourceLoaderContext $context = null ) {
-               return [ 'mediawiki.language' ];
-       }
-
-       /**
-        * @return array
-        */
-       public function getMessages() {
-               return [
-                       'special-characters-group-latin',
-                       'special-characters-group-latinextended',
-                       'special-characters-group-ipa',
-                       'special-characters-group-symbols',
-                       'special-characters-group-greek',
-                       'special-characters-group-greekextended',
-                       'special-characters-group-cyrillic',
-                       'special-characters-group-arabic',
-                       'special-characters-group-arabicextended',
-                       'special-characters-group-persian',
-                       'special-characters-group-hebrew',
-                       'special-characters-group-bangla',
-                       'special-characters-group-tamil',
-                       'special-characters-group-telugu',
-                       'special-characters-group-sinhala',
-                       'special-characters-group-devanagari',
-                       'special-characters-group-gujarati',
-                       'special-characters-group-thai',
-                       'special-characters-group-lao',
-                       'special-characters-group-khmer',
-                       'special-characters-group-canadianaboriginal',
-                       'special-characters-title-endash',
-                       'special-characters-title-emdash',
-                       'special-characters-title-minus'
-               ];
-       }
-}
diff --git a/includes/resourceloader/ResourceLoaderUploadDialogModule.php b/includes/resourceloader/ResourceLoaderUploadDialogModule.php
deleted file mode 100644 (file)
index 1a390cf..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * ResourceLoader module for the upload dialog configuration data.
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * ResourceLoader module for the upload dialog configuration data.
- *
- * @since 1.27
- */
-class ResourceLoaderUploadDialogModule extends ResourceLoaderModule {
-
-       protected $targets = [ 'desktop', 'mobile' ];
-
-       /**
-        * @param ResourceLoaderContext $context
-        * @return string JavaScript code
-        */
-       public function getScript( ResourceLoaderContext $context ) {
-               $config = $context->getResourceLoader()->getConfig();
-               return ResourceLoader::makeConfigSetScript( [
-                       'wgUploadDialog' => $config->get( 'UploadDialog' ),
-               ] );
-       }
-
-       /**
-        * @return bool
-        */
-       public function enableModuleContentVersion() {
-               return true;
-       }
-}
index a00b031..2da9a41 100644 (file)
@@ -447,10 +447,3 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                return true;
        }
 }
-
-/**
- * @ingroup SpecialPage
- * @ingroup Upload
- */
-class SpecialUploadStashTooLargeException extends UploadStashException {
-}
diff --git a/includes/specials/exception/SpecialUploadStashTooLargeException.php b/includes/specials/exception/SpecialUploadStashTooLargeException.php
new file mode 100644 (file)
index 0000000..6c2e730
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Implements SpecialUploadStashTooLargeException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup SpecialPage
+ * @ingroup Upload
+ */
+class SpecialUploadStashTooLargeException extends UploadStashException {
+}
index 36391f5..118f439 100644 (file)
@@ -4,7 +4,7 @@
                <meta charset="UTF-8" />
                <title>MediaWiki {{wgVersion}}</title>
                <style media="screen">
-                       html, body {
+                       body {
                                color: #000;
                                background-color: #fff;
                                font-family: sans-serif;
index 58541b2..3e88fcd 100644 (file)
@@ -409,18 +409,3 @@ class UploadFromChunks extends UploadFromFile {
                }
        }
 }
-
-class UploadChunkZeroLengthFileException extends MWException {
-}
-
-class UploadChunkFileException extends MWException {
-}
-
-class UploadChunkVerificationException extends MWException {
-       public $msg;
-       public function __construct( array $res ) {
-               $this->msg = wfMessage( ...$res );
-               parent::__construct( wfMessage( ...$res )
-                       ->inLanguage( 'en' )->useDatabase( false )->text() );
-       }
-}
index babbe3a..aa31a5b 100644 (file)
@@ -766,72 +766,3 @@ class UploadStashFile extends UnregisteredLocalFile {
                return $this->repo->fileExists( $this->path );
        }
 }
-
-/**
- * @ingroup Upload
- */
-class UploadStashException extends MWException implements ILocalizedException {
-       /** @var string|array|MessageSpecifier */
-       protected $messageSpec;
-
-       /**
-        * @param string|array|MessageSpecifier $messageSpec See Message::newFromSpecifier
-        * @param int $code Exception code
-        * @param Exception|Throwable|null $previous The previous exception used for the exception
-        *  chaining.
-        */
-       public function __construct( $messageSpec, $code = 0, $previous = null ) {
-               $this->messageSpec = $messageSpec;
-
-               $msg = $this->getMessageObject()->text();
-               $msg = preg_replace( '!</?(var|kbd|samp|code)>!', '"', $msg );
-               $msg = Sanitizer::stripAllTags( $msg );
-               parent::__construct( $msg, $code, $previous );
-       }
-
-       public function getMessageObject() {
-               return Message::newFromSpecifier( $this->messageSpec );
-       }
-}
-
-/**
- * @ingroup Upload
- */
-class UploadStashFileNotFoundException extends UploadStashException {
-}
-
-/**
- * @ingroup Upload
- */
-class UploadStashBadPathException extends UploadStashException {
-}
-
-/**
- * @ingroup Upload
- */
-class UploadStashFileException extends UploadStashException {
-}
-
-/**
- * @ingroup Upload
- */
-class UploadStashZeroLengthFileException extends UploadStashException {
-}
-
-/**
- * @ingroup Upload
- */
-class UploadStashNotLoggedInException extends UploadStashException {
-}
-
-/**
- * @ingroup Upload
- */
-class UploadStashWrongOwnerException extends UploadStashException {
-}
-
-/**
- * @ingroup Upload
- */
-class UploadStashNoSuchKeyException extends UploadStashException {
-}
diff --git a/includes/upload/exception/UploadChunkFileException.php b/includes/upload/exception/UploadChunkFileException.php
new file mode 100644 (file)
index 0000000..066b38c
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Implements UploadChunkFileException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Upload
+ */
+
+class UploadChunkFileException extends MWException {
+}
diff --git a/includes/upload/exception/UploadChunkVerificationException.php b/includes/upload/exception/UploadChunkVerificationException.php
new file mode 100644 (file)
index 0000000..cee8c03
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Implements UploadChunkVerificationException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Upload
+ */
+
+class UploadChunkVerificationException extends MWException {
+       public $msg;
+       public function __construct( array $res ) {
+               $this->msg = wfMessage( ...$res );
+               parent::__construct( wfMessage( ...$res )
+                       ->inLanguage( 'en' )->useDatabase( false )->text() );
+       }
+}
diff --git a/includes/upload/exception/UploadChunkZeroLengthFileException.php b/includes/upload/exception/UploadChunkZeroLengthFileException.php
new file mode 100644 (file)
index 0000000..9b937b2
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Implements UploadChunkZeroLengthFileException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Upload
+ */
+
+class UploadChunkZeroLengthFileException extends MWException {
+}
diff --git a/includes/upload/exception/UploadStashBadPathException.php b/includes/upload/exception/UploadStashBadPathException.php
new file mode 100644 (file)
index 0000000..470a45a
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Implements UploadStashBadPathException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup Upload
+ */
+class UploadStashBadPathException extends UploadStashException {
+}
diff --git a/includes/upload/exception/UploadStashException.php b/includes/upload/exception/UploadStashException.php
new file mode 100644 (file)
index 0000000..f089643
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Implements UploadStashException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup Upload
+ */
+class UploadStashException extends MWException implements ILocalizedException {
+       /** @var string|array|MessageSpecifier */
+       protected $messageSpec;
+
+       /**
+        * @param string|array|MessageSpecifier $messageSpec See Message::newFromSpecifier
+        * @param int $code Exception code
+        * @param Exception|Throwable|null $previous The previous exception used for the exception
+        *  chaining.
+        */
+       public function __construct( $messageSpec, $code = 0, $previous = null ) {
+               $this->messageSpec = $messageSpec;
+
+               $msg = $this->getMessageObject()->text();
+               $msg = preg_replace( '!</?(var|kbd|samp|code)>!', '"', $msg );
+               $msg = Sanitizer::stripAllTags( $msg );
+               parent::__construct( $msg, $code, $previous );
+       }
+
+       public function getMessageObject() {
+               return Message::newFromSpecifier( $this->messageSpec );
+       }
+}
diff --git a/includes/upload/exception/UploadStashFileException.php b/includes/upload/exception/UploadStashFileException.php
new file mode 100644 (file)
index 0000000..0c6e9dd
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Implements UploadStashFileException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup Upload
+ */
+class UploadStashFileException extends UploadStashException {
+}
diff --git a/includes/upload/exception/UploadStashFileNotFoundException.php b/includes/upload/exception/UploadStashFileNotFoundException.php
new file mode 100644 (file)
index 0000000..a9df7e4
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Implements UploadStashFileNotFoundException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup Upload
+ */
+class UploadStashFileNotFoundException extends UploadStashException {
+}
diff --git a/includes/upload/exception/UploadStashNoSuchKeyException.php b/includes/upload/exception/UploadStashNoSuchKeyException.php
new file mode 100644 (file)
index 0000000..43c63e8
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Implements UploadStashNoSuchKeyException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup Upload
+ */
+class UploadStashNoSuchKeyException extends UploadStashException {
+}
diff --git a/includes/upload/exception/UploadStashNotLoggedInException.php b/includes/upload/exception/UploadStashNotLoggedInException.php
new file mode 100644 (file)
index 0000000..18a2e17
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Implements UploadStashNotLoggedInException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup Upload
+ */
+class UploadStashNotLoggedInException extends UploadStashException {
+}
diff --git a/includes/upload/exception/UploadStashWrongOwnerException.php b/includes/upload/exception/UploadStashWrongOwnerException.php
new file mode 100644 (file)
index 0000000..aaa836c
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Implements UploadStashWrongOwnerException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup Upload
+ */
+class UploadStashWrongOwnerException extends UploadStashException {
+}
diff --git a/includes/upload/exception/UploadStashZeroLengthFileException.php b/includes/upload/exception/UploadStashZeroLengthFileException.php
new file mode 100644 (file)
index 0000000..a054d90
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Implements UploadStashZeroLengthFileException
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup Upload
+ */
+class UploadStashZeroLengthFileException extends UploadStashException {
+}
index b7b5b87..f5eee34 100644 (file)
@@ -588,14 +588,15 @@ class User implements IDBAccessObject, UserIdentity {
                $name = self::getCanonicalName( $name, $validate );
                if ( $name === false ) {
                        return false;
-               } else {
-                       // Create unloaded user object
-                       $u = new User;
-                       $u->mName = $name;
-                       $u->mFrom = 'name';
-                       $u->setItemLoaded( 'name' );
-                       return $u;
                }
+
+               // Create unloaded user object
+               $u = new User;
+               $u->mName = $name;
+               $u->mFrom = 'name';
+               $u->setItemLoaded( 'name' );
+
+               return $u;
        }
 
        /**
@@ -1125,12 +1126,12 @@ class User implements IDBAccessObject, UserIdentity {
                }
 
                // Preg yells if you try to give it an empty string
-               if ( $wgInvalidUsernameCharacters !== '' ) {
-                       if ( preg_match( '/[' . preg_quote( $wgInvalidUsernameCharacters, '/' ) . ']/', $name ) ) {
-                               wfDebugLog( 'username', __METHOD__ .
-                                       ": '$name' invalid due to wgInvalidUsernameCharacters" );
-                               return false;
-                       }
+               if ( $wgInvalidUsernameCharacters !== '' &&
+                       preg_match( '/[' . preg_quote( $wgInvalidUsernameCharacters, '/' ) . ']/', $name )
+               ) {
+                       wfDebugLog( 'username', __METHOD__ .
+                               ": '$name' invalid due to wgInvalidUsernameCharacters" );
+                       return false;
                }
 
                return self::isUsableName( $name );
@@ -1160,19 +1161,20 @@ class User implements IDBAccessObject, UserIdentity {
                $result = $this->checkPasswordValidity( $password );
                if ( $result->isGood() ) {
                        return true;
-               } else {
-                       $messages = [];
-                       foreach ( $result->getErrorsByType( 'error' ) as $error ) {
-                               $messages[] = $error['message'];
-                       }
-                       foreach ( $result->getErrorsByType( 'warning' ) as $warning ) {
-                               $messages[] = $warning['message'];
-                       }
-                       if ( count( $messages ) === 1 ) {
-                               return $messages[0];
-                       }
-                       return $messages;
                }
+
+               $messages = [];
+               foreach ( $result->getErrorsByType( 'error' ) as $error ) {
+                       $messages[] = $error['message'];
+               }
+               foreach ( $result->getErrorsByType( 'warning' ) as $warning ) {
+                       $messages[] = $warning['message'];
+               }
+               if ( count( $messages ) === 1 ) {
+                       return $messages[0];
+               }
+
+               return $messages;
        }
 
        /**
@@ -1213,12 +1215,14 @@ class User implements IDBAccessObject, UserIdentity {
                if ( $result === false ) {
                        $status->merge( $upp->checkUserPassword( $this, $password ), true );
                        return $status;
-               } elseif ( $result === true ) {
+               }
+
+               if ( $result === true ) {
                        return $status;
-               } else {
-                       $status->error( $result );
-                       return $status; // the isValidPassword hook set a string $result and returned true
                }
+
+               $status->error( $result );
+               return $status; // the isValidPassword hook set a string $result and returned true
        }
 
        /**
@@ -1464,12 +1468,13 @@ class User implements IDBAccessObject, UserIdentity {
                        $this->mGroupMemberships = null; // deferred
                        $this->getEditCount(); // revalidation for nulls
                        return true;
-               } else {
-                       // Invalid user_id
-                       $this->mId = 0;
-                       $this->loadDefaults();
-                       return false;
                }
+
+               // Invalid user_id
+               $this->mId = 0;
+               $this->loadDefaults();
+
+               return false;
        }
 
        /**
@@ -1974,10 +1979,10 @@ class User implements IDBAccessObject, UserIdentity {
                                if ( $blockIsValid && $useBlockCookie ) {
                                        // Use the block.
                                        return $tmpBlock;
-                               } else {
-                                       // If the block is not valid, remove the cookie.
-                                       Block::clearCookie( $this->getRequest()->response() );
                                }
+
+                               // If the block is not valid, remove the cookie.
+                               Block::clearCookie( $this->getRequest()->response() );
                        } else {
                                // If the block doesn't exist, remove the cookie.
                                Block::clearCookie( $this->getRequest()->response() );
@@ -1996,11 +2001,9 @@ class User implements IDBAccessObject, UserIdentity {
        public function isDnsBlacklisted( $ip, $checkWhitelist = false ) {
                global $wgEnableDnsBlacklist, $wgDnsBlacklistUrls, $wgProxyWhitelist;
 
-               if ( !$wgEnableDnsBlacklist ) {
-                       return false;
-               }
-
-               if ( $checkWhitelist && in_array( $ip, $wgProxyWhitelist ) ) {
+               if ( !$wgEnableDnsBlacklist ||
+                       ( $checkWhitelist && in_array( $ip, $wgProxyWhitelist ) )
+               ) {
                        return false;
                }
 
@@ -2044,9 +2047,9 @@ class User implements IDBAccessObject, UserIdentity {
                                        wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $basename!" );
                                        $found = true;
                                        break;
-                               } else {
-                                       wfDebugLog( 'dnsblacklist', "Requested $host, not found in $basename." );
                                }
+
+                               wfDebugLog( 'dnsblacklist', "Requested $host, not found in $basename." );
                        }
                }
 
@@ -2166,11 +2169,9 @@ class User implements IDBAccessObject, UserIdentity {
                        if ( isset( $limits['anon'] ) ) {
                                $keys[$cache->makeKey( 'limiter', $action, 'anon' )] = $limits['anon'];
                        }
-               } else {
+               } elseif ( isset( $limits['user'] ) ) {
                        // limits for logged-in users
-                       if ( isset( $limits['user'] ) ) {
-                               $userLimit = $limits['user'];
-                       }
+                       $userLimit = $limits['user'];
                }
 
                // limits for anons and for newbie logged-in users
@@ -2460,7 +2461,9 @@ class User implements IDBAccessObject, UserIdentity {
                if ( $this->mId === null && $this->mName !== null && self::isIP( $this->mName ) ) {
                        // Special case, we know the user is anonymous
                        return 0;
-               } elseif ( !$this->isItemLoaded( 'id' ) ) {
+               }
+
+               if ( !$this->isItemLoaded( 'id' ) ) {
                        // Don't load if this was initialized from an ID
                        $this->load();
                }
@@ -2485,14 +2488,15 @@ class User implements IDBAccessObject, UserIdentity {
                if ( $this->isItemLoaded( 'name', 'only' ) ) {
                        // Special case optimisation
                        return $this->mName;
-               } else {
-                       $this->load();
-                       if ( $this->mName === false ) {
-                               // Clean up IPs
-                               $this->mName = IP::sanitizeIP( $this->getRequest()->getIP() );
-                       }
-                       return $this->mName;
                }
+
+               $this->load();
+               if ( $this->mName === false ) {
+                       // Clean up IPs
+                       $this->mName = IP::sanitizeIP( $this->getRequest()->getIP() );
+               }
+
+               return $this->mName;
        }
 
        /**
@@ -2638,7 +2642,9 @@ class User implements IDBAccessObject, UserIdentity {
                $talks = [];
                if ( !Hooks::run( 'UserRetrieveNewTalks', [ &$user, &$talks ] ) ) {
                        return $talks;
-               } elseif ( !$this->getNewtalk() ) {
+               }
+
+               if ( !$this->getNewtalk() ) {
                        return [];
                }
                $utp = $this->getTalkPage();
@@ -2666,19 +2672,19 @@ class User implements IDBAccessObject, UserIdentity {
        public function getNewMessageRevisionId() {
                $newMessageRevisionId = null;
                $newMessageLinks = $this->getNewMessageLinks();
-               if ( $newMessageLinks ) {
-                       // Note: getNewMessageLinks() never returns more than a single link
-                       // and it is always for the same wiki, but we double-check here in
-                       // case that changes some time in the future.
-                       if ( count( $newMessageLinks ) === 1
-                               && WikiMap::isCurrentWikiId( $newMessageLinks[0]['wiki'] )
-                               && $newMessageLinks[0]['rev']
-                       ) {
-                               /** @var Revision $newMessageRevision */
-                               $newMessageRevision = $newMessageLinks[0]['rev'];
-                               $newMessageRevisionId = $newMessageRevision->getId();
-                       }
+
+               // Note: getNewMessageLinks() never returns more than a single link
+               // and it is always for the same wiki, but we double-check here in
+               // case that changes some time in the future.
+               if ( $newMessageLinks && count( $newMessageLinks ) === 1
+                       && WikiMap::isCurrentWikiId( $newMessageLinks[0]['wiki'] )
+                       && $newMessageLinks[0]['rev']
+               ) {
+                       /** @var Revision $newMessageRevision */
+                       $newMessageRevision = $newMessageLinks[0]['rev'];
+                       $newMessageRevisionId = $newMessageRevision->getId();
                }
+
                return $newMessageRevisionId;
        }
 
@@ -2718,10 +2724,10 @@ class User implements IDBAccessObject, UserIdentity {
                if ( $dbw->affectedRows() ) {
                        wfDebug( __METHOD__ . ": set on ($field, $id)\n" );
                        return true;
-               } else {
-                       wfDebug( __METHOD__ . " already set ($field, $id)\n" );
-                       return false;
                }
+
+               wfDebug( __METHOD__ . " already set ($field, $id)\n" );
+               return false;
        }
 
        /**
@@ -2738,10 +2744,10 @@ class User implements IDBAccessObject, UserIdentity {
                if ( $dbw->affectedRows() ) {
                        wfDebug( __METHOD__ . ": killed on ($field, $id)\n" );
                        return true;
-               } else {
-                       wfDebug( __METHOD__ . ": already gone ($field, $id)\n" );
-                       return false;
                }
+
+               wfDebug( __METHOD__ . ": already gone ($field, $id)\n" );
+               return false;
        }
 
        /**
@@ -3022,25 +3028,30 @@ class User implements IDBAccessObject, UserIdentity {
                if ( !$this->mToken ) {
                        // The user doesn't have a token, return null to indicate that.
                        return null;
-               } elseif ( $this->mToken === self::INVALID_TOKEN ) {
+               }
+
+               if ( $this->mToken === self::INVALID_TOKEN ) {
                        // We return a random value here so existing token checks are very
                        // likely to fail.
                        return MWCryptRand::generateHex( self::TOKEN_LENGTH );
-               } elseif ( $wgAuthenticationTokenVersion === null ) {
+               }
+
+               if ( $wgAuthenticationTokenVersion === null ) {
                        // $wgAuthenticationTokenVersion not in use, so return the raw secret
                        return $this->mToken;
-               } else {
-                       // $wgAuthenticationTokenVersion in use, so hmac it.
-                       $ret = MWCryptHash::hmac( $wgAuthenticationTokenVersion, $this->mToken, false );
-
-                       // The raw hash can be overly long. Shorten it up.
-                       $len = max( 32, self::TOKEN_LENGTH );
-                       if ( strlen( $ret ) < $len ) {
-                               // Should never happen, even md5 is 128 bits
-                               throw new \UnexpectedValueException( 'Hmac returned less than 128 bits' );
-                       }
-                       return substr( $ret, -$len );
                }
+
+               // $wgAuthenticationTokenVersion in use, so hmac it.
+               $ret = MWCryptHash::hmac( $wgAuthenticationTokenVersion, $this->mToken, false );
+
+               // The raw hash can be overly long. Shorten it up.
+               $len = max( 32, self::TOKEN_LENGTH );
+               if ( strlen( $ret ) < $len ) {
+                       // Should never happen, even md5 is 128 bits
+                       throw new \UnexpectedValueException( 'Hmac returned less than 128 bits' );
+               }
+
+               return substr( $ret, -$len );
        }
 
        /**
@@ -3129,19 +3140,17 @@ class User implements IDBAccessObject, UserIdentity {
                $type = $oldaddr != '' ? 'changed' : 'set';
                $notificationResult = null;
 
-               if ( $wgEmailAuthentication ) {
+               if ( $wgEmailAuthentication && $type === 'changed' ) {
                        // Send the user an email notifying the user of the change in registered
                        // email address on their previous email address
-                       if ( $type == 'changed' ) {
-                               $change = $str != '' ? 'changed' : 'removed';
-                               $notificationResult = $this->sendMail(
-                                       wfMessage( 'notificationemail_subject_' . $change )->text(),
-                                       wfMessage( 'notificationemail_body_' . $change,
-                                               $this->getRequest()->getIP(),
-                                               $this->getName(),
-                                               $str )->text()
-                               );
-                       }
+                       $change = $str != '' ? 'changed' : 'removed';
+                       $notificationResult = $this->sendMail(
+                               wfMessage( 'notificationemail_subject_' . $change )->text(),
+                               wfMessage( 'notificationemail_body_' . $change,
+                                       $this->getRequest()->getIP(),
+                                       $this->getName(),
+                                       $str )->text()
+                       );
                }
 
                $this->setEmail( $str );
@@ -3211,9 +3220,9 @@ class User implements IDBAccessObject, UserIdentity {
 
                if ( array_key_exists( $oname, $this->mOptions ) ) {
                        return $this->mOptions[$oname];
-               } else {
-                       return $defaultOverride;
                }
+
+               return $defaultOverride;
        }
 
        /**
@@ -3543,14 +3552,15 @@ class User implements IDBAccessObject, UserIdentity {
                global $wgSecureLogin;
                if ( !$wgSecureLogin ) {
                        return false;
-               } else {
-                       $https = $this->getBoolOption( 'prefershttps' );
-                       Hooks::run( 'UserRequiresHTTPS', [ $this, &$https ] );
-                       if ( $https ) {
-                               $https = wfCanIPUseHTTPS( $this->getRequest()->getIP() );
-                       }
-                       return $https;
                }
+
+               $https = $this->getBoolOption( 'prefershttps' );
+               Hooks::run( 'UserRequiresHTTPS', [ $this, &$https ] );
+               if ( $https ) {
+                       $https = wfCanIPUseHTTPS( $this->getRequest()->getIP() );
+               }
+
+               return $https;
        }
 
        /**
@@ -3932,10 +3942,10 @@ class User implements IDBAccessObject, UserIdentity {
        public function getRequest() {
                if ( $this->mRequest ) {
                        return $this->mRequest;
-               } else {
-                       global $wgRequest;
-                       return $wgRequest;
                }
+
+               global $wgRequest;
+               return $wgRequest;
        }
 
        /**
@@ -4107,19 +4117,18 @@ class User implements IDBAccessObject, UserIdentity {
                $learnerRegistration = wfTimestamp( TS_MW, $now - $wgLearnerMemberSince * 86400 );
                $experiencedRegistration = wfTimestamp( TS_MW, $now - $wgExperiencedUserMemberSince * 86400 );
 
-               if (
-                       $editCount < $wgLearnerEdits ||
-                       $registration > $learnerRegistration
-               ) {
+               if ( $editCount < $wgLearnerEdits ||
+               $registration > $learnerRegistration ) {
                        return 'newcomer';
-               } elseif (
-                       $editCount > $wgExperiencedUserEdits &&
+               }
+
+               if ( $editCount > $wgExperiencedUserEdits &&
                        $registration <= $experiencedRegistration
                ) {
                        return 'experienced';
-               } else {
-                       return 'learner';
                }
+
+               return 'learner';
        }
 
        /**
@@ -4936,9 +4945,9 @@ class User implements IDBAccessObject, UserIdentity {
                                return false;
                        }
                        return true;
-               } else {
-                       return $confirmed;
                }
+
+               return $confirmed;
        }
 
        /**
@@ -5214,9 +5223,9 @@ class User implements IDBAccessObject, UserIdentity {
                if ( $title ) {
                        return MediaWikiServices::getInstance()
                                ->getLinkRenderer()->makeLink( $title, $text );
-               } else {
-                       return htmlspecialchars( $text );
                }
+
+               return htmlspecialchars( $text );
        }
 
        /**
@@ -5239,9 +5248,9 @@ class User implements IDBAccessObject, UserIdentity {
                if ( $title ) {
                        $page = $title->getFullText();
                        return "[[$page|$text]]";
-               } else {
-                       return $text;
                }
+
+               return $text;
        }
 
        /**
@@ -5710,9 +5719,9 @@ class User implements IDBAccessObject, UserIdentity {
 
                if ( $groups ) {
                        return Status::newFatal( 'badaccess-groups', $wgLang->commaList( $groups ), count( $groups ) );
-               } else {
-                       return Status::newFatal( 'badaccess-group0' );
                }
+
+               return Status::newFatal( 'badaccess-group0' );
        }
 
        /**
index 95a00f5..a34634f 100644 (file)
@@ -24,6 +24,8 @@ if ( !defined( 'MEDIAWIKI' ) ) {
        die( 'Not an entry point.' );
 }
 
+global $wgResourceBasePath;
+
 return [
 
        /**
@@ -1177,14 +1179,15 @@ return [
                        'upload-foreign-cant-upload',
                ]
        ],
-       'mediawiki.ForeignStructuredUpload.config' => [
-               'class' => ResourceLoaderUploadDialogModule::class,
-       ],
        'mediawiki.ForeignStructuredUpload' => [
-               'scripts' => 'resources/src/mediawiki.ForeignStructuredUpload.js',
+               'localBasePath' => "$IP/resources/src",
+               'remoteBasePath' => "$wgResourceBasePath/resources/src",
+               'packageFiles' => [
+                       'mediawiki.ForeignStructuredUpload.js',
+                       'config.json' => [ 'config' => [ 'UploadDialog' ] ],
+               ],
                'dependencies' => [
                        'mediawiki.ForeignUpload',
-                       'mediawiki.ForeignStructuredUpload.config',
                ],
                'messages' => [
                        'upload-foreign-cant-load-config',
@@ -1327,8 +1330,12 @@ return [
                ]
        ],
        'mediawiki.util' => [
-               'class' => ResourceLoaderMediaWikiUtilModule::class,
-               'scripts' => 'resources/src/mediawiki.util.js',
+               'localBasePath' => "$IP/resources/src",
+               'remoteBasePath' => "$wgResourceBasePath/resources/src",
+               'packageFiles' => [
+                       'mediawiki.util.js',
+                       'config.json' => [ 'config' => [ 'FragmentMode' ] ],
+               ],
                'dependencies' => [
                        'jquery.accessKeyLabel',
                        'mediawiki.RegExp',
@@ -1570,9 +1577,31 @@ return [
        ],
 
        'mediawiki.jqueryMsg' => [
-               // Add data for mediawiki.jqueryMsg, such as allowed tags
-               'class' => ResourceLoaderJqueryMsgModule::class,
-               'scripts' => 'resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js',
+               'localBasePath' => "$IP/resources/src/mediawiki.jqueryMsg",
+               'remoteBasePath' => "$wgResourceBasePath/resources/src/mediawiki.jqueryMsg",
+               'packageFiles' => [
+                       'mediawiki.jqueryMsg.js',
+                       'parserDefaults.json' => [ 'callback' => function ( ResourceLoaderContext $context ) {
+                               $tagData = Sanitizer::getRecognizedTagData();
+                               $allowedHtmlElements = array_merge(
+                                       array_keys( $tagData['htmlpairs'] ),
+                                       array_diff(
+                                               array_keys( $tagData['htmlsingle'] ),
+                                               array_keys( $tagData['htmlsingleonly'] )
+                                       )
+                               );
+
+                               $magicWords = [
+                                       'SITENAME' => $context->getConfig()->get( 'Sitename' ),
+                               ];
+                               Hooks::run( 'ResourceLoaderJqueryMsgModuleMagicWords', [ $context, &$magicWords ] );
+
+                               return [
+                                       'allowedHtmlElements' => $allowedHtmlElements,
+                                       'magic' => $magicWords,
+                               ];
+                       } ],
+               ],
                'dependencies' => [
                        'mediawiki.util',
                        'mediawiki.language',
@@ -1592,10 +1621,54 @@ return [
                )
        ],
 
-       'mediawiki.language.names' => [ 'class' => ResourceLoaderLanguageNamesModule::class ],
+       'mediawiki.language.names' => [
+               'localBasePath' => "$IP/resources/src/mediawiki.language",
+               'remoteBasePath' => "$wgResourceBasePath/resources/src/mediawiki.language",
+               'packageFiles' => [
+                       'mediawiki.language.names.js',
+                       'names.json' => [ 'callback' => function ( ResourceLoaderContext $context ) {
+                               return Language::fetchLanguageNames( $context->getLanguage(), 'all' );
+                       } ],
+               ],
+               'dependencies' => 'mediawiki.language',
+               'targets' => [ 'desktop', 'mobile' ],
+       ],
 
        'mediawiki.language.specialCharacters' => [
-               'class' => ResourceLoaderSpecialCharacterDataModule::class
+               'localBasePath' => "$IP/resources/src/mediawiki.language",
+               'remoteBasePath' => "$wgResourceBasePath/resources/src/mediawiki.language",
+               'packageFiles' => [
+                       'mediawiki.language.specialCharacters.js',
+                       'specialcharacters.json'
+               ],
+               'dependencies' => 'mediawiki.language',
+               'targets' => [ 'desktop', 'mobile' ],
+               'messages' => [
+                       'special-characters-group-latin',
+                       'special-characters-group-latinextended',
+                       'special-characters-group-ipa',
+                       'special-characters-group-symbols',
+                       'special-characters-group-greek',
+                       'special-characters-group-greekextended',
+                       'special-characters-group-cyrillic',
+                       'special-characters-group-arabic',
+                       'special-characters-group-arabicextended',
+                       'special-characters-group-persian',
+                       'special-characters-group-hebrew',
+                       'special-characters-group-bangla',
+                       'special-characters-group-tamil',
+                       'special-characters-group-telugu',
+                       'special-characters-group-sinhala',
+                       'special-characters-group-devanagari',
+                       'special-characters-group-gujarati',
+                       'special-characters-group-thai',
+                       'special-characters-group-lao',
+                       'special-characters-group-khmer',
+                       'special-characters-group-canadianaboriginal',
+                       'special-characters-title-endash',
+                       'special-characters-title-emdash',
+                       'special-characters-title-minus'
+               ]
        ],
 
        /* MediaWiki Libs */
index 2a167fe..619cf38 100644 (file)
@@ -25,7 +25,7 @@
 
                // Config for uploads to local wiki.
                // Can be overridden with foreign wiki config when #loadConfig is called.
-               this.config = mw.config.get( 'wgUploadDialog' );
+               this.config = require( './config.json' ).UploadDialog;
 
                mw.ForeignUpload.call( this, target, apiconfig );
        }
index fdc988b..846deb9 100644 (file)
        var oldParser,
                slice = Array.prototype.slice,
                parserDefaults = {
+                       // Magic words and their expansions. Server-side data is added to this below.
                        magic: {
                                PAGENAME: mw.config.get( 'wgPageName' ),
                                PAGENAMEE: mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) )
                        },
                        // Whitelist for allowed HTML elements in wikitext.
                        // Self-closing tags are not currently supported.
-                       // Can be populated via setParserDefaults().
+                       // Filled in with server-side data below
                        allowedHtmlElements: [],
                        // Key tag name, value allowed attributes for that tag.
                        // See Sanitizer::setupAttributeWhitelist
@@ -56,6 +57,9 @@
                        format: 'parse'
                };
 
+       // Add in server-side data (allowedHtmlElements and magic words)
+       $.extend( true, parserDefaults, require( './parserDefaults.json' ) );
+
        /**
         * Wrapper around jQuery append that converts all non-objects to TextNode so append will not
         * convert what it detects as an htmlString to an element.
diff --git a/resources/src/mediawiki.language/mediawiki.language.names.js b/resources/src/mediawiki.language/mediawiki.language.names.js
new file mode 100644 (file)
index 0000000..fa7edca
--- /dev/null
@@ -0,0 +1,4 @@
+( function () {
+       var names = require( './names.json' );
+       mw.language.setData( mw.config.get( 'wgUserLanguage' ), 'languageData', names );
+}() );
diff --git a/resources/src/mediawiki.language/mediawiki.language.specialCharacters.js b/resources/src/mediawiki.language/mediawiki.language.specialCharacters.js
new file mode 100644 (file)
index 0000000..ba8a233
--- /dev/null
@@ -0,0 +1,5 @@
+( function () {
+       var specialCharacters = require( './specialcharacters.json' );
+       mw.language.setSpecialCharacters( specialCharacters );
+       module.exports = specialCharacters;
+}() );
index 0d1a657..6a75db0 100644 (file)
@@ -63,7 +63,7 @@
 @colorButtonText: @colorGray2;
 @colorButtonTextHighlight: @colorGray4;
 @colorButtonTextActive: @colorGray1;
-@colorDisabledText: @colorGray12;
+@colorDisabledText: @colorGray7;
 @colorErrorText: #d33;
 @colorWarningText: #705000;
 
index b7175d0..ac7a225 100644 (file)
                box-shadow: none;
        }
 
-       &:disabled,
-       &.mw-ui-quiet.mw-ui-progressive,
-       &.mw-ui-quiet.mw-ui-destructive {
+       &:disabled {
                background-color: @colorGray12;
                color: @colorBaseInverted;
                border-color: @colorGray12;
        // </div>
        //
        // Styleguide 2.1.1.
-       &.mw-ui-quiet {
+       &.mw-ui-quiet,
+       &.mw-ui-quiet.mw-ui-progressive,
+       &.mw-ui-quiet.mw-ui-destructive {
                background-color: transparent;
                // Quiet buttons all start gray, and reveal
                // progressive/destructive color on hover and active.
                        box-shadow: none;
                }
 
-               &:disabled {
+               &:disabled,
+               &:disabled:hover,
+               &:disabled:active {
                        background-color: transparent;
                        color: @colorDisabledText;
                        border-color: transparent;
index 65fe3d3..7cda45f 100644 (file)
@@ -1,7 +1,9 @@
 ( function () {
        'use strict';
 
-       var util;
+       var util,
+               config = require( './config.json' ),
+               origConfig = config;
 
        /**
         * Encode the string like PHP's rawurlencode
 
                /* Main body */
 
+               setOptionsForTest: function ( opts ) {
+                       if ( !window.QUnit ) {
+                               throw new Error( 'Modifying options not allowed outside unit tests' );
+                       }
+                       config = $.extend( {}, config, opts );
+               },
+
+               resetOptionsForTest: function () {
+                       if ( !window.QUnit ) {
+                               throw new Error( 'Resetting options not allowed outside unit tests' );
+                       }
+                       config = origConfig;
+               },
+
                /**
                 * Encode the string like PHP's rawurlencode
                 *
@@ -68,7 +84,7 @@
                 * @return {string} Encoded string
                 */
                escapeIdForAttribute: function ( str ) {
-                       var mode = mw.config.get( 'wgFragmentMode' )[ 0 ];
+                       var mode = config.FragmentMode[ 0 ];
 
                        return escapeIdInternal( str, mode );
                },
@@ -83,7 +99,7 @@
                 * @return {string} Encoded string
                 */
                escapeIdForLink: function ( str ) {
-                       var mode = mw.config.get( 'wgFragmentMode' )[ 0 ];
+                       var mode = config.FragmentMode[ 0 ];
 
                        return escapeIdInternal( str, mode );
                },
index 90a5ed1..cd3ddfa 100644 (file)
@@ -118,6 +118,8 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
 
        /**
         * @covers ParserOutput::addExternalLink
+        * @covers LinksUpdate::getAddedExternalLinks
+        * @covers LinksUpdate::getRemovedExternalLinks
         */
        public function testUpdate_externallinks() {
                /** @var ParserOutput $po */
@@ -125,7 +127,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
 
                $po->addExternalLink( "http://testing.com/wiki/Foo" );
 
-               $this->assertLinksUpdate(
+               $update = $this->assertLinksUpdate(
                        $t,
                        $po,
                        'externallinks',
@@ -135,6 +137,31 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
                                [ 'http://testing.com/wiki/Foo', 'http://com.testing./wiki/Foo' ],
                        ]
                );
+
+               $this->assertArrayEquals( [
+                       "http://testing.com/wiki/Foo"
+               ], $update->getAddedExternalLinks() );
+
+               $po = new ParserOutput();
+               $po->setTitleText( $t->getPrefixedText() );
+               $po->addExternalLink( 'http://testing.com/wiki/Bar' );
+               $update = $this->assertLinksUpdate(
+                       $t,
+                       $po,
+                       'externallinks',
+                       'el_to, el_index',
+                       'el_from = ' . self::$testingPageId,
+                       [
+                               [ 'http://testing.com/wiki/Bar', 'http://com.testing./wiki/Bar' ],
+                       ]
+               );
+
+               $this->assertArrayEquals( [
+                       "http://testing.com/wiki/Bar"
+               ], $update->getAddedExternalLinks() );
+               $this->assertArrayEquals( [
+                       "http://testing.com/wiki/Foo"
+               ], $update->getRemovedExternalLinks() );
        }
 
        /**
index 19a1e89..f6bf7f1 100644 (file)
@@ -148,10 +148,6 @@ class ResourceLoaderTest extends ResourceLoaderTestCase {
                        'SkinModule (FileModule subclass)' => [ true,
                                [ 'class' => ResourceLoaderSkinModule::class, 'scripts' => 'example.js' ]
                        ],
-                       'JqueryMsgModule (FileModule subclass)' => [ true, [
-                               'class' => ResourceLoaderJqueryMsgModule::class,
-                               'scripts' => 'example.js',
-                       ] ],
                        'WikiModule' => [ false, [
                                'class' => ResourceLoaderWikiModule::class,
                                'scripts' => [ 'MediaWiki:Example.js' ],
index ad6a0d0..d22c8d0 100644 (file)
@@ -80,6 +80,7 @@
                },
                teardown: function () {
                        $.fn.updateTooltipAccessKeys.setTestMode( false );
+                       mw.util.resetOptionsForTest();
                },
                messages: {
                        // Used by accessKeyLabel in test for addPortletLink
                        // Distant future: no legacy fallbacks
                        [ allNew, text, html5Encoded ]
                ].forEach( function ( testCase ) {
-                       mw.config.set( 'wgFragmentMode', testCase[ 0 ] );
+                       mw.util.setOptionsForTest( { FragmentMode: testCase[ 0 ] } );
 
                        assert.strictEqual( util.escapeIdForAttribute( testCase[ 1 ] ), testCase[ 2 ] );
                } );
                        // Distant future: no legacy fallbacks
                        [ allNew, text, html5Encoded ]
                ].forEach( function ( testCase ) {
-                       mw.config.set( 'wgFragmentMode', testCase[ 0 ] );
+                       mw.util.setOptionsForTest( { FragmentMode: testCase[ 0 ] } );
 
                        assert.strictEqual( util.escapeIdForLink( testCase[ 1 ] ), testCase[ 2 ] );
                } );
                href = util.getUrl( '#Fragment', { action: 'edit' } );
                assert.strictEqual( href, '/w/index.php?action=edit#Fragment', 'empty title with query string and fragment' );
 
-               mw.config.set( 'wgFragmentMode', [ 'legacy' ] );
+               mw.util.setOptionsForTest( { FragmentMode: [ 'legacy' ] } );
                href = util.getUrl( 'Foo:Sandbox \xC4#Fragment \xC4', { action: 'edit' } );
                assert.strictEqual( href, '/w/index.php?title=Foo:Sandbox_%C3%84&action=edit#Fragment_.C3.84', 'title with query string, fragment, and special characters' );
 
-               mw.config.set( 'wgFragmentMode', [ 'html5' ] );
+               mw.util.setOptionsForTest( { FragmentMode: [ 'html5' ] } );
                href = util.getUrl( 'Foo:Sandbox \xC4#Fragment \xC4', { action: 'edit' } );
                assert.strictEqual( href, '/w/index.php?title=Foo:Sandbox_%C3%84&action=edit#Fragment_Ä', 'title with query string, fragment, and special characters' );
 
                href = util.getUrl( 'Foo:%23#Fragment', { action: 'edit' } );
                assert.strictEqual( href, '/w/index.php?title=Foo:%2523&action=edit#Fragment', 'title containing %23 (#), fragment, and a query string' );
 
-               mw.config.set( 'wgFragmentMode', [ 'legacy' ] );
+               mw.util.setOptionsForTest( { FragmentMode: [ 'legacy' ] } );
                href = util.getUrl( '#+&=:;@$-_.!*/[]<>\'§', { action: 'edit' } );
                assert.strictEqual( href, '/w/index.php?action=edit#.2B.26.3D:.3B.40.24-_..21.2A.2F.5B.5D.3C.3E.27.C2.A7', 'fragment with various characters' );
 
-               mw.config.set( 'wgFragmentMode', [ 'html5' ] );
+               mw.util.setOptionsForTest( { FragmentMode: [ 'html5' ] } );
                href = util.getUrl( '#+&=:;@$-_.!*/[]<>\'§', { action: 'edit' } );
                assert.strictEqual( href, '/w/index.php?action=edit#+&=:;@$-_.!*/[]<>\'§', 'fragment with various characters' );
        } );