Merge "Remove several deprecated unused methods from OutputPage & ParserOutput"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 9 May 2019 18:19:28 +0000 (18:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 9 May 2019 18:19:28 +0000 (18:19 +0000)
17 files changed:
includes/MagicWord.php
includes/MagicWordArray.php
includes/MediaWikiServices.php
includes/ServiceWiring.php
includes/api/ApiFormatRaw.php
includes/filerepo/file/LocalFileDeleteBatch.php
includes/htmlform/fields/HTMLUserTextField.php
includes/libs/services/ServiceContainer.php
includes/search/PrefixSearch.php
includes/search/SearchDatabase.php
includes/search/SearchEngine.php
includes/title/MediaWikiTitleCodec.php
includes/title/TitleParser.php
includes/upload/UploadStash.php
languages/messages/MessagesEn.php
resources/lib/foreign-resources.yaml
tests/phpunit/includes/MagicWordFactoryTest.php

index 3c77234..0984786 100644 (file)
@@ -109,11 +109,7 @@ class MagicWord {
                $this->mId = $id;
                $this->mSynonyms = (array)$syn;
                $this->mCaseSensitive = $cs;
-               $this->contLang = $contLang;
-
-               if ( !$contLang ) {
-                       $this->contLang = MediaWikiServices::getInstance()->getContentLanguage();
-               }
+               $this->contLang = $contLang ?: MediaWikiServices::getInstance()->getContentLanguage();
        }
 
        /**
index 707c644..73d5173 100644 (file)
@@ -49,10 +49,7 @@ class MagicWordArray {
         */
        public function __construct( $names = [], MagicWordFactory $factory = null ) {
                $this->names = $names;
-               $this->factory = $factory;
-               if ( !$factory ) {
-                       $this->factory = MediaWikiServices::getInstance()->getMagicWordFactory();
-               }
+               $this->factory = $factory ?: MediaWikiServices::getInstance()->getMagicWordFactory();
        }
 
        /**
index d6f50bf..9dbfc1b 100644 (file)
@@ -225,6 +225,7 @@ class MediaWikiServices extends ServiceContainer {
                }
        }
 
+       /** @noinspection PhpDocSignatureInspection */
        /**
         * Salvages the state of any salvageable service instances in $other.
         *
index a30534e..9b064ce 100644 (file)
@@ -43,6 +43,7 @@ use MediaWiki\Block\BlockManager;
 use MediaWiki\Block\BlockRestrictionStore;
 use MediaWiki\Config\ConfigRepository;
 use MediaWiki\Config\ServiceOptions;
+use MediaWiki\Http\HttpRequestFactory;
 use MediaWiki\Interwiki\ClassicInterwikiLookup;
 use MediaWiki\Interwiki\InterwikiLookup;
 use MediaWiki\Linker\LinkRenderer;
@@ -170,7 +171,7 @@ return [
                return new DateFormatterFactory;
        },
 
-       'DBLoadBalancer' => function ( MediaWikiServices $services ) : Wikimedia\Rdbms\LoadBalancer {
+       'DBLoadBalancer' => function ( MediaWikiServices $services ) : Wikimedia\Rdbms\ILoadBalancer {
                // just return the default LB from the DBLoadBalancerFactory service
                return $services->getDBLoadBalancerFactory()->getMainLB();
        },
@@ -212,8 +213,8 @@ return [
        },
 
        'HttpRequestFactory' =>
-       function ( MediaWikiServices $services ) : \MediaWiki\Http\HttpRequestFactory {
-               return new \MediaWiki\Http\HttpRequestFactory();
+       function ( MediaWikiServices $services ) : HttpRequestFactory {
+               return new HttpRequestFactory();
        },
 
        'InterwikiLookup' => function ( MediaWikiServices $services ) : InterwikiLookup {
index 9ec4a2c..1d83f73 100644 (file)
@@ -35,11 +35,8 @@ class ApiFormatRaw extends ApiFormatBase {
         */
        public function __construct( ApiMain $main, ApiFormatBase $errorFallback = null ) {
                parent::__construct( $main, 'raw' );
-               if ( $errorFallback === null ) {
-                       $this->errorFallback = $main->createPrinterByName( $main->getParameter( 'format' ) );
-               } else {
-                       $this->errorFallback = $errorFallback;
-               }
+               $this->errorFallback = $errorFallback ?:
+                       $main->createPrinterByName( $main->getParameter( 'format' ) );
        }
 
        public function getMimeType() {
index ecd63e7..d447945 100644 (file)
@@ -62,12 +62,8 @@ class LocalFileDeleteBatch {
                $this->file = $file;
                $this->reason = $reason;
                $this->suppress = $suppress;
-               if ( $user ) {
-                       $this->user = $user;
-               } else {
-                       global $wgUser;
-                       $this->user = $wgUser;
-               }
+               global $wgUser;
+               $this->user = $user ?: $wgUser;
                $this->status = $file->repo->newGood();
        }
 
index d672314..5b3bc25 100644 (file)
@@ -65,7 +65,7 @@ class HTMLUserTextField extends HTMLTextField {
        protected function isValidIPRange( $value ) {
                $cidrIPRanges = $this->mParams['iprangelimits'];
 
-               if ( !IP::isValidBlock( $value ) ) {
+               if ( !IP::isValidRange( $value ) ) {
                        return false;
                }
 
index 59e5c4b..25d1d6a 100644 (file)
@@ -399,7 +399,7 @@ class ServiceContainer implements DestructibleService {
         * @throws ContainerDisabledException if this container has already been destroyed.
         * @throws ServiceDisabledException if the requested service has been disabled.
         *
-        * @return object The service instance
+        * @return mixed The service instance
         */
        public function getService( $name ) {
                if ( $this->destroyed ) {
index a7d475e..3b7a0a9 100644 (file)
@@ -41,7 +41,7 @@ abstract class PrefixSearch {
         * @return array Array of strings
         */
        public static function titleSearch( $search, $limit, $namespaces = [], $offset = 0 ) {
-               wfDeprecated( __METHOD__, '1.34' );
+               wfDeprecated( __METHOD__, '1.23' );
                $prefixSearch = new StringPrefixSearch;
                return $prefixSearch->search( $search, $limit, $namespaces, $offset );
        }
index 54bfd28..230cded 100644 (file)
@@ -38,11 +38,7 @@ abstract class SearchDatabase extends SearchEngine {
         * @param IDatabase|null $db The database to search from
         */
        public function __construct( IDatabase $db = null ) {
-               if ( $db ) {
-                       $this->db = $db;
-               } else {
-                       $this->db = wfGetDB( DB_REPLICA );
-               }
+               $this->db = $db ?: wfGetDB( DB_REPLICA );
        }
 
        /**
index 65a3e6a..b99c0d3 100644 (file)
@@ -245,7 +245,7 @@ abstract class SearchEngine {
         * search engine
         */
        public function transformSearchTerm( $term ) {
-               wfDeprecated( __METHOD__, '1.34' );
+               wfDeprecated( __METHOD__, '1.32' );
                return $term;
        }
 
index 31a0222..778fb3f 100644 (file)
@@ -154,8 +154,7 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser {
        }
 
        /**
-        * Parses the given text and constructs a TitleValue. Normalization
-        * is applied according to the rules appropriate for the form specified by $form.
+        * Parses the given text and constructs a TitleValue.
         *
         * @param string $text The text to parse
         * @param int $defaultNamespace Namespace to assume per default (usually NS_MAIN)
index ddffed6..8569735 100644 (file)
@@ -32,8 +32,7 @@
  */
 interface TitleParser {
        /**
-        * Parses the given text and constructs a TitleValue. Normalization
-        * is applied according to the rules appropriate for the form specified by $form.
+        * Parses the given text and constructs a TitleValue.
         *
         * @note this only parses local page links, interwiki-prefixes etc. are not considered!
         *
index 2c4bc11..d39975d 100644 (file)
@@ -89,12 +89,8 @@ class UploadStash {
 
                // if a user was passed, use it. otherwise, attempt to use the global.
                // this keeps FileRepo from breaking when it creates an UploadStash object
-               if ( $user ) {
-                       $this->user = $user;
-               } else {
-                       global $wgUser;
-                       $this->user = $wgUser;
-               }
+               global $wgUser;
+               $this->user = $user ?: $wgUser;
 
                if ( is_object( $this->user ) ) {
                        $this->userId = $this->user->getId();
index 86ac01a..d0115ea 100644 (file)
@@ -400,6 +400,7 @@ $specialPageAliases = [
        'Badtitle'                  => [ 'Badtitle' ],
        'Blankpage'                 => [ 'BlankPage' ],
        'Block'                     => [ 'Block', 'BlockIP', 'BlockUser' ],
+       'BlockList'                 => [ 'BlockList', 'ListBlocks', 'IPBlockList' ],
        'Booksources'               => [ 'BookSources' ],
        'BotPasswords'              => [ 'BotPasswords' ],
        'BrokenRedirects'           => [ 'BrokenRedirects' ],
@@ -428,7 +429,6 @@ $specialPageAliases = [
        'Import'                    => [ 'Import' ],
        'Invalidateemail'           => [ 'InvalidateEmail' ],
        'JavaScriptTest'            => [ 'JavaScriptTest' ],
-       'BlockList'                 => [ 'BlockList', 'ListBlocks', 'IPBlockList' ],
        'LinkSearch'                => [ 'LinkSearch' ],
        'LinkAccounts'              => [ 'LinkAccounts' ],
        'Listadmins'                => [ 'ListAdmins' ],
index 9572cba..3adca1b 100644 (file)
@@ -163,7 +163,17 @@ jquery.hoverIntent:
   src: https://raw.githubusercontent.com/briancherne/jquery-hoverIntent/823603fdac/jquery.hoverIntent.js
   integrity: sha384-lca0haN0hqFGGh2aYUhtAgX9dhVHfQnTADH4svDeM6gcXnL7aFGeAi1NYwipDMyS
 
-# TODO: jquery.i18n
+jquery.i18n:
+  type: tar
+  src: https://codeload.github.com/wikimedia/jquery.i18n/tar.gz/v1.0.5
+  integrity: sha384-bkmmKC2byOVjTg4di3o6sSISU49JwXynV9gNGH2zl4U9nh8vZJiauiIvoWgvhwsK
+  dest:
+    jquery.i18n-1.0.5/CODE_OF_CONDUCT.md:
+    jquery.i18n-1.0.5/CREDITS:
+    jquery.i18n-1.0.5/GPL-LICENSE:
+    jquery.i18n-1.0.5/MIT-LICENSE:
+    jquery.i18n-1.0.5/README.md:
+    jquery.i18n-1.0.5/src:
 
 jquery.jStorage:
   type: file
index 63ca139..065024b 100644 (file)
@@ -7,10 +7,7 @@
  */
 class MagicWordFactoryTest extends MediaWikiTestCase {
        private function makeMagicWordFactory( Language $contLang = null ) {
-               if ( $contLang === null ) {
-                       return new MagicWordFactory( Language::factory( 'en' ) );
-               }
-               return new MagicWordFactory( $contLang );
+               return new MagicWordFactory( $contLang ?: Language::factory( 'en' ) );
        }
 
        public function testGetContentLanguage() {