Merge "Corrected grammatical error."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 8 May 2019 20:05:33 +0000 (20:05 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 8 May 2019 20:05:33 +0000 (20:05 +0000)
195 files changed:
RELEASE-NOTES-1.34
composer.json
docs/hooks.txt
includes/Block.php
includes/DefaultSettings.php
includes/EditPage.php
includes/Linker.php
includes/MovePage.php
includes/OutputPage.php
includes/ProtectionForm.php
includes/SiteStatsInit.php
includes/Title.php
includes/TrackingCategories.php
includes/WebRequest.php
includes/WikiMap.php
includes/actions/InfoAction.php
includes/api/ApiBase.php
includes/api/ApiBlockInfoTrait.php
includes/api/ApiHelp.php
includes/api/ApiPageSet.php
includes/api/ApiQueryAllDeletedRevisions.php
includes/api/ApiQueryAllPages.php
includes/api/ApiQueryAllRevisions.php
includes/api/ApiQueryInfo.php
includes/api/ApiQuerySearch.php
includes/api/ApiQuerySiteinfo.php
includes/api/i18n/pt.json
includes/api/i18n/ru.json
includes/block/AbstractBlock.php [new file with mode: 0644]
includes/block/BlockManager.php
includes/block/SystemBlock.php [new file with mode: 0644]
includes/cache/localisation/LCStoreCDB.php
includes/cache/localisation/LocalisationCache.php
includes/changes/ChangesFeed.php
includes/content/ContentHandler.php
includes/editpage/TextboxBuilder.php
includes/exception/MWExceptionHandler.php
includes/exception/UserBlockedError.php
includes/export/DumpNotalkFilter.php
includes/export/XmlDumpWriter.php
includes/filerepo/FileRepo.php
includes/gallery/TraditionalImageGallery.php
includes/import/WikiImporter.php
includes/installer/Installer.php
includes/page/Article.php
includes/resourceloader/ResourceLoaderStartUpModule.php
includes/search/SearchEngine.php
includes/skins/Skin.php
includes/skins/SkinTemplate.php
includes/specialpage/ChangesListSpecialPage.php
includes/specials/SpecialAncientpages.php
includes/specials/SpecialContributions.php
includes/specials/SpecialDeadendpages.php
includes/specials/SpecialDeletedContributions.php
includes/specials/SpecialEditWatchlist.php
includes/specials/SpecialFewestrevisions.php
includes/specials/SpecialListGroupRights.php
includes/specials/SpecialLonelypages.php
includes/specials/SpecialMostcategories.php
includes/specials/SpecialMostinterwikis.php
includes/specials/SpecialMovepage.php
includes/specials/SpecialPasswordPolicies.php
includes/specials/SpecialRandompage.php
includes/specials/SpecialSearch.php
includes/specials/SpecialShortpages.php
includes/specials/SpecialStatistics.php
includes/specials/SpecialUncategorizedpages.php
includes/specials/SpecialWithoutinterwiki.php
includes/specials/forms/UploadForm.php
includes/specials/pagers/ContribsPager.php
includes/title/NaiveImportTitleFactory.php
includes/title/NamespaceImportTitleFactory.php
includes/title/SubpageImportTitleFactory.php
includes/user/ExternalUserNames.php
includes/user/User.php
includes/widget/search/SearchFormWidget.php
languages/Language.php
languages/i18n/ar.json
languages/i18n/ast.json
languages/i18n/az.json
languages/i18n/bcc.json
languages/i18n/be-tarask.json
languages/i18n/bg.json
languages/i18n/bjn.json
languages/i18n/bn.json
languages/i18n/da.json
languages/i18n/de.json
languages/i18n/diq.json
languages/i18n/exif/jv.json
languages/i18n/fi.json
languages/i18n/fy.json
languages/i18n/he.json
languages/i18n/hyw.json
languages/i18n/it.json
languages/i18n/jv.json
languages/i18n/ko.json
languages/i18n/lrc.json
languages/i18n/lv.json
languages/i18n/map-bms.json
languages/i18n/mk.json
languages/i18n/nl.json
languages/i18n/nqo.json
languages/i18n/pt-br.json
languages/i18n/pt.json
languages/i18n/ru.json
languages/i18n/sk.json
languages/i18n/skr-arab.json
languages/i18n/sl.json
languages/i18n/te.json
languages/i18n/zh-hans.json
languages/i18n/zh-hant.json
languages/i18n/zh-hk.json
languages/messages/MessagesSr_ec.php
maintenance/cleanupCaps.php
maintenance/cleanupTitles.php
maintenance/generateSitemap.php
maintenance/namespaceDupes.php
maintenance/rebuildFileCache.php
resources/lib/foreign-resources.yaml
resources/lib/ooui/History.md
resources/lib/ooui/i18n/hy.json
resources/lib/ooui/oojs-ui-apex.js
resources/lib/ooui/oojs-ui-core-apex.css
resources/lib/ooui/oojs-ui-core-wikimediaui.css
resources/lib/ooui/oojs-ui-core.js
resources/lib/ooui/oojs-ui-core.js.map.json
resources/lib/ooui/oojs-ui-toolbars-apex.css
resources/lib/ooui/oojs-ui-toolbars-wikimediaui.css
resources/lib/ooui/oojs-ui-toolbars.js
resources/lib/ooui/oojs-ui-widgets-apex.css
resources/lib/ooui/oojs-ui-widgets-wikimediaui.css
resources/lib/ooui/oojs-ui-widgets.js
resources/lib/ooui/oojs-ui-wikimediaui.js
resources/lib/ooui/oojs-ui-windows-apex.css
resources/lib/ooui/oojs-ui-windows-wikimediaui.css
resources/lib/ooui/oojs-ui-windows.js
resources/lib/ooui/themes/wikimediaui/icons-alerts.json
resources/lib/ooui/themes/wikimediaui/icons-content.json
resources/lib/ooui/themes/wikimediaui/images/icons/alert-error.png [deleted file]
resources/lib/ooui/themes/wikimediaui/images/icons/alert-error.svg [deleted file]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-ltr-invert.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-ltr-invert.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-ltr-progressive.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-ltr-progressive.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-ltr.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-ltr.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-rtl-invert.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-rtl-invert.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-rtl-progressive.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-rtl-progressive.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-rtl.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleDisambiguation-rtl.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-ltr-invert.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-ltr-invert.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-ltr-progressive.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-ltr-progressive.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-ltr.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-ltr.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-rtl-invert.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-rtl-invert.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-rtl-progressive.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-rtl-progressive.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-rtl.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/articleNotFound-rtl.svg [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/error-error.png [new file with mode: 0644]
resources/lib/ooui/themes/wikimediaui/images/icons/error-error.svg [new file with mode: 0644]
resources/src/mediawiki.action/mediawiki.action.history.styles.less
resources/src/mediawiki.less/mediawiki.ui/mixins.buttons.less [new file with mode: 0644]
resources/src/mediawiki.ui/components/buttons.less
resources/src/mediawiki.widgets/images/page-disambiguation-ltr.svg [deleted file]
resources/src/mediawiki.widgets/images/page-disambiguation-rtl.svg [deleted file]
resources/src/mediawiki.widgets/images/page-not-found-he-yi.svg [deleted file]
resources/src/mediawiki.widgets/images/page-not-found-ltr.svg [deleted file]
resources/src/mediawiki.widgets/images/page-not-found-rtl.svg [deleted file]
resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js
resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
resources/src/mediawiki.widgets/mw.widgets.TitleWidget.less
tests/parser/ParserTestRunner.php
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/BlockTest.php
tests/phpunit/includes/FauxRequestTest.php
tests/phpunit/includes/PagePropsTest.php
tests/phpunit/includes/Permissions/PermissionManagerTest.php
tests/phpunit/includes/RevisionDbTestBase.php
tests/phpunit/includes/SystemBlockTest.php [new file with mode: 0644]
tests/phpunit/includes/TitlePermissionTest.php
tests/phpunit/includes/WebRequestTest.php
tests/phpunit/includes/api/ApiBaseTest.php
tests/phpunit/includes/api/ApiBlockInfoTraitTest.php
tests/phpunit/includes/editpage/TextboxBuilderTest.php
tests/phpunit/includes/user/PasswordResetTest.php
tests/phpunit/includes/user/UserTest.php
tests/phpunit/structure/ApiStructureTest.php
tests/selenium/specs/rollback.js
tests/selenium/wdio.conf.js

index 9059dc6..9231380 100644 (file)
@@ -112,6 +112,9 @@ because of Phabricator reports.
 * wfArrayFilter() and wfArrayFilterByKey(), deprecated in 1.32, have been
   removed.
 * wfMakeUrlIndexes() function, deprecated in 1.33, have been removed.
+* Method signatures in WatchedItemQueryServiceExtension have changed from taking
+  User objects to taking UserIdentity objects. Extensions implementing this
+  interface need to be changed accordingly.
 * User::getGroupPage() and ::makeGroupLinkHTML(), deprecated in 1.29, have been
   removed. Use UserGroupMembership::getGroupPage and ::getLink instead.
 * User::makeGroupLinkWiki(), deprecated in 1.29, has been removed. Use
index 3acf73a..a2dcaa1 100644 (file)
@@ -27,7 +27,7 @@
                "ext-xml": "*",
                "guzzlehttp/guzzle": "6.3.3",
                "liuggio/statsd-php-client": "1.0.18",
-               "oojs/oojs-ui": "0.31.5",
+               "oojs/oojs-ui": "0.31.6",
                "pear/mail": "1.4.1",
                "pear/mail_mime": "1.10.2",
                "pear/net_smtp": "1.8.1",
index b2f1e81..e90468d 100644 (file)
@@ -3068,7 +3068,6 @@ $tooltip: The default tooltip.  Escape before using.
     - text - String for the text
     - attribs - Array of attributes
     - query - Array of query parameters to add to the URL
-    - options - Array of options for Linker::link
 $lang: The language code to use for the link in the wfMessage function
 
 'SkinGetPoweredBy': TODO
index 0d13f7d..5b0d256 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Blocks and bans object
+ * Class for blocks stored in the database.
  *
  * 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
 
 use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
+use MediaWiki\Block\AbstractBlock;
 use MediaWiki\Block\BlockRestrictionStore;
 use MediaWiki\Block\Restriction\Restriction;
 use MediaWiki\Block\Restriction\NamespaceRestriction;
 use MediaWiki\Block\Restriction\PageRestriction;
 use MediaWiki\MediaWikiServices;
 
-class Block {
-       /** @var string */
-       public $mReason;
-
-       /** @var string */
-       public $mTimestamp;
-
+/**
+ * Blocks (as opposed to system blocks) are stored in the database, may
+ * give rise to autoblocks and may be tracked with cookies. Blocks are
+ * more customizable than system blocks: they may be hardblocks, and
+ * they may be sitewide or partial.
+ */
+class Block extends AbstractBlock {
        /** @var bool */
        public $mAuto;
 
-       /** @var string */
-       public $mExpiry;
-
-       /** @var bool */
-       public $mHideName;
-
        /** @var int */
        public $mParentBlockId;
 
@@ -53,61 +48,23 @@ class Block {
        /** @var bool */
        private $mFromMaster;
 
-       /** @var bool */
-       private $mBlockEmail;
-
-       /** @var bool */
-       private $allowUsertalk;
-
-       /** @var bool */
-       private $blockCreateAccount;
-
-       /** @var User|string */
-       private $target;
-
        /** @var int Hack for foreign blocking (CentralAuth) */
        private $forcedTargetID;
 
-       /**
-        * @var int Block::TYPE_ constant. After the block has been loaded
-        * from the database, this can only be USER, IP or RANGE.
-        */
-       private $type;
-
-       /** @var User */
-       private $blocker;
-
        /** @var bool */
        private $isHardblock;
 
        /** @var bool */
        private $isAutoblocking;
 
-       /** @var string|null */
-       private $systemBlockType;
-
-       /** @var bool */
-       private $isSitewide;
-
        /** @var Restriction[] */
        private $restrictions;
 
-       # TYPE constants
-       const TYPE_USER = 1;
-       const TYPE_IP = 2;
-       const TYPE_RANGE = 3;
-       const TYPE_AUTO = 4;
-       const TYPE_ID = 5;
-
        /**
         * Create a new block with specified option parameters on a user, IP or IP range.
         *
         * @param array $options Parameters of the block:
-        *     address string|User  Target user name, User object, IP address or IP range
         *     user int             Override target user ID (for foreign users)
-        *     by int               User ID of the blocker
-        *     reason string        Reason of the block
-        *     timestamp string     The time at which the block comes into effect
         *     auto bool            Is this an automatic block?
         *     expiry string        Timestamp of expiration of the block or 'infinity'
         *     anonOnly bool        Only disallow anonymous actions
@@ -116,11 +73,6 @@ class Block {
         *     hideName bool        Hide the target user name
         *     blockEmail bool      Disallow sending emails
         *     allowUsertalk bool   Allow the target to edit its own talk page
-        *     byText string        Username of the blocker (for foreign users)
-        *     systemBlock string   Indicate that this block is automatically
-        *                          created by MediaWiki rather than being stored
-        *                          in the database. Value is a string to return
-        *                          from self::getSystemBlockType().
         *     sitewide bool        Disallow editing all pages and all contribution
         *                          actions, except those specifically allowed by
         *                          other block flags
@@ -128,12 +80,10 @@ class Block {
         * @since 1.26 $options array
         */
        public function __construct( array $options = [] ) {
+               parent::__construct( $options );
+
                $defaults = [
-                       'address'         => '',
                        'user'            => null,
-                       'by'              => null,
-                       'reason'          => '',
-                       'timestamp'       => '',
                        'auto'            => false,
                        'expiry'          => '',
                        'anonOnly'        => false,
@@ -142,30 +92,16 @@ class Block {
                        'hideName'        => false,
                        'blockEmail'      => false,
                        'allowUsertalk'   => false,
-                       'byText'          => '',
-                       'systemBlock'     => null,
                        'sitewide'        => true,
                ];
 
                $options += $defaults;
 
-               $this->setTarget( $options['address'] );
-
                if ( $this->target instanceof User && $options['user'] ) {
                        # Needed for foreign users
                        $this->forcedTargetID = $options['user'];
                }
 
-               if ( $options['by'] ) {
-                       # Local user
-                       $this->setBlocker( User::newFromId( $options['by'] ) );
-               } else {
-                       # Foreign user
-                       $this->setBlocker( $options['byText'] );
-               }
-
-               $this->setReason( $options['reason'] );
-               $this->setTimestamp( wfTimestamp( TS_MW, $options['timestamp'] ) );
                $this->setExpiry( wfGetDB( DB_REPLICA )->decodeExpiry( $options['expiry'] ) );
 
                # Boolean settings
@@ -179,7 +115,6 @@ class Block {
                $this->isUsertalkEditAllowed( (bool)$options['allowUsertalk'] );
 
                $this->mFromMaster = false;
-               $this->systemBlockType = $options['systemBlock'];
        }
 
        /**
@@ -387,12 +322,13 @@ class Block {
                        if ( $block->getType() == self::TYPE_RANGE ) {
                                # This is the number of bits that are allowed to vary in the block, give
                                # or take some floating point errors
-                               $end = Wikimedia\base_convert( $block->getRangeEnd(), 16, 10 );
-                               $start = Wikimedia\base_convert( $block->getRangeStart(), 16, 10 );
-                               $size = log( $end - $start + 1, 2 );
+                               $target = $block->getTarget();
+                               $max = IP::isIPv6( $target ) ? 128 : 32;
+                               list( $network, $bits ) = IP::parseCIDR( $target );
+                               $size = $max - $bits;
 
                                # Rank a range block covering a single IP equally with a single-IP block
-                               $score = self::TYPE_RANGE - 1 + ( $size / 128 );
+                               $score = self::TYPE_RANGE - 1 + ( $size / $max );
 
                        } else {
                                $score = $block->getType();
@@ -543,9 +479,6 @@ class Block {
        public function insert( $dbw = null ) {
                global $wgBlockDisablesLogin;
 
-               if ( $this->getSystemBlockType() !== null ) {
-                       throw new MWException( 'Cannot insert a system block into the database' );
-               }
                if ( !$this->getBlocker() || $this->getBlocker()->getName() === '' ) {
                        throw new MWException( 'Cannot insert a block without a blocker set' );
                }
@@ -859,11 +792,6 @@ class Block {
                        return false;
                }
 
-               # Don't autoblock for system blocks
-               if ( $this->getSystemBlockType() !== null ) {
-                       throw new MWException( 'Cannot autoblock from a system block' );
-               }
-
                # Check for presence on the autoblock whitelist.
                if ( self::isWhitelistedFromAutoblocks( $autoblockIP ) ) {
                        return false;
@@ -1034,26 +962,7 @@ class Block {
        }
 
        /**
-        * Get the user id of the blocking sysop
-        *
-        * @return int (0 for foreign users)
-        */
-       public function getBy() {
-               return $this->getBlocker()->getId();
-       }
-
-       /**
-        * Get the username of the blocking sysop
-        *
-        * @return string
-        */
-       public function getByName() {
-               return $this->getBlocker()->getName();
-       }
-
-       /**
-        * Get the block ID
-        * @return int
+        * @inheritDoc
         */
        public function getId() {
                return $this->mId;
@@ -1077,55 +986,6 @@ class Block {
                return $this;
        }
 
-       /**
-        * Get the reason given for creating the block
-        *
-        * @since 1.33
-        * @return string
-        */
-       public function getReason() {
-               return $this->mReason;
-       }
-
-       /**
-        * Set the reason for creating the block
-        *
-        * @since 1.33
-        * @param string $reason
-        */
-       public function setReason( $reason ) {
-               $this->mReason = $reason;
-       }
-
-       /**
-        * Get whether the block hides the target's username
-        *
-        * @since 1.33
-        * @return bool The block hides the username
-        */
-       public function getHideName() {
-               return $this->mHideName;
-       }
-
-       /**
-        * Set whether ths block hides the target's username
-        *
-        * @since 1.33
-        * @param bool $hideName The block hides the username
-        */
-       public function setHideName( $hideName ) {
-               $this->mHideName = $hideName;
-       }
-
-       /**
-        * Get the system block type, if any
-        * @since 1.29
-        * @return string|null
-        */
-       public function getSystemBlockType() {
-               return $this->systemBlockType;
-       }
-
        /**
         * Get/set a flag determining whether the master is used for reads
         *
@@ -1164,165 +1024,6 @@ class Block {
                        : false;
        }
 
-       /**
-        * Indicates that the block is a sitewide block. This means the user is
-        * prohibited from editing any page on the site (other than their own talk
-        * page).
-        *
-        * @since 1.33
-        * @param null|bool $x
-        * @return bool
-        */
-       public function isSitewide( $x = null ) {
-               return wfSetVar( $this->isSitewide, $x );
-       }
-
-       /**
-        * Get or set the flag indicating whether this block blocks the target from
-        * creating an account. (Note that the flag may be overridden depending on
-        * global configs.)
-        *
-        * @since 1.33
-        * @param null|bool $x Value to set (if null, just get the property value)
-        * @return bool Value of the property
-        */
-       public function isCreateAccountBlocked( $x = null ) {
-               return wfSetVar( $this->blockCreateAccount, $x );
-       }
-
-       /**
-        * Get or set the flag indicating whether this block blocks the target from
-        * sending emails. (Note that the flag may be overridden depending on
-        * global configs.)
-        *
-        * @since 1.33
-        * @param null|bool $x Value to set (if null, just get the property value)
-        * @return bool Value of the property
-        */
-       public function isEmailBlocked( $x = null ) {
-               return wfSetVar( $this->mBlockEmail, $x );
-       }
-
-       /**
-        * Get or set the flag indicating whether this block blocks the target from
-        * editing their own user talk page. (Note that the flag may be overridden
-        * depending on global configs.)
-        *
-        * @since 1.33
-        * @param null|bool $x Value to set (if null, just get the property value)
-        * @return bool Value of the property
-        */
-       public function isUsertalkEditAllowed( $x = null ) {
-               return wfSetVar( $this->allowUsertalk, $x );
-       }
-
-       /**
-        * Determine whether the Block prevents a given right. A right
-        * may be blacklisted or whitelisted, or determined from a
-        * property on the Block object. For certain rights, the property
-        * may be overridden according to global configs.
-        *
-        * @since 1.33
-        * @param string $right Right to check
-        * @return bool|null null if unrecognized right or unset property
-        */
-       public function appliesToRight( $right ) {
-               $config = RequestContext::getMain()->getConfig();
-               $blockDisablesLogin = $config->get( 'BlockDisablesLogin' );
-
-               $res = null;
-               switch ( $right ) {
-                       case 'edit':
-                               // TODO: fix this case to return proper value
-                               $res = true;
-                               break;
-                       case 'createaccount':
-                               $res = $this->isCreateAccountBlocked();
-                               break;
-                       case 'sendemail':
-                               $res = $this->isEmailBlocked();
-                               break;
-                       case 'upload':
-                               // Until T6995 is completed
-                               $res = $this->isSitewide();
-                               break;
-                       case 'read':
-                               $res = false;
-                               break;
-                       case 'purge':
-                               $res = false;
-                               break;
-               }
-               if ( !$res && $blockDisablesLogin ) {
-                       // If a block would disable login, then it should
-                       // prevent any right that all users cannot do
-                       $anon = new User;
-                       $res = $anon->isAllowed( $right ) ? $res : true;
-               }
-
-               return $res;
-       }
-
-       /**
-        * Get/set whether the Block prevents a given action
-        *
-        * @deprecated since 1.33, use appliesToRight to determine block
-        *  behaviour, and specific methods to get/set properties
-        * @param string $action Action to check
-        * @param bool|null $x Value for set, or null to just get value
-        * @return bool|null Null for unrecognized rights.
-        */
-       public function prevents( $action, $x = null ) {
-               $config = RequestContext::getMain()->getConfig();
-               $blockDisablesLogin = $config->get( 'BlockDisablesLogin' );
-               $blockAllowsUTEdit = $config->get( 'BlockAllowsUTEdit' );
-
-               $res = null;
-               switch ( $action ) {
-                       case 'edit':
-                               # For now... <evil laugh>
-                               $res = true;
-                               break;
-                       case 'createaccount':
-                               $res = wfSetVar( $this->blockCreateAccount, $x );
-                               break;
-                       case 'sendemail':
-                               $res = wfSetVar( $this->mBlockEmail, $x );
-                               break;
-                       case 'upload':
-                               // Until T6995 is completed
-                               $res = $this->isSitewide();
-                               break;
-                       case 'editownusertalk':
-                               // NOTE: this check is not reliable on partial blocks
-                               // since partially blocked users are always allowed to edit
-                               // their own talk page unless a restriction exists on the
-                               // page or User_talk: namespace
-                               wfSetVar( $this->allowUsertalk, $x === null ? null : !$x );
-                               $res = !$this->isUsertalkEditAllowed();
-
-                               // edit own user talk can be disabled by config
-                               if ( !$blockAllowsUTEdit ) {
-                                       $res = true;
-                               }
-                               break;
-                       case 'read':
-                               $res = false;
-                               break;
-                       case 'purge':
-                               $res = false;
-                               break;
-               }
-               if ( !$res && $blockDisablesLogin ) {
-                       // If a block would disable login, then it should
-                       // prevent any action that all users cannot do
-                       $anon = new User;
-                       $res = $anon->isAllowed( $action ) ? $res : true;
-               }
-
-               return $res;
-       }
-
        /**
         * Get the block name, but with autoblocked IPs hidden as per standard privacy policy
         * @return string Text is escaped
@@ -1612,170 +1313,15 @@ class Block {
        }
 
        /**
-        * From an existing Block, get the target and the type of target.
-        * Note that, except for null, it is always safe to treat the target
-        * as a string; for User objects this will return User::__toString()
-        * which in turn gives User::getName().
+        * @inheritDoc
         *
-        * @param string|int|User|null $target
-        * @return array [ User|String|null, Block::TYPE_ constant|null ]
-        */
-       public static function parseTarget( $target ) {
-               # We may have been through this before
-               if ( $target instanceof User ) {
-                       if ( IP::isValid( $target->getName() ) ) {
-                               return [ $target, self::TYPE_IP ];
-                       } else {
-                               return [ $target, self::TYPE_USER ];
-                       }
-               } elseif ( $target === null ) {
-                       return [ null, null ];
-               }
-
-               $target = trim( $target );
-
-               if ( IP::isValid( $target ) ) {
-                       # We can still create a User if it's an IP address, but we need to turn
-                       # off validation checking (which would exclude IP addresses)
-                       return [
-                               User::newFromName( IP::sanitizeIP( $target ), false ),
-                               self::TYPE_IP
-                       ];
-
-               } elseif ( IP::isValidRange( $target ) ) {
-                       # Can't create a User from an IP range
-                       return [ IP::sanitizeRange( $target ), self::TYPE_RANGE ];
-               }
-
-               # Consider the possibility that this is not a username at all
-               # but actually an old subpage (T31797)
-               if ( strpos( $target, '/' ) !== false ) {
-                       # An old subpage, drill down to the user behind it
-                       $target = explode( '/', $target )[0];
-               }
-
-               $userObj = User::newFromName( $target );
-               if ( $userObj instanceof User ) {
-                       # Note that since numbers are valid usernames, a $target of "12345" will be
-                       # considered a User.  If you want to pass a block ID, prepend a hash "#12345",
-                       # since hash characters are not valid in usernames or titles generally.
-                       return [ $userObj, self::TYPE_USER ];
-
-               } elseif ( preg_match( '/^#\d+$/', $target ) ) {
-                       # Autoblock reference in the form "#12345"
-                       return [ substr( $target, 1 ), self::TYPE_AUTO ];
-
-               } else {
-                       # WTF?
-                       return [ null, null ];
-               }
-       }
-
-       /**
-        * Get the type of target for this particular block. Autoblocks have whichever type
-        * corresponds to their target, so to detect if a block is an autoblock, we have to
-        * check the mAuto property instead.
-        * @return int Block::TYPE_ constant, will never be TYPE_ID
+        * Autoblocks have whichever type corresponds to their target, so to detect if a block is an
+        * autoblock, we have to check the mAuto property instead.
         */
        public function getType() {
                return $this->mAuto
                        ? self::TYPE_AUTO
-                       : $this->type;
-       }
-
-       /**
-        * Get the target and target type for this particular Block.  Note that for autoblocks,
-        * this returns the unredacted name; frontend functions need to call $block->getRedactedName()
-        * in this situation.
-        * @return array [ User|String, Block::TYPE_ constant ]
-        * @todo FIXME: This should be an integral part of the Block member variables
-        */
-       public function getTargetAndType() {
-               return [ $this->getTarget(), $this->getType() ];
-       }
-
-       /**
-        * Get the target for this particular Block.  Note that for autoblocks,
-        * this returns the unredacted name; frontend functions need to call $block->getRedactedName()
-        * in this situation.
-        * @return User|string
-        */
-       public function getTarget() {
-               return $this->target;
-       }
-
-       /**
-        * Get the block expiry time
-        *
-        * @since 1.19
-        * @return string
-        */
-       public function getExpiry() {
-               return $this->mExpiry;
-       }
-
-       /**
-        * Set the block expiry time
-        *
-        * @since 1.33
-        * @param string $expiry
-        */
-       public function setExpiry( $expiry ) {
-               $this->mExpiry = $expiry;
-       }
-
-       /**
-        * Get the timestamp indicating when the block was created
-        *
-        * @since 1.33
-        * @return string
-        */
-       public function getTimestamp() {
-               return $this->mTimestamp;
-       }
-
-       /**
-        * Set the timestamp indicating when the block was created
-        *
-        * @since 1.33
-        * @param string $timestamp
-        */
-       public function setTimestamp( $timestamp ) {
-               $this->mTimestamp = $timestamp;
-       }
-
-       /**
-        * Set the target for this block, and update $this->type accordingly
-        * @param mixed $target
-        */
-       public function setTarget( $target ) {
-               list( $this->target, $this->type ) = self::parseTarget( $target );
-       }
-
-       /**
-        * Get the user who implemented this block
-        * @return User User object. May name a foreign user.
-        */
-       public function getBlocker() {
-               return $this->blocker;
-       }
-
-       /**
-        * Set the user who implemented (or will implement) this block
-        * @param User|string $user Local User object or username string
-        */
-       public function setBlocker( $user ) {
-               if ( is_string( $user ) ) {
-                       $user = User::newFromName( $user, false );
-               }
-
-               if ( $user->isAnon() && User::isUsableName( $user->getName() ) ) {
-                       throw new InvalidArgumentException(
-                               'Blocker must be a local user or a name that cannot be a local user'
-                       );
-               }
-
-               $this->blocker = $user;
+                       : parent::getType();
        }
 
        /**
@@ -1867,19 +1413,15 @@ class Block {
        }
 
        /**
-        * Get the key and parameters for the corresponding error message.
+        * @inheritDoc
         *
-        * @since 1.22
-        * @param IContextSource $context
-        * @return array
+        * Build different messages for autoblocks and partial blocks.
         */
        public function getPermissionsError( IContextSource $context ) {
                $params = $this->getBlockErrorParams( $context );
 
                $msg = 'blockedtext';
-               if ( $this->getSystemBlockType() !== null ) {
-                       $msg = 'systemblockedtext';
-               } elseif ( $this->mAuto ) {
+               if ( $this->mAuto ) {
                        $msg = 'autoblockedtext';
                } elseif ( !$this->isSitewide() ) {
                        $msg = 'blockedtext-partial';
@@ -1890,45 +1432,6 @@ class Block {
                return $params;
        }
 
-       /**
-        * Get block information used in different block error messages
-        *
-        * @since 1.33
-        * @param IContextSource $context
-        * @return array
-        */
-       public function getBlockErrorParams( IContextSource $context ) {
-               $blocker = $this->getBlocker();
-               if ( $blocker instanceof User ) { // local user
-                       $blockerUserpage = $blocker->getUserPage();
-                       $link = "[[{$blockerUserpage->getPrefixedText()}|{$blockerUserpage->getText()}]]";
-               } else { // foreign user
-                       $link = $blocker;
-               }
-
-               $reason = $this->getReason();
-               if ( $reason == '' ) {
-                       $reason = $context->msg( 'blockednoreason' )->text();
-               }
-
-               /* $ip returns who *is* being blocked, $intended contains who was meant to be blocked.
-                * This could be a username, an IP range, or a single IP. */
-               $intended = $this->getTarget();
-               $systemBlockType = $this->getSystemBlockType();
-               $lang = $context->getLanguage();
-
-               return [
-                       $link,
-                       $reason,
-                       $context->getRequest()->getIP(),
-                       $this->getByName(),
-                       $systemBlockType ?? $this->getId(),
-                       $lang->formatExpiry( $this->getExpiry() ),
-                       (string)$intended,
-                       $lang->userTimeAndDate( $this->getTimestamp(), $context->getUser() ),
-               ];
-       }
-
        /**
         * Get Restrictions.
         *
@@ -1967,76 +1470,7 @@ class Block {
        }
 
        /**
-        * Determine whether the block allows the user to edit their own
-        * user talk page. This is done separately from Block::appliesToRight
-        * because there is no right for editing one's own user talk page
-        * and because the user's talk page needs to be passed into the
-        * Block object, which is unaware of the user.
-        *
-        * The ipb_allow_usertalk flag (which corresponds to the property
-        * allowUsertalk) is used on sitewide blocks and partial blocks
-        * that contain a namespace restriction on the user talk namespace,
-        * but do not contain a page restriction on the user's talk page.
-        * For all other (i.e. most) partial blocks, the flag is ignored,
-        * and the user can always edit their user talk page unless there
-        * is a page restriction on their user talk page, in which case
-        * they can never edit it. (Ideally the flag would be stored as
-        * null in these cases, but the database field isn't nullable.)
-        *
-        * This method does not validate that the passed in talk page belongs to the
-        * block target since the target (an IP) might not be the same as the user's
-        * talk page (if they are logged in).
-        *
-        * @since 1.33
-        * @param Title|null $usertalk The user's user talk page. If null,
-        *  and if the target is a User, the target's userpage is used
-        * @return bool The user can edit their talk page
-        */
-       public function appliesToUsertalk( Title $usertalk = null ) {
-               if ( !$usertalk ) {
-                       if ( $this->target instanceof User ) {
-                               $usertalk = $this->target->getTalkPage();
-                       } else {
-                               throw new InvalidArgumentException(
-                                       '$usertalk must be provided if block target is not a user/IP'
-                               );
-                       }
-               }
-
-               if ( $usertalk->getNamespace() !== NS_USER_TALK ) {
-                       throw new InvalidArgumentException(
-                               '$usertalk must be a user talk page'
-                       );
-               }
-
-               if ( !$this->isSitewide() ) {
-                       if ( $this->appliesToPage( $usertalk->getArticleID() ) ) {
-                               return true;
-                       }
-                       if ( !$this->appliesToNamespace( NS_USER_TALK ) ) {
-                               return false;
-                       }
-               }
-
-               // This is a type of block which uses the ipb_allow_usertalk
-               // flag. The flag can still be overridden by global configs.
-               $config = RequestContext::getMain()->getConfig();
-               if ( !$config->get( 'BlockAllowsUTEdit' ) ) {
-                       return true;
-               }
-               return !$this->isUsertalkEditAllowed();
-       }
-
-       /**
-        * Checks if a block applies to a particular title
-        *
-        * This check does not consider whether `$this->isUsertalkEditAllowed`
-        * returns false, as the identity of the user making the hypothetical edit
-        * isn't known here (particularly in the case of IP hardblocks, range
-        * blocks, and auto-blocks).
-        *
-        * @param Title $title
-        * @return bool
+        * @inheritDoc
         */
        public function appliesToTitle( Title $title ) {
                if ( $this->isSitewide() ) {
@@ -2054,12 +1488,7 @@ class Block {
        }
 
        /**
-        * Checks if a block applies to a particular namespace
-        *
-        * @since 1.33
-        *
-        * @param int $ns
-        * @return bool
+        * @inheritDoc
         */
        public function appliesToNamespace( $ns ) {
                if ( $this->isSitewide() ) {
@@ -2077,17 +1506,7 @@ class Block {
        }
 
        /**
-        * Checks if a block applies to a particular page
-        *
-        * This check does not consider whether `$this->isUsertalkEditAllowed`
-        * returns false, as the identity of the user making the hypothetical edit
-        * isn't known here (particularly in the case of IP hardblocks, range
-        * blocks, and auto-blocks).
-        *
-        * @since 1.33
-        *
-        * @param int $pageId
-        * @return bool
+        * @inheritDoc
         */
        public function appliesToPage( $pageId ) {
                if ( $this->isSitewide() ) {
@@ -2127,11 +1546,7 @@ class Block {
        }
 
        /**
-        * Check if the block should be tracked with a cookie.
-        *
-        * @since 1.33
-        * @param bool $isAnon The user is logged out
-        * @return bool The block should be tracked with a cookie
+        * @inheritDoc
         */
        public function shouldTrackWithCookie( $isAnon ) {
                $config = RequestContext::getMain()->getConfig();
@@ -2146,27 +1561,6 @@ class Block {
                }
        }
 
-       /**
-        * Check if the block prevents a user from resetting their password
-        *
-        * @since 1.33
-        * @return bool The block blocks password reset
-        */
-       public function appliesToPasswordReset() {
-               switch ( $this->getSystemBlockType() ) {
-                       case null:
-                       case 'global-block':
-                               return $this->isCreateAccountBlocked();
-                       case 'proxy':
-                               return true;
-                       case 'dnsbl':
-                       case 'wgSoftBlockRanges':
-                               return false;
-                       default:
-                               return true;
-               }
-       }
-
        /**
         * Get a BlockRestrictionStore instance
         *
index 4ba1836..33230c8 100644 (file)
@@ -2563,26 +2563,35 @@ $wgUseLocalMessageCache = false;
 $wgAdaptiveMessageCache = false;
 
 /**
- * Localisation cache configuration. Associative array with keys:
- * class:       The class to use. May be overridden by extensions.
- *
- * store:       The location to store cache data. May be 'files', 'array', 'db' or
- *              'detect'. If set to "files", data will be in CDB files. If set
- *              to "db", data will be stored to the database. If set to
- *              "detect", files will be used if $wgCacheDirectory is set,
- *              otherwise the database will be used.
- *              "array" is an experimental option that uses PHP files that
- *              store static arrays.
- *
- * storeClass:  The class name for the underlying storage. If set to a class
- *              name, it overrides the "store" setting.
- *
- * storeDirectory:  If the store class puts its data in files, this is the
- *                  directory it will use. If this is false, $wgCacheDirectory
- *                  will be used.
- *
- * manualRecache:   Set this to true to disable cache updates on web requests.
- *                  Use maintenance/rebuildLocalisationCache.php instead.
+ * Localisation cache configuration.
+ *
+ * Used by Language::getLocalisationCache() to decide how to construct the
+ * LocalisationCache instance. Associative array with keys:
+ *
+ * class:       The class to use for constructing the LocalisationCache object.
+ *              This may be overridden by extensions to a subclass of LocalisationCache.
+ *              Sub classes are expected to still honor the 'storeClass', 'storeDirectory'
+ *              and 'manualRecache' options where applicable.
+ *
+ * storeClass:  Which LCStore class implementation to use. This is optional.
+ *              The default LocalisationCache class offers the 'store' option
+ *              as abstraction for this.
+ *
+ * store:       How and where to store localisation cache data.
+ *              This option is ignored if 'storeClass' is explicitly set to a class name.
+ *              Must be one of:
+ *              - 'detect' (default): Automatically select 'files' if 'storeDirectory'
+ *                 or $wgCacheDirectory is set, and fall back to 'db' otherwise.
+ *              - 'files': Store in $wgCacheDirectory as CDB files.
+ *              - 'array': Store in $wgCacheDirectory as PHP static array files.
+ *              - 'db': Store in the l10n_cache database table.
+ *
+ * storeDirectory: If the selected LCStore class puts its data in files, then it
+ *                 will use this directory. If set to false (default), then
+ *                 $wgCacheDirectory is used instead.
+ *
+ * manualRecache: Set this to true to disable cache updates on web requests.
+ *                Use maintenance/rebuildLocalisationCache.php instead.
  */
 $wgLocalisationCacheConf = [
        'class' => LocalisationCache::class,
index 1d9ff05..2d5b9e2 100644 (file)
@@ -2609,7 +2609,8 @@ ERROR;
                                LogEventsList::showLogExtract(
                                        $out,
                                        'block',
-                                       MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget(),
+                                       MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                               getCanonicalName( NS_USER ) . ':' . $block->getTarget(),
                                        '',
                                        [
                                                'lim' => 1,
@@ -4451,7 +4452,9 @@ ERROR;
        protected function addPageProtectionWarningHeaders() {
                $out = $this->context->getOutput();
                if ( $this->mTitle->isProtected( 'edit' ) &&
-                       MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace() ) !== [ '' ]
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels(
+                               $this->mTitle->getNamespace()
+                       ) !== [ '' ]
                ) {
                        # Is the title semi-protected?
                        if ( $this->mTitle->isSemiProtected() ) {
index 6acfda3..ff4c786 100644 (file)
@@ -191,7 +191,7 @@ class Linker {
         */
        public static function getInvalidTitleDescription( IContextSource $context, $namespace, $title ) {
                // First we check whether the namespace exists or not.
-               if ( MWNamespace::exists( $namespace ) ) {
+               if ( MediaWikiServices::getInstance()->getNamespaceInfo()->exists( $namespace ) ) {
                        if ( $namespace == NS_MAIN ) {
                                $name = $context->msg( 'blanknamespace' )->text();
                        } else {
@@ -1302,7 +1302,12 @@ class Linker {
                                ([^[]*) # 3. link trail (the text up until the next link)
                        /x',
                        function ( $match ) use ( $title, $local, $wikiId ) {
-                               $medians = '(?:' . preg_quote( MWNamespace::getCanonicalName( NS_MEDIA ), '/' ) . '|';
+                               $services = MediaWikiServices::getInstance();
+
+                               $medians = '(?:';
+                               $medians .= preg_quote(
+                                       $services->getNamespaceInfo()->getCanonicalName( NS_MEDIA ), '/' );
+                               $medians .= '|';
                                $medians .= preg_quote(
                                        MediaWikiServices::getInstance()->getContentLanguage()->getNsText( NS_MEDIA ),
                                        '/'
@@ -1410,8 +1415,9 @@ class Linker {
                                        $wikiId,
                                        $linkTarget->getNamespace() === 0
                                                ? $linkTarget->getDBkey()
-                                               : MWNamespace::getCanonicalName( $linkTarget->getNamespace() ) . ':'
-                                                       . $linkTarget->getDBkey(),
+                                               : MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                                       getCanonicalName( $linkTarget->getNamespace() ) .
+                                                       ':' . $linkTarget->getDBkey(),
                                        $linkTarget->getFragment()
                                ),
                                $text,
@@ -1446,7 +1452,10 @@ class Linker {
 
                # Some namespaces don't allow subpages,
                # so only perform processing if subpages are allowed
-               if ( $contextTitle && MWNamespace::hasSubpages( $contextTitle->getNamespace() ) ) {
+               if (
+                       $contextTitle && MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       hasSubpages( $contextTitle->getNamespace() )
+               ) {
                        $hash = strpos( $target, '#' );
                        if ( $hash !== false ) {
                                $suffix = substr( $target, $hash );
index e49398a..004ca07 100644 (file)
@@ -327,7 +327,8 @@ class MovePage {
                        [ 'cl_from' => $pageid ],
                        __METHOD__
                );
-               $type = MediaWikiServices::getInstance()->getNamespaceInfo()->
+               $services = MediaWikiServices::getInstance();
+               $type = $services->getNamespaceInfo()->
                        getCategoryLinkType( $this->newTitle->getNamespace() );
                foreach ( $prefixes as $prefixRow ) {
                        $prefix = $prefixRow->cl_sortkey_prefix;
@@ -428,11 +429,13 @@ class MovePage {
                # Update watchlists
                $oldtitle = $this->oldTitle->getDBkey();
                $newtitle = $this->newTitle->getDBkey();
-               $oldsnamespace = MWNamespace::getSubject( $this->oldTitle->getNamespace() );
-               $newsnamespace = MWNamespace::getSubject( $this->newTitle->getNamespace() );
+               $oldsnamespace = $services->getNamespaceInfo()->
+                       getSubject( $this->oldTitle->getNamespace() );
+               $newsnamespace = $services->getNamespaceInfo()->
+                       getSubject( $this->newTitle->getNamespace() );
                if ( $oldsnamespace != $newsnamespace || $oldtitle != $newtitle ) {
-                       $store = MediaWikiServices::getInstance()->getWatchedItemStore();
-                       $store->duplicateAllAssociatedEntries( $this->oldTitle, $this->newTitle );
+                       $services->getWatchedItemStore()->duplicateAllAssociatedEntries(
+                               $this->oldTitle, $this->newTitle );
                }
 
                // If it is a file then move it last.
index 3e91fb3..56e2370 100644 (file)
@@ -3430,8 +3430,9 @@ class OutputPage extends ContextSource {
 
                $title = $this->getTitle();
                $ns = $title->getNamespace();
-               $canonicalNamespace = MWNamespace::exists( $ns )
-                       ? MWNamespace::getCanonicalName( $ns )
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
+               $canonicalNamespace = $nsInfo->exists( $ns )
+                       ? $nsInfo->getCanonicalName( $ns )
                        : $title->getNsText();
 
                $sk = $this->getSkin();
index 7972a1e..2f10598 100644 (file)
@@ -90,7 +90,7 @@ class ProtectionForm {
         * Loads the current state of protection into the object.
         */
        function loadData() {
-               $levels = MWNamespace::getRestrictionLevels(
+               $levels = MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels(
                        $this->mTitle->getNamespace(), $this->mContext->getUser()
                );
                $this->mCascade = $this->mTitle->areRestrictionsCascading();
@@ -179,7 +179,11 @@ class ProtectionForm {
         * Main entry point for action=protect and action=unprotect
         */
        function execute() {
-               if ( MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace() ) === [ '' ] ) {
+               if (
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels(
+                               $this->mTitle->getNamespace()
+                       ) === [ '' ]
+               ) {
                        throw new ErrorPageError( 'protect-badnamespace-title', 'protect-badnamespace-text' );
                }
 
@@ -581,7 +585,8 @@ class ProtectionForm {
        function buildSelector( $action, $selected ) {
                // If the form is disabled, display all relevant levels. Otherwise,
                // just show the ones this user can use.
-               $levels = MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace(),
+               $levels = MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels(
+                       $this->mTitle->getNamespace(),
                        $this->disabled ? null : $this->mContext->getUser()
                );
 
index 8adb218..e97db2d 100644 (file)
@@ -68,15 +68,15 @@ class SiteStatsInit {
         * @return int
         */
        public function articles() {
-               $config = MediaWikiServices::getInstance()->getMainConfig();
+               $services = MediaWikiServices::getInstance();
 
                $tables = [ 'page' ];
                $conds = [
-                       'page_namespace' => MWNamespace::getContentNamespaces(),
+                       'page_namespace' => $services->getNamespaceInfo()->getContentNamespaces(),
                        'page_is_redirect' => 0,
                ];
 
-               if ( $config->get( 'ArticleCountMethod' ) == 'link' ) {
+               if ( $services->getMainConfig()->get( 'ArticleCountMethod' ) == 'link' ) {
                        $tables[] = 'pagelinks';
                        $conds[] = 'pl_from=page_id';
                }
index ad6c167..866f041 100644 (file)
@@ -618,7 +618,7 @@ class Title implements LinkTarget, IDBAccessObject {
                // NOTE: ideally, this would just call makeTitle() and then isValid(),
                // but presently, that means more overhead on a potential performance hotspot.
 
-               if ( !MWNamespace::exists( $ns ) ) {
+               if ( !MediaWikiServices::getInstance()->getNamespaceInfo()->exists( $ns ) ) {
                        return null;
                }
 
@@ -820,7 +820,8 @@ class Title implements LinkTarget, IDBAccessObject {
                $canonicalNamespace = false
        ) {
                if ( $canonicalNamespace ) {
-                       $namespace = MWNamespace::getCanonicalName( $ns );
+                       $namespace = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               getCanonicalName( $ns );
                } else {
                        $namespace = MediaWikiServices::getInstance()->getContentLanguage()->getNsText( $ns );
                }
@@ -862,13 +863,13 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return bool
         */
        public function isValid() {
-               if ( !MWNamespace::exists( $this->mNamespace ) ) {
+               $services = MediaWikiServices::getInstance();
+               if ( !$services->getNamespaceInfo()->exists( $this->mNamespace ) ) {
                        return false;
                }
 
                try {
-                       $parser = MediaWikiServices::getInstance()->getTitleParser();
-                       $parser->parseTitle( $this->mDbkeyform, $this->mNamespace );
+                       $services->getTitleParser()->parseTitle( $this->mDbkeyform, $this->mNamespace );
                        return true;
                } catch ( MalformedTitleException $ex ) {
                        return false;
@@ -1086,7 +1087,8 @@ class Title implements LinkTarget, IDBAccessObject {
                if ( $this->isExternal() ) {
                        // This probably shouldn't even happen, except for interwiki transclusion.
                        // If possible, use the canonical name for the foreign namespace.
-                       $nsText = MWNamespace::getCanonicalName( $this->mNamespace );
+                       $nsText = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               getCanonicalName( $this->mNamespace );
                        if ( $nsText !== false ) {
                                return $nsText;
                        }
@@ -1107,8 +1109,9 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return string Namespace text
         */
        public function getSubjectNsText() {
-               return MediaWikiServices::getInstance()->getContentLanguage()->
-                       getNsText( MWNamespace::getSubject( $this->mNamespace ) );
+               $services = MediaWikiServices::getInstance();
+               return $services->getContentLanguage()->
+                       getNsText( $services->getNamespaceInfo()->getSubject( $this->mNamespace ) );
        }
 
        /**
@@ -1117,20 +1120,22 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return string Namespace text
         */
        public function getTalkNsText() {
-               return MediaWikiServices::getInstance()->getContentLanguage()->
-                       getNsText( MWNamespace::getTalk( $this->mNamespace ) );
+               $services = MediaWikiServices::getInstance();
+               return $services->getContentLanguage()->
+                       getNsText( $services->getNamespaceInfo()->getTalk( $this->mNamespace ) );
        }
 
        /**
         * Can this title have a corresponding talk page?
         *
-        * @see MWNamespace::hasTalkNamespace
+        * @see NamespaceInfo::hasTalkNamespace
         * @since 1.30
         *
         * @return bool True if this title either is a talk page or can have a talk page associated.
         */
        public function canHaveTalkPage() {
-               return MWNamespace::hasTalkNamespace( $this->mNamespace );
+               return MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       hasTalkNamespace( $this->mNamespace );
        }
 
        /**
@@ -1148,7 +1153,8 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return bool
         */
        public function isWatchable() {
-               return !$this->isExternal() && MWNamespace::isWatchable( $this->mNamespace );
+               return !$this->isExternal() && MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       isWatchable( $this->mNamespace );
        }
 
        /**
@@ -1209,7 +1215,8 @@ class Title implements LinkTarget, IDBAccessObject {
         * @since 1.19
         */
        public function inNamespace( $ns ) {
-               return MWNamespace::equals( $this->mNamespace, $ns );
+               return MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       equals( $this->mNamespace, $ns );
        }
 
        /**
@@ -1248,7 +1255,8 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return bool
         */
        public function hasSubjectNamespace( $ns ) {
-               return MWNamespace::subjectEquals( $this->mNamespace, $ns );
+               return MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       subjectEquals( $this->mNamespace, $ns );
        }
 
        /**
@@ -1259,7 +1267,8 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return bool
         */
        public function isContentPage() {
-               return MWNamespace::isContent( $this->mNamespace );
+               return MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       isContent( $this->mNamespace );
        }
 
        /**
@@ -1269,7 +1278,10 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return bool
         */
        public function isMovable() {
-               if ( !MWNamespace::isMovable( $this->mNamespace ) || $this->isExternal() ) {
+               if (
+                       !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               isMovable( $this->mNamespace ) || $this->isExternal()
+               ) {
                        // Interwiki title or immovable namespace. Hooks don't get to override here
                        return false;
                }
@@ -1299,7 +1311,8 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return bool
         */
        public function isSubpage() {
-               return MWNamespace::hasSubpages( $this->mNamespace )
+               return MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       hasSubpages( $this->mNamespace )
                        ? strpos( $this->getText(), '/' ) !== false
                        : false;
        }
@@ -1495,7 +1508,8 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return bool
         */
        public function isTalkPage() {
-               return MWNamespace::isTalk( $this->mNamespace );
+               return MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       isTalk( $this->mNamespace );
        }
 
        /**
@@ -1724,7 +1738,10 @@ class Title implements LinkTarget, IDBAccessObject {
         * @since 1.20
         */
        public function getRootText() {
-               if ( !MWNamespace::hasSubpages( $this->mNamespace ) ) {
+               if (
+                       !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $this->mNamespace )
+               ) {
                        return $this->getText();
                }
 
@@ -1760,7 +1777,10 @@ class Title implements LinkTarget, IDBAccessObject {
         */
        public function getBaseText() {
                $text = $this->getText();
-               if ( !MWNamespace::hasSubpages( $this->mNamespace ) ) {
+               if (
+                       !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $this->mNamespace )
+               ) {
                        return $text;
                }
 
@@ -1801,7 +1821,10 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return string Subpage name
         */
        public function getSubpageText() {
-               if ( !MWNamespace::hasSubpages( $this->mNamespace ) ) {
+               if (
+                       !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $this->mNamespace )
+               ) {
                        return $this->mTextform;
                }
                $parts = explode( '/', $this->mTextform );
@@ -2868,7 +2891,10 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return bool
         */
        public function hasSubpages() {
-               if ( !MWNamespace::hasSubpages( $this->mNamespace ) ) {
+               if (
+                       !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $this->mNamespace )
+               ) {
                        # Duh
                        return false;
                }
@@ -2896,7 +2922,10 @@ class Title implements LinkTarget, IDBAccessObject {
         *  doesn't allow subpages
         */
        public function getSubpages( $limit = -1 ) {
-               if ( !MWNamespace::hasSubpages( $this->mNamespace ) ) {
+               if (
+                       !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $this->mNamespace )
+               ) {
                        return [];
                }
 
@@ -3130,7 +3159,8 @@ class Title implements LinkTarget, IDBAccessObject {
         * @return string Containing capitalized title
         */
        public static function capitalize( $text, $ns = NS_MAIN ) {
-               if ( MWNamespace::isCapitalized( $ns ) ) {
+               $services = MediaWikiServices::getInstance();
+               if ( $services->getNamespaceInfo()->isCapitalized( $ns ) ) {
                        return MediaWikiServices::getInstance()->getContentLanguage()->ucfirst( $text );
                } else {
                        return $text;
@@ -3472,14 +3502,15 @@ class Title implements LinkTarget, IDBAccessObject {
                        ];
                }
                // Do the source and target namespaces support subpages?
-               if ( !MWNamespace::hasSubpages( $this->mNamespace ) ) {
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
+               if ( !$nsInfo->hasSubpages( $this->mNamespace ) ) {
                        return [
-                               [ 'namespace-nosubpages', MWNamespace::getCanonicalName( $this->mNamespace ) ],
+                               [ 'namespace-nosubpages', $nsInfo->getCanonicalName( $this->mNamespace ) ],
                        ];
                }
-               if ( !MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
+               if ( !$nsInfo->hasSubpages( $nt->getNamespace() ) ) {
                        return [
-                               [ 'namespace-nosubpages', MWNamespace::getCanonicalName( $nt->getNamespace() ) ],
+                               [ 'namespace-nosubpages', $nsInfo->getCanonicalName( $nt->getNamespace() ) ],
                        ];
                }
 
@@ -4293,9 +4324,10 @@ class Title implements LinkTarget, IDBAccessObject {
         */
        public function getNamespaceKey( $prepend = 'nstab-' ) {
                // Gets the subject namespace of this title
-               $subjectNS = MWNamespace::getSubject( $this->mNamespace );
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
+               $subjectNS = $nsInfo->getSubject( $this->mNamespace );
                // Prefer canonical namespace name for HTML IDs
-               $namespaceKey = MWNamespace::getCanonicalName( $subjectNS );
+               $namespaceKey = $nsInfo->getCanonicalName( $subjectNS );
                if ( $namespaceKey === false ) {
                        // Fallback to localised text
                        $namespaceKey = $this->getSubjectNsText();
@@ -4391,7 +4423,8 @@ class Title implements LinkTarget, IDBAccessObject {
        public function canUseNoindex() {
                global $wgExemptFromUserRobotsControl;
 
-               $bannedNamespaces = $wgExemptFromUserRobotsControl ?? MWNamespace::getContentNamespaces();
+               $bannedNamespaces = $wgExemptFromUserRobotsControl ??
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces();
 
                return !in_array( $this->mNamespace, $bannedNamespaces );
        }
@@ -4558,7 +4591,10 @@ class Title implements LinkTarget, IDBAccessObject {
                        }
                }
 
-               if ( MWNamespace::hasSubpages( $this->mNamespace ) ) {
+               if (
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $this->mNamespace )
+               ) {
                        // Optional notice for page itself and any parent page
                        $editnotice_base = $editnotice_ns;
                        foreach ( explode( '/', $this->mDbkeyform ) as $part ) {
index b3a49c7..ebdbc42 100644 (file)
@@ -19,6 +19,8 @@
  * @ingroup Categories
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * This class performs some operations related to tracking categories, such as creating
  * a list of all such categories.
@@ -80,6 +82,7 @@ class TrackingCategories {
                }
 
                $trackingCategories = [];
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
                foreach ( $categories as $catMsg ) {
                        /*
                         * Check if the tracking category varies by namespace
@@ -96,7 +99,7 @@ class TrackingCategories {
                        // Match things like {{NAMESPACE}} and {{NAMESPACENUMBER}}.
                        // False positives are ok, this is just an efficiency shortcut
                        if ( strpos( $msgObj->plain(), '{{' ) !== false ) {
-                               $ns = MWNamespace::getValidNamespaces();
+                               $ns = $nsInfo->getValidNamespaces();
                                foreach ( $ns as $namesp ) {
                                        $tempTitle = Title::makeTitleSafe( $namesp, $catMsg );
                                        if ( !$tempTitle ) {
index 2a03d2d..7da092f 100644 (file)
@@ -849,12 +849,19 @@ class WebRequest {
         * in HTML or other output.
         *
         * If $wgServer is protocol-relative, this will return a fully
-        * qualified URL with the protocol that was used for this request.
+        * qualified URL with the protocol of this request object.
         *
         * @return string
         */
        public function getFullRequestURL() {
-               return wfGetServerUrl( PROTO_CURRENT ) . $this->getRequestURL();
+               // Pass an explicit PROTO constant instead of PROTO_CURRENT so that we
+               // do not rely on state from the global $wgRequest object (which it would,
+               // via wfGetServerUrl/wfExpandUrl/$wgRequest->protocol).
+               if ( $this->getProtocol() === 'http' ) {
+                       return wfGetServerUrl( PROTO_HTTP ) . $this->getRequestURL();
+               } else {
+                       return wfGetServerUrl( PROTO_HTTPS ) . $this->getRequestURL();
+               }
        }
 
        /**
index 8b000f2..23b0e3e 100644 (file)
@@ -221,19 +221,29 @@ class WikiMap {
         * @since 1.30
         */
        public static function getWikiFromUrl( $url ) {
+               global $wgCanonicalServer;
+
+               if ( strpos( $url, "$wgCanonicalServer/" ) === 0 ) {
+                       // Optimisation: Handle the the common case.
+                       // (Duplicates self::getCanonicalServerInfoForAllWikis)
+                       return self::getWikiIdFromDbDomain( self::getCurrentWikiDbDomain() );
+               }
+
                $urlPartsCheck = wfParseUrl( $url );
                if ( $urlPartsCheck === false ) {
                        return false;
                }
 
-               $urlPartsCheck = array_intersect_key( $urlPartsCheck, [ 'host' => 1, 'port' => 1 ] );
+               static $relevantKeys = [ 'host' => 1, 'port' => 1 ];
+               $urlPartsCheck = array_intersect_key( $urlPartsCheck, $relevantKeys );
+
                foreach ( self::getCanonicalServerInfoForAllWikis() as $wikiId => $info ) {
                        $urlParts = $info['parts'];
                        if ( $urlParts === false ) {
                                continue; // sanity
                        }
 
-                       $urlParts = array_intersect_key( $urlParts, [ 'host' => 1, 'port' => 1 ] );
+                       $urlParts = array_intersect_key( $urlParts, $relevantKeys );
                        if ( $urlParts == $urlPartsCheck ) {
                                return $wikiId;
                        }
index 49a6bb5..bfba59a 100644 (file)
@@ -399,7 +399,7 @@ class InfoAction extends FormlessAction {
                }
 
                // Subpages of this page, if subpages are enabled for the current NS
-               if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+               if ( $services->getNamespaceInfo()->hasSubpages( $title->getNamespace() ) ) {
                        $prefixIndex = SpecialPage::getTitleFor(
                                'Prefixindex', $title->getPrefixedText() . '/' );
                        $pageInfo['header-basic'][] = [
@@ -730,12 +730,13 @@ class InfoAction extends FormlessAction {
        protected function pageCounts( Page $page ) {
                $fname = __METHOD__;
                $config = $this->context->getConfig();
-               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+               $services = MediaWikiServices::getInstance();
+               $cache = $services->getMainWANObjectCache();
 
                return $cache->getWithSetCallback(
                        self::getCacheKey( $cache, $page->getTitle(), $page->getLatest() ),
                        WANObjectCache::TTL_WEEK,
-                       function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname ) {
+                       function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname, $services ) {
                                global $wgActorTableSchemaMigrationStage;
 
                                $title = $page->getTitle();
@@ -759,7 +760,7 @@ class InfoAction extends FormlessAction {
                                        $joins = [];
                                }
 
-                               $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
+                               $watchedItemStore = $services->getWatchedItemStore();
 
                                $result = [];
                                $result['watchers'] = $watchedItemStore->countWatchers( $title );
@@ -824,7 +825,7 @@ class InfoAction extends FormlessAction {
                                );
 
                                // Subpages (if enabled)
-                               if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+                               if ( $services->getNamespaceInfo()->hasSubpages( $title->getNamespace() ) ) {
                                        $conds = [ 'page_namespace' => $title->getNamespace() ];
                                        $conds[] = 'page_title ' .
                                                $dbr->buildLike( $title->getDBkey() . '/', $dbr->anyString() );
index 19d84f7..bc62906 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use MediaWiki\Block\AbstractBlock;
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\IDatabase;
 
 /**
@@ -1198,7 +1200,8 @@ abstract class ApiBase extends ContextSource {
                        $provided = $this->getMain()->getCheck( $encParamName );
 
                        if ( isset( $value ) && $type == 'namespace' ) {
-                               $type = MWNamespace::getValidNamespaces();
+                               $type = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                       getValidNamespaces();
                                if ( isset( $paramSettings[self::PARAM_EXTRA_NAMESPACES] ) &&
                                        is_array( $paramSettings[self::PARAM_EXTRA_NAMESPACES] )
                                ) {
@@ -2029,7 +2032,7 @@ abstract class ApiBase extends ContextSource {
         * @param Block $block The block used to generate the ApiUsageException
         * @throws ApiUsageException always
         */
-       public function dieBlocked( Block $block ) {
+       public function dieBlocked( AbstractBlock $block ) {
                // Die using the appropriate message depending on block type
                if ( $block->getType() == Block::TYPE_AUTO ) {
                        $this->dieWithError(
index 2663485..51da835 100644 (file)
@@ -18,6 +18,9 @@
  * @file
  */
 
+use MediaWiki\Block\AbstractBlock;
+use MediaWiki\Block\SystemBlock;
+
 /**
  * @ingroup API
  */
@@ -35,7 +38,7 @@ trait ApiBlockInfoTrait {
         *  - blockexpiry - expiry time of the block
         *  - systemblocktype - system block type, if any
         */
-       private function getBlockInfo( Block $block ) {
+       private function getBlockInfo( AbstractBlock $block ) {
                $vals = [];
                $vals['blockid'] = $block->getId();
                $vals['blockedby'] = $block->getByName();
@@ -44,7 +47,7 @@ trait ApiBlockInfoTrait {
                $vals['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $block->getTimestamp() );
                $vals['blockexpiry'] = ApiResult::formatExpiry( $block->getExpiry(), 'infinite' );
                $vals['blockpartial'] = !$block->isSitewide();
-               if ( $block->getSystemBlockType() !== null ) {
+               if ( $block instanceof SystemBlock ) {
                        $vals['systemblocktype'] = $block->getSystemBlockType();
                }
                return $vals;
index 1656e7c..78efe41 100644 (file)
@@ -583,7 +583,8 @@ class ApiHelp extends ApiBase {
                                                                        break;
 
                                                                case 'namespace':
-                                                                       $namespaces = MWNamespace::getValidNamespaces();
+                                                                       $namespaces = MediaWikiServices::getInstance()->
+                                                                               getNamespaceInfo()->getValidNamespaces();
                                                                        if ( isset( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] ) &&
                                                                                is_array( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] )
                                                                        ) {
index b321c7d..64c6f45 100644 (file)
@@ -866,6 +866,8 @@ class ApiPageSet extends ApiBase {
                        ApiBase::dieDebug( __METHOD__, 'Missing $processTitles parameter when $remaining is provided' );
                }
 
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
+
                $usernames = [];
                if ( $res ) {
                        foreach ( $res as $row ) {
@@ -884,7 +886,7 @@ class ApiPageSet extends ApiBase {
                                $this->processDbRow( $row );
 
                                // Need gender information
-                               if ( MWNamespace::hasGenderDistinction( $row->page_namespace ) ) {
+                               if ( $nsInfo->hasGenderDistinction( $row->page_namespace ) ) {
                                        $usernames[] = $row->page_title;
                                }
                        }
@@ -907,7 +909,7 @@ class ApiPageSet extends ApiBase {
                                                $this->mTitles[] = $title;
 
                                                // need gender information
-                                               if ( MWNamespace::hasGenderDistinction( $ns ) ) {
+                                               if ( $nsInfo->hasGenderDistinction( $ns ) ) {
                                                        $usernames[] = $dbkey;
                                                }
                                        }
@@ -1249,7 +1251,10 @@ class ApiPageSet extends ApiBase {
                        }
 
                        // Need gender information
-                       if ( MWNamespace::hasGenderDistinction( $titleObj->getNamespace() ) ) {
+                       if (
+                               MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                       hasGenderDistinction( $titleObj->getNamespace() )
+                       ) {
                                $usernames[] = $titleObj->getText();
                        }
                }
index bb50185..beaad43 100644 (file)
@@ -49,7 +49,8 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
                $user = $this->getUser();
                $db = $this->getDB();
                $params = $this->extractRequestParams( false );
-               $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
+               $services = MediaWikiServices::getInstance();
+               $revisionStore = $services->getRevisionStore();
 
                $result = $this->getResult();
 
@@ -156,7 +157,8 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
                $miser_ns = null;
 
                if ( $mode == 'all' ) {
-                       $namespaces = $params['namespace'] ?? MWNamespace::getValidNamespaces();
+                       $namespaces = $params['namespace'] ??
+                               $services->getNamespaceInfo()->getValidNamespaces();
                        $this->addWhereFld( 'ar_namespace', $namespaces );
 
                        // For from/to/prefix, we have to consider the potential
index 1940600..08f3ea3 100644 (file)
@@ -211,12 +211,13 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                $res = $this->select( __METHOD__ );
 
                // Get gender information
-               if ( MWNamespace::hasGenderDistinction( $params['namespace'] ) ) {
+               $services = MediaWikiServices::getInstance();
+               if ( $services->getNamespaceInfo()->hasGenderDistinction( $params['namespace'] ) ) {
                        $users = [];
                        foreach ( $res as $row ) {
                                $users[] = $row->page_title;
                        }
-                       MediaWikiServices::getInstance()->getGenderCache()->doQuery( $users, __METHOD__ );
+                       $services->getGenderCache()->doQuery( $users, __METHOD__ );
                        $res->rewind(); // reset
                }
 
index 58445a1..050bc0f 100644 (file)
@@ -44,7 +44,8 @@ class ApiQueryAllRevisions extends ApiQueryRevisionsBase {
 
                $db = $this->getDB();
                $params = $this->extractRequestParams( false );
-               $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
+               $services = MediaWikiServices::getInstance();
+               $revisionStore = $services->getRevisionStore();
 
                $result = $this->getResult();
 
@@ -70,7 +71,7 @@ class ApiQueryAllRevisions extends ApiQueryRevisionsBase {
                if ( $params['namespace'] !== null ) {
                        $params['namespace'] = array_unique( $params['namespace'] );
                        sort( $params['namespace'] );
-                       if ( $params['namespace'] != MWNamespace::getValidNamespaces() ) {
+                       if ( $params['namespace'] != $services->getNamespaceInfo()->getValidNamespaces() ) {
                                $needPageTable = true;
                                if ( $this->getConfig()->get( 'MiserMode' ) ) {
                                        $miser_ns = $params['namespace'];
index a5437ba..276aafb 100644 (file)
@@ -708,10 +708,11 @@ class ApiQueryInfo extends ApiQueryBase {
         */
        private function getTSIDs() {
                $getTitles = $this->talkids = $this->subjectids = [];
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
 
                /** @var Title $t */
                foreach ( $this->everything as $t ) {
-                       if ( MWNamespace::isTalk( $t->getNamespace() ) ) {
+                       if ( $nsInfo->isTalk( $t->getNamespace() ) ) {
                                if ( $this->fld_subjectid ) {
                                        $getTitles[] = $t->getSubjectPage();
                                }
@@ -734,12 +735,12 @@ class ApiQueryInfo extends ApiQueryBase {
                $this->addWhere( $lb->constructSet( 'page', $db ) );
                $res = $this->select( __METHOD__ );
                foreach ( $res as $row ) {
-                       if ( MWNamespace::isTalk( $row->page_namespace ) ) {
-                               $this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] =
-                                       (int)$row->page_id;
+                       if ( $nsInfo->isTalk( $row->page_namespace ) ) {
+                               $this->talkids[$nsInfo->getSubject( $row->page_namespace )][$row->page_title] =
+                                       (int)( $row->page_id );
                        } else {
-                               $this->subjectids[MWNamespace::getTalk( $row->page_namespace )][$row->page_title] =
-                                       (int)$row->page_id;
+                               $this->subjectids[$nsInfo->getTalk( $row->page_namespace )][$row->page_title] =
+                                       (int)( $row->page_id );
                        }
                }
        }
index e6403f3..98c6551 100644 (file)
@@ -67,13 +67,6 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                $search->setFeatureData( 'rewrite', (bool)$params['enablerewrites'] );
                $search->setFeatureData( 'interwiki', (bool)$interwiki );
 
-               $nquery = $search->transformSearchTerm( $query );
-               if ( $nquery !== $query ) {
-                       $query = $nquery;
-                       wfDeprecated( 'SearchEngine::transformSearchTerm() (overridden by ' .
-                               get_class( $search ) . ')', '1.32' );
-               }
-
                $nquery = $search->replacePrefixes( $query );
                if ( $nquery !== $query ) {
                        $query = $nquery;
index 68ab725..7e4a891 100644 (file)
@@ -282,27 +282,28 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data = [
                        ApiResult::META_TYPE => 'assoc',
                ];
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
                foreach (
                        MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces()
                        as $ns => $title
                ) {
                        $data[$ns] = [
                                'id' => (int)$ns,
-                               'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
+                               'case' => $nsInfo->isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
                        ];
                        ApiResult::setContentValue( $data[$ns], 'name', $title );
-                       $canonical = MWNamespace::getCanonicalName( $ns );
+                       $canonical = $nsInfo->getCanonicalName( $ns );
 
-                       $data[$ns]['subpages'] = MWNamespace::hasSubpages( $ns );
+                       $data[$ns]['subpages'] = $nsInfo->hasSubpages( $ns );
 
                        if ( $canonical ) {
                                $data[$ns]['canonical'] = strtr( $canonical, '_', ' ' );
                        }
 
-                       $data[$ns]['content'] = MWNamespace::isContent( $ns );
-                       $data[$ns]['nonincludable'] = MWNamespace::isNonincludable( $ns );
+                       $data[$ns]['content'] = $nsInfo->isContent( $ns );
+                       $data[$ns]['nonincludable'] = $nsInfo->isNonincludable( $ns );
 
-                       $contentmodel = MWNamespace::getNamespaceContentModel( $ns );
+                       $contentmodel = $nsInfo->getNamespaceContentModel( $ns );
                        if ( $contentmodel ) {
                                $data[$ns]['defaultcontentmodel'] = $contentmodel;
                        }
index 7d5169a..d5d473b 100644 (file)
        "apihelp-edit-param-text": "Conteúdo da página.",
        "apihelp-edit-param-summary": "Resumo da edição. Também é o título da secção quando $1section=new e $1sectiontitle não está definido.",
        "apihelp-edit-param-tags": "Etiquetas de modificação a aplicar à revisão.",
-       "apihelp-edit-param-minor": "Edição menor.",
-       "apihelp-edit-param-notminor": "Edição não menor.",
+       "apihelp-edit-param-minor": "Marcar esta edição como menor.",
+       "apihelp-edit-param-notminor": "Não marcar esta edição como uma edição menor, mesmo se a preferência \"{{int:tog-minordefault}}\" do utilizador estiver definida.",
        "apihelp-edit-param-bot": "Marcar esta edição como edição de robô.",
        "apihelp-edit-param-basetimestamp": "Data e hora da revisão de base, usada para detetar conflitos de edição. Pode ser obtida usando [[Special:ApiHelp/query+revisions|action=query&prop=revisions&rvprop=timestamp]].",
        "apihelp-edit-param-starttimestamp": "Data e hora de início do processo de edição, usada para detetar conflitos de edição. Pode-se obter um valor apropriado usando <var>[[Special:ApiHelp/main|curtimestamp]]</var> ao iniciar o processo de edição (por exemplo, ao carregar o conteúdo da página para edição).",
index 9741c40..9f086e5 100644 (file)
        "apihelp-edit-param-text": "Содержимое страницы.",
        "apihelp-edit-param-summary": "Описание изменений. Также является заголовком раздела, когда используется $1section=new, а $1sectiontitle не задано.",
        "apihelp-edit-param-tags": "Изменить метки записи в истории изменений.",
-       "apihelp-edit-param-minor": "Ð\9cалаÑ\8f Ð¿Ñ\80авка.",
-       "apihelp-edit-param-notminor": "Ð\9dе Ð¼Ð°Ð»Ð°Ñ\8f Ð¿Ñ\80авка.",
+       "apihelp-edit-param-minor": "Ð\9fомеÑ\82иÑ\82Ñ\8c Ñ\8dÑ\82Ñ\83 Ð¿Ñ\80авкÑ\83 ÐºÐ°Ðº Ð¼Ð°Ð»Ð¾Ðµ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ðµ.",
+       "apihelp-edit-param-notminor": "Ð\9dе Ð¿Ð¾Ð¼ÐµÑ\87аÑ\82Ñ\8c Ñ\8dÑ\82Ñ\83 Ð¿Ñ\80авкÑ\83 ÐºÐ°Ðº Ð¼Ð°Ð»Ð¾Ðµ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ðµ Ð´Ð°Ð¶Ðµ ÐµÑ\81Ñ\82Ñ\8c Ñ\83Ñ\81Ñ\82ановлена Ð¿Ð¾Ð»Ñ\8cзоваÑ\82елÑ\8cÑ\81каÑ\8f Ð½Ð°Ñ\81Ñ\82Ñ\80ойка Â«{{int:tog-minordefault}}».",
        "apihelp-edit-param-bot": "Пометить правку как сделанную ботом.",
        "apihelp-edit-param-basetimestamp": "Метка времени редактируемой версии, используется для обнаружения конфликтов редактирования. Может быть получена посредством [[Special:ApiHelp/query+revisions|action=query&prop=revisions&rvprop=timestamp]].",
        "apihelp-edit-param-starttimestamp": "Метка времени начала редактирования, используется для обнаружения конфликтов редактирования. Необходимое значение может быть получено с помощью <var>[[Special:ApiHelp/main|curtimestamp]]</var> в начале редактирования (то есть, после загрузки содержимого редактируемой страницы).",
diff --git a/includes/block/AbstractBlock.php b/includes/block/AbstractBlock.php
new file mode 100644 (file)
index 0000000..a931d7a
--- /dev/null
@@ -0,0 +1,674 @@
+<?php
+/**
+ * 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
+ */
+
+namespace MediaWiki\Block;
+
+use IContextSource;
+use InvalidArgumentException;
+use IP;
+use RequestContext;
+use Title;
+use User;
+
+/**
+ * @since 1.34 Factored out from Block.
+ */
+abstract class AbstractBlock {
+       /** @var string */
+       public $mReason;
+
+       /** @var string */
+       public $mTimestamp;
+
+       /** @var string */
+       public $mExpiry = '';
+
+       /** @var bool */
+       protected $mBlockEmail = false;
+
+       /** @var bool */
+       protected $allowUsertalk = false;
+
+       /** @var bool */
+       protected $blockCreateAccount = false;
+
+       /** @var bool */
+       public $mHideName = false;
+
+       /** @var User|string */
+       protected $target;
+
+       /**
+        * @var int Block::TYPE_ constant. After the block has been loaded
+        * from the database, this can only be USER, IP or RANGE.
+        */
+       protected $type;
+
+       /** @var User */
+       protected $blocker;
+
+       /** @var bool */
+       protected $isSitewide = true;
+
+       # TYPE constants
+       const TYPE_USER = 1;
+       const TYPE_IP = 2;
+       const TYPE_RANGE = 3;
+       const TYPE_AUTO = 4;
+       const TYPE_ID = 5;
+
+       /**
+        * Create a new block with specified parameters on a user, IP or IP range.
+        *
+        * @param array $options Parameters of the block:
+        *     address string|User  Target user name, User object, IP address or IP range
+        *     by int               User ID of the blocker
+        *     reason string        Reason of the block
+        *     timestamp string     The time at which the block comes into effect
+        *     byText string        Username of the blocker (for foreign users)
+        */
+       function __construct( $options = [] ) {
+               $defaults = [
+                       'address'         => '',
+                       'by'              => null,
+                       'reason'          => '',
+                       'timestamp'       => '',
+                       'byText'          => '',
+               ];
+
+               $options += $defaults;
+
+               $this->setTarget( $options['address'] );
+
+               if ( $options['by'] ) {
+                       # Local user
+                       $this->setBlocker( User::newFromId( $options['by'] ) );
+               } else {
+                       # Foreign user
+                       $this->setBlocker( $options['byText'] );
+               }
+
+               $this->setReason( $options['reason'] );
+               $this->setTimestamp( wfTimestamp( TS_MW, $options['timestamp'] ) );
+       }
+
+       /**
+        * Get the user id of the blocking sysop
+        *
+        * @return int (0 for foreign users)
+        */
+       public function getBy() {
+               return $this->getBlocker()->getId();
+       }
+
+       /**
+        * Get the username of the blocking sysop
+        *
+        * @return string
+        */
+       public function getByName() {
+               return $this->getBlocker()->getName();
+       }
+
+       /**
+        * Get the block ID
+        * @return int|null
+        */
+       public function getId() {
+               return null;
+       }
+
+       /**
+        * Get the reason given for creating the block
+        *
+        * @since 1.33
+        * @return string
+        */
+       public function getReason() {
+               return $this->mReason;
+       }
+
+       /**
+        * Set the reason for creating the block
+        *
+        * @since 1.33
+        * @param string $reason
+        */
+       public function setReason( $reason ) {
+               $this->mReason = $reason;
+       }
+
+       /**
+        * Get whether the block hides the target's username
+        *
+        * @since 1.33
+        * @return bool The block hides the username
+        */
+       public function getHideName() {
+               return $this->mHideName;
+       }
+
+       /**
+        * Set whether ths block hides the target's username
+        *
+        * @since 1.33
+        * @param bool $hideName The block hides the username
+        */
+       public function setHideName( $hideName ) {
+               $this->mHideName = $hideName;
+       }
+
+       /**
+        * Indicates that the block is a sitewide block. This means the user is
+        * prohibited from editing any page on the site (other than their own talk
+        * page).
+        *
+        * @since 1.33
+        * @param null|bool $x
+        * @return bool
+        */
+       public function isSitewide( $x = null ) {
+               return wfSetVar( $this->isSitewide, $x );
+       }
+
+       /**
+        * Get or set the flag indicating whether this block blocks the target from
+        * creating an account. (Note that the flag may be overridden depending on
+        * global configs.)
+        *
+        * @since 1.33
+        * @param null|bool $x Value to set (if null, just get the property value)
+        * @return bool Value of the property
+        */
+       public function isCreateAccountBlocked( $x = null ) {
+               return wfSetVar( $this->blockCreateAccount, $x );
+       }
+
+       /**
+        * Get or set the flag indicating whether this block blocks the target from
+        * sending emails. (Note that the flag may be overridden depending on
+        * global configs.)
+        *
+        * @since 1.33
+        * @param null|bool $x Value to set (if null, just get the property value)
+        * @return bool Value of the property
+        */
+       public function isEmailBlocked( $x = null ) {
+               return wfSetVar( $this->mBlockEmail, $x );
+       }
+
+       /**
+        * Get or set the flag indicating whether this block blocks the target from
+        * editing their own user talk page. (Note that the flag may be overridden
+        * depending on global configs.)
+        *
+        * @since 1.33
+        * @param null|bool $x Value to set (if null, just get the property value)
+        * @return bool Value of the property
+        */
+       public function isUsertalkEditAllowed( $x = null ) {
+               return wfSetVar( $this->allowUsertalk, $x );
+       }
+
+       /**
+        * Determine whether the Block prevents a given right. A right
+        * may be blacklisted or whitelisted, or determined from a
+        * property on the Block object. For certain rights, the property
+        * may be overridden according to global configs.
+        *
+        * @since 1.33
+        * @param string $right Right to check
+        * @return bool|null null if unrecognized right or unset property
+        */
+       public function appliesToRight( $right ) {
+               $config = RequestContext::getMain()->getConfig();
+               $blockDisablesLogin = $config->get( 'BlockDisablesLogin' );
+
+               $res = null;
+               switch ( $right ) {
+                       case 'edit':
+                               // TODO: fix this case to return proper value
+                               $res = true;
+                               break;
+                       case 'createaccount':
+                               $res = $this->isCreateAccountBlocked();
+                               break;
+                       case 'sendemail':
+                               $res = $this->isEmailBlocked();
+                               break;
+                       case 'upload':
+                               // Until T6995 is completed
+                               $res = $this->isSitewide();
+                               break;
+                       case 'read':
+                               $res = false;
+                               break;
+                       case 'purge':
+                               $res = false;
+                               break;
+               }
+               if ( !$res && $blockDisablesLogin ) {
+                       // If a block would disable login, then it should
+                       // prevent any right that all users cannot do
+                       $anon = new User;
+                       $res = $anon->isAllowed( $right ) ? $res : true;
+               }
+
+               return $res;
+       }
+
+       /**
+        * Get/set whether the Block prevents a given action
+        *
+        * @deprecated since 1.33, use appliesToRight to determine block
+        *  behaviour, and specific methods to get/set properties
+        * @param string $action Action to check
+        * @param bool|null $x Value for set, or null to just get value
+        * @return bool|null Null for unrecognized rights.
+        */
+       public function prevents( $action, $x = null ) {
+               $config = RequestContext::getMain()->getConfig();
+               $blockDisablesLogin = $config->get( 'BlockDisablesLogin' );
+               $blockAllowsUTEdit = $config->get( 'BlockAllowsUTEdit' );
+
+               $res = null;
+               switch ( $action ) {
+                       case 'edit':
+                               # For now... <evil laugh>
+                               $res = true;
+                               break;
+                       case 'createaccount':
+                               $res = wfSetVar( $this->blockCreateAccount, $x );
+                               break;
+                       case 'sendemail':
+                               $res = wfSetVar( $this->mBlockEmail, $x );
+                               break;
+                       case 'upload':
+                               // Until T6995 is completed
+                               $res = $this->isSitewide();
+                               break;
+                       case 'editownusertalk':
+                               // NOTE: this check is not reliable on partial blocks
+                               // since partially blocked users are always allowed to edit
+                               // their own talk page unless a restriction exists on the
+                               // page or User_talk: namespace
+                               wfSetVar( $this->allowUsertalk, $x === null ? null : !$x );
+                               $res = !$this->isUsertalkEditAllowed();
+
+                               // edit own user talk can be disabled by config
+                               if ( !$blockAllowsUTEdit ) {
+                                       $res = true;
+                               }
+                               break;
+                       case 'read':
+                               $res = false;
+                               break;
+                       case 'purge':
+                               $res = false;
+                               break;
+               }
+               if ( !$res && $blockDisablesLogin ) {
+                       // If a block would disable login, then it should
+                       // prevent any action that all users cannot do
+                       $anon = new User;
+                       $res = $anon->isAllowed( $action ) ? $res : true;
+               }
+
+               return $res;
+       }
+
+       /**
+        * From an existing Block, get the target and the type of target.
+        * Note that, except for null, it is always safe to treat the target
+        * as a string; for User objects this will return User::__toString()
+        * which in turn gives User::getName().
+        *
+        * @param string|int|User|null $target
+        * @return array [ User|String|null, Block::TYPE_ constant|null ]
+        */
+       public static function parseTarget( $target ) {
+               # We may have been through this before
+               if ( $target instanceof User ) {
+                       if ( IP::isValid( $target->getName() ) ) {
+                               return [ $target, self::TYPE_IP ];
+                       } else {
+                               return [ $target, self::TYPE_USER ];
+                       }
+               } elseif ( $target === null ) {
+                       return [ null, null ];
+               }
+
+               $target = trim( $target );
+
+               if ( IP::isValid( $target ) ) {
+                       # We can still create a User if it's an IP address, but we need to turn
+                       # off validation checking (which would exclude IP addresses)
+                       return [
+                               User::newFromName( IP::sanitizeIP( $target ), false ),
+                               self::TYPE_IP
+                       ];
+
+               } elseif ( IP::isValidRange( $target ) ) {
+                       # Can't create a User from an IP range
+                       return [ IP::sanitizeRange( $target ), self::TYPE_RANGE ];
+               }
+
+               # Consider the possibility that this is not a username at all
+               # but actually an old subpage (T31797)
+               if ( strpos( $target, '/' ) !== false ) {
+                       # An old subpage, drill down to the user behind it
+                       $target = explode( '/', $target )[0];
+               }
+
+               $userObj = User::newFromName( $target );
+               if ( $userObj instanceof User ) {
+                       # Note that since numbers are valid usernames, a $target of "12345" will be
+                       # considered a User.  If you want to pass a block ID, prepend a hash "#12345",
+                       # since hash characters are not valid in usernames or titles generally.
+                       return [ $userObj, self::TYPE_USER ];
+
+               } elseif ( preg_match( '/^#\d+$/', $target ) ) {
+                       # Autoblock reference in the form "#12345"
+                       return [ substr( $target, 1 ), self::TYPE_AUTO ];
+
+               } else {
+                       return [ null, null ];
+               }
+       }
+
+       /**
+        * Get the type of target for this particular block.
+        * @return int Block::TYPE_ constant, will never be TYPE_ID
+        */
+       public function getType() {
+               return $this->type;
+       }
+
+       /**
+        * Get the target and target type for this particular Block.  Note that for autoblocks,
+        * this returns the unredacted name; frontend functions need to call $block->getRedactedName()
+        * in this situation.
+        * @return array [ User|String, Block::TYPE_ constant ]
+        * @todo FIXME: This should be an integral part of the Block member variables
+        */
+       public function getTargetAndType() {
+               return [ $this->getTarget(), $this->getType() ];
+       }
+
+       /**
+        * Get the target for this particular Block.  Note that for autoblocks,
+        * this returns the unredacted name; frontend functions need to call $block->getRedactedName()
+        * in this situation.
+        * @return User|string
+        */
+       public function getTarget() {
+               return $this->target;
+       }
+
+       /**
+        * Get the block expiry time
+        *
+        * @since 1.19
+        * @return string
+        */
+       public function getExpiry() {
+               return $this->mExpiry;
+       }
+
+       /**
+        * Set the block expiry time
+        *
+        * @since 1.33
+        * @param string $expiry
+        */
+       public function setExpiry( $expiry ) {
+               $this->mExpiry = $expiry;
+       }
+
+       /**
+        * Get the timestamp indicating when the block was created
+        *
+        * @since 1.33
+        * @return string
+        */
+       public function getTimestamp() {
+               return $this->mTimestamp;
+       }
+
+       /**
+        * Set the timestamp indicating when the block was created
+        *
+        * @since 1.33
+        * @param string $timestamp
+        */
+       public function setTimestamp( $timestamp ) {
+               $this->mTimestamp = $timestamp;
+       }
+
+       /**
+        * Set the target for this block, and update $this->type accordingly
+        * @param mixed $target
+        */
+       public function setTarget( $target ) {
+               list( $this->target, $this->type ) = static::parseTarget( $target );
+       }
+
+       /**
+        * Get the user who implemented this block
+        * @return User User object. May name a foreign user.
+        */
+       public function getBlocker() {
+               return $this->blocker;
+       }
+
+       /**
+        * Set the user who implemented (or will implement) this block
+        * @param User|string $user Local User object or username string
+        */
+       public function setBlocker( $user ) {
+               if ( is_string( $user ) ) {
+                       $user = User::newFromName( $user, false );
+               }
+
+               if ( $user->isAnon() && User::isUsableName( $user->getName() ) ) {
+                       throw new InvalidArgumentException(
+                               'Blocker must be a local user or a name that cannot be a local user'
+                       );
+               }
+
+               $this->blocker = $user;
+       }
+
+       /**
+        * Get the key and parameters for the corresponding error message.
+        *
+        * @since 1.22
+        * @param IContextSource $context
+        * @return array
+        */
+       abstract public function getPermissionsError( IContextSource $context );
+
+       /**
+        * Get block information used in different block error messages
+        *
+        * @since 1.33
+        * @param IContextSource $context
+        * @return array
+        */
+       public function getBlockErrorParams( IContextSource $context ) {
+               $blocker = $this->getBlocker();
+               if ( $blocker instanceof User ) { // local user
+                       $blockerUserpage = $blocker->getUserPage();
+                       $link = "[[{$blockerUserpage->getPrefixedText()}|{$blockerUserpage->getText()}]]";
+               } else { // foreign user
+                       $link = $blocker;
+               }
+
+               $reason = $this->getReason();
+               if ( $reason == '' ) {
+                       $reason = $context->msg( 'blockednoreason' )->text();
+               }
+
+               /* $ip returns who *is* being blocked, $intended contains who was meant to be blocked.
+                * This could be a username, an IP range, or a single IP. */
+               $intended = $this->getTarget();
+               $lang = $context->getLanguage();
+
+               return [
+                       $link,
+                       $reason,
+                       $context->getRequest()->getIP(),
+                       $this->getByName(),
+                       // TODO: SystemBlock replaces this with the system block type. Clean up
+                       // error params so that this is not necessary.
+                       $this->getId(),
+                       $lang->formatExpiry( $this->getExpiry() ),
+                       (string)$intended,
+                       $lang->userTimeAndDate( $this->getTimestamp(), $context->getUser() ),
+               ];
+       }
+
+       /**
+        * Determine whether the block allows the user to edit their own
+        * user talk page. This is done separately from Block::appliesToRight
+        * because there is no right for editing one's own user talk page
+        * and because the user's talk page needs to be passed into the
+        * Block object, which is unaware of the user.
+        *
+        * The ipb_allow_usertalk flag (which corresponds to the property
+        * allowUsertalk) is used on sitewide blocks and partial blocks
+        * that contain a namespace restriction on the user talk namespace,
+        * but do not contain a page restriction on the user's talk page.
+        * For all other (i.e. most) partial blocks, the flag is ignored,
+        * and the user can always edit their user talk page unless there
+        * is a page restriction on their user talk page, in which case
+        * they can never edit it. (Ideally the flag would be stored as
+        * null in these cases, but the database field isn't nullable.)
+        *
+        * This method does not validate that the passed in talk page belongs to the
+        * block target since the target (an IP) might not be the same as the user's
+        * talk page (if they are logged in).
+        *
+        * @since 1.33
+        * @param Title|null $usertalk The user's user talk page. If null,
+        *  and if the target is a User, the target's userpage is used
+        * @return bool The user can edit their talk page
+        */
+       public function appliesToUsertalk( Title $usertalk = null ) {
+               if ( !$usertalk ) {
+                       if ( $this->target instanceof User ) {
+                               $usertalk = $this->target->getTalkPage();
+                       } else {
+                               throw new InvalidArgumentException(
+                                       '$usertalk must be provided if block target is not a user/IP'
+                               );
+                       }
+               }
+
+               if ( $usertalk->getNamespace() !== NS_USER_TALK ) {
+                       throw new InvalidArgumentException(
+                               '$usertalk must be a user talk page'
+                       );
+               }
+
+               if ( !$this->isSitewide() ) {
+                       if ( $this->appliesToPage( $usertalk->getArticleID() ) ) {
+                               return true;
+                       }
+                       if ( !$this->appliesToNamespace( NS_USER_TALK ) ) {
+                               return false;
+                       }
+               }
+
+               // This is a type of block which uses the ipb_allow_usertalk
+               // flag. The flag can still be overridden by global configs.
+               $config = RequestContext::getMain()->getConfig();
+               if ( !$config->get( 'BlockAllowsUTEdit' ) ) {
+                       return true;
+               }
+               return !$this->isUsertalkEditAllowed();
+       }
+
+       /**
+        * Checks if a block applies to a particular title
+        *
+        * This check does not consider whether `$this->isUsertalkEditAllowed`
+        * returns false, as the identity of the user making the hypothetical edit
+        * isn't known here (particularly in the case of IP hardblocks, range
+        * blocks, and auto-blocks).
+        *
+        * @param Title $title
+        * @return bool
+        */
+       public function appliesToTitle( Title $title ) {
+               return $this->isSitewide();
+       }
+
+       /**
+        * Checks if a block applies to a particular namespace
+        *
+        * @since 1.33
+        *
+        * @param int $ns
+        * @return bool
+        */
+       public function appliesToNamespace( $ns ) {
+               return $this->isSitewide();
+       }
+
+       /**
+        * Checks if a block applies to a particular page
+        *
+        * This check does not consider whether `$this->isUsertalkEditAllowed`
+        * returns false, as the identity of the user making the hypothetical edit
+        * isn't known here (particularly in the case of IP hardblocks, range
+        * blocks, and auto-blocks).
+        *
+        * @since 1.33
+        *
+        * @param int $pageId
+        * @return bool
+        */
+       public function appliesToPage( $pageId ) {
+               return $this->isSitewide();
+       }
+
+       /**
+        * Check if the block should be tracked with a cookie.
+        *
+        * @since 1.33
+        * @param bool $isAnon The user is logged out
+        * @return bool The block should be tracked with a cookie
+        */
+       public function shouldTrackWithCookie( $isAnon ) {
+               return false;
+       }
+
+       /**
+        * Check if the block prevents a user from resetting their password
+        *
+        * @since 1.33
+        * @return bool The block blocks password reset
+        */
+       public function appliesToPasswordReset() {
+               return $this->isCreateAccountBlocked();
+       }
+
+}
index 3ef35d7..ba4c569 100644 (file)
@@ -22,10 +22,10 @@ namespace MediaWiki\Block;
 
 use Block;
 use IP;
+use MediaWiki\User\UserIdentity;
 use User;
 use WebRequest;
 use Wikimedia\IPSet;
-use MediaWiki\User\UserIdentity;
 
 /**
  * A service class for checking blocks.
@@ -139,22 +139,25 @@ class BlockManager {
                $block = Block::newFromTarget( $user, $ip, !$fromReplica );
 
                // Cookie blocking
-               if ( !$block instanceof Block ) {
+               if ( !$block instanceof AbstractBlock ) {
                        $block = $this->getBlockFromCookieValue( $user, $request );
                }
 
                // Proxy blocking
-               if ( !$block instanceof Block && $ip !== null && !in_array( $ip, $this->proxyWhitelist ) ) {
+               if ( !$block instanceof AbstractBlock
+                       && $ip !== null
+                       && !in_array( $ip, $this->proxyWhitelist )
+               ) {
                        // Local list
                        if ( $this->isLocallyBlockedProxy( $ip ) ) {
-                               $block = new Block( [
+                               $block = new SystemBlock( [
                                        'byText' => wfMessage( 'proxyblocker' )->text(),
                                        'reason' => wfMessage( 'proxyblockreason' )->plain(),
                                        'address' => $ip,
                                        'systemBlock' => 'proxy',
                                ] );
                        } elseif ( $isAnon && $this->isDnsBlacklisted( $ip ) ) {
-                               $block = new Block( [
+                               $block = new SystemBlock( [
                                        'byText' => wfMessage( 'sorbs' )->text(),
                                        'reason' => wfMessage( 'sorbsreason' )->plain(),
                                        'address' => $ip,
@@ -164,7 +167,7 @@ class BlockManager {
                }
 
                // (T25343) Apply IP blocks to the contents of XFF headers, if enabled
-               if ( !$block instanceof Block
+               if ( !$block instanceof AbstractBlock
                        && $this->applyIpBlocksToXff
                        && $ip !== null
                        && !in_array( $ip, $this->proxyWhitelist )
@@ -176,19 +179,19 @@ class BlockManager {
                        $xffblocks = Block::getBlocksForIPList( $xff, $isAnon, !$fromReplica );
                        // TODO: remove dependency on Block
                        $block = Block::chooseBlock( $xffblocks, $xff );
-                       if ( $block instanceof Block ) {
+                       if ( $block instanceof AbstractBlock ) {
                                # Mangle the reason to alert the user that the block
                                # originated from matching the X-Forwarded-For header.
                                $block->setReason( wfMessage( 'xffblockreason', $block->getReason() )->plain() );
                        }
                }
 
-               if ( !$block instanceof Block
+               if ( !$block instanceof AbstractBlock
                        && $ip !== null
                        && $isAnon
                        && IP::isInRanges( $ip, $this->softBlockRanges )
                ) {
-                       $block = new Block( [
+                       $block = new SystemBlock( [
                                'address' => $ip,
                                'byText' => 'MediaWiki default',
                                'reason' => wfMessage( 'softblockrangesreason', $ip )->plain(),
diff --git a/includes/block/SystemBlock.php b/includes/block/SystemBlock.php
new file mode 100644 (file)
index 0000000..2a8c663
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/**
+ * Class for temporary blocks created on enforcement.
+ *
+ * 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
+ */
+
+namespace MediaWiki\Block;
+
+use IContextSource;
+
+/**
+ * System blocks are temporary blocks that are created on enforcement (e.g.
+ * from IP blacklists) and are not saved to the database. The target of a
+ * system block is an IP address. System blocks do not give rise to
+ * autoblocks and are not tracked with cookies.
+ *
+ * @since 1.34
+ */
+class SystemBlock extends AbstractBlock {
+       /** @var string|null */
+       private $systemBlockType;
+
+       /**
+        * Create a new block with specified parameters on a user, IP or IP range.
+        *
+        * @param array $options Parameters of the block:
+        *     systemBlock string   Indicate that this block is automatically
+        *                          created by MediaWiki rather than being stored
+        *                          in the database. Value is a string to return
+        *                          from self::getSystemBlockType().
+        */
+       function __construct( $options = [] ) {
+               parent::__construct( $options );
+
+               $defaults = [
+                       'systemBlock' => null,
+               ];
+
+               $options += $defaults;
+
+               $this->systemBlockType = $options['systemBlock'];
+       }
+
+       /**
+        * Get the system block type, if any. A SystemBlock can have the following types:
+        * - 'proxy': the IP is blacklisted in $wgProxyList
+        * - 'dnsbl': the IP is associated with a blacklisted domain in $wgDnsBlacklistUrls
+        * - 'wgSoftBlockRanges': the IP is covered by $wgSoftBlockRanges
+        * - 'global-block': for backwards compatability with the UserIsBlockedGlobally hook
+        *
+        * @since 1.29
+        * @return string|null
+        */
+       public function getSystemBlockType() {
+               return $this->systemBlockType;
+       }
+
+       /**
+        * @inheritDoc
+        */
+       public function getPermissionsError( IContextSource $context ) {
+               $params = $this->getBlockErrorParams( $context );
+               // TODO: Clean up error messages params so we don't have to do this
+               $params[ 4 ] = $this->getSystemBlockType();
+
+               $msg = 'systemblockedtext';
+
+               array_unshift( $params, $msg );
+
+               return $params;
+       }
+
+       /**
+        * @inheritDoc
+        */
+       public function appliesToPasswordReset() {
+               switch ( $this->getSystemBlockType() ) {
+                       case null:
+                       case 'global-block':
+                               return $this->isCreateAccountBlocked();
+                       case 'proxy':
+                               return true;
+                       case 'dnsbl':
+                       case 'wgSoftBlockRanges':
+                               return false;
+                       default:
+                               return true;
+               }
+       }
+
+}
index 8814cff..3455470 100644 (file)
@@ -22,9 +22,7 @@ use Cdb\Reader;
 use Cdb\Writer;
 
 /**
- * LCStore implementation which stores data as a collection of CDB files in the
- * directory given by $wgCacheDirectory. If $wgCacheDirectory is not set, this
- * will throw an exception.
+ * LCStore implementation which stores data as a collection of CDB files.
  *
  * Profiling indicates that on Linux, this implementation outperforms MySQL if
  * the directory is on a local filesystem and there is ample kernel cache
index db0f380..8a3a818 100644 (file)
@@ -192,7 +192,7 @@ class LocalisationCache {
                global $wgCacheDirectory;
 
                $this->conf = $conf;
-               $storeConf = [];
+               $storeArg = [];
                if ( !empty( $conf['storeClass'] ) ) {
                        $storeClass = $conf['storeClass'];
                } else {
@@ -203,7 +203,7 @@ class LocalisationCache {
                                        break;
                                case 'db':
                                        $storeClass = LCStoreDB::class;
-                                       $storeConf['server'] = $conf['storeServer'] ?? [];
+                                       $storeArg['server'] = $conf['storeServer'] ?? [];
                                        break;
                                case 'array':
                                        $storeClass = LCStoreStaticArray::class;
@@ -212,11 +212,11 @@ class LocalisationCache {
                                        if ( !empty( $conf['storeDirectory'] ) ) {
                                                $storeClass = LCStoreCDB::class;
                                        } elseif ( $wgCacheDirectory ) {
-                                               $storeConf['directory'] = $wgCacheDirectory;
+                                               $storeArg['directory'] = $wgCacheDirectory;
                                                $storeClass = LCStoreCDB::class;
                                        } else {
                                                $storeClass = LCStoreDB::class;
-                                               $storeConf['server'] = $conf['storeServer'] ?? [];
+                                               $storeArg['server'] = $conf['storeServer'] ?? [];
                                        }
                                        break;
                                default:
@@ -228,10 +228,10 @@ class LocalisationCache {
 
                wfDebugLog( 'caches', static::class . ": using store $storeClass" );
                if ( !empty( $conf['storeDirectory'] ) ) {
-                       $storeConf['directory'] = $conf['storeDirectory'];
+                       $storeArg['directory'] = $conf['storeDirectory'];
                }
 
-               $this->store = new $storeClass( $storeConf );
+               $this->store = new $storeClass( $storeArg );
                foreach ( [ 'manualRecache', 'forceRecache' ] as $var ) {
                        if ( isset( $conf[$var] ) ) {
                                $this->$var = $conf[$var];
index 4d00fbc..bb9114a 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Feed to Special:RecentChanges and Special:RecentChangesLinked.
  *
@@ -88,9 +90,10 @@ class ChangesFeed {
                        }
                }
 
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
                foreach ( $sorted as $obj ) {
                        $title = Title::makeTitle( $obj->rc_namespace, $obj->rc_title );
-                       $talkpage = MWNamespace::hasTalkNamespace( $obj->rc_namespace )
+                       $talkpage = $nsInfo->hasTalkNamespace( $obj->rc_namespace )
                                ? $title->getTalkPage()->getFullURL()
                                : '';
 
index decbb0c..cc73dd2 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * Base class for content handling.
  *
index 354cc61..103b3e5 100644 (file)
@@ -24,7 +24,7 @@
 
 namespace MediaWiki\EditPage;
 
-use MWNamespace;
+use MediaWiki\MediaWikiServices;
 use Sanitizer;
 use Title;
 use User;
@@ -75,7 +75,8 @@ class TextboxBuilder {
        public function getTextboxProtectionCSSClasses( Title $title ) {
                $classes = []; // Textarea CSS
                if ( $title->isProtected( 'edit' ) &&
-                       MWNamespace::getRestrictionLevels( $title->getNamespace() ) !== [ '' ]
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       getRestrictionLevels( $title->getNamespace() ) !== [ '' ]
                ) {
                        # Is the title semi-protected?
                        if ( $title->isSemiProtected() ) {
index 6e3fa79..b4e483b 100644 (file)
@@ -74,9 +74,32 @@ class MWExceptionHandler {
         * Install handlers with PHP.
         */
        public static function installHandler() {
+               // This catches:
+               // * Exception objects that were explicitly thrown but not
+               //   caught anywhere in the application. This is rare given those
+               //   would normally be caught at a high-level like MediaWiki::run (index.php),
+               //   api.php, or ResourceLoader::respond (load.php). These high-level
+               //   catch clauses would then call MWExceptionHandler::logException
+               //   or MWExceptionHandler::handleException.
+               //   If they are not caught, then they are handled here.
+               // * Error objects (on PHP 7+), for issues that would historically
+               //   cause fatal errors but may now be caught as Throwable (not Exception).
+               //   Same as previous case, but more common to bubble to here instead of
+               //   caught locally because they tend to not be safe to recover from.
+               //   (e.g. argument TypeErorr, devision by zero, etc.)
                set_exception_handler( 'MWExceptionHandler::handleUncaughtException' );
+
+               // This catches:
+               // * Non-fatal errors (e.g. PHP Notice, PHP Warning, PHP Error) that do not
+               //   interrupt execution in any way. We log these in the background and then
+               //   continue execution.
+               // * Fatal errors (on HHVM in PHP5 mode) where PHP 7 would throw Throwable.
                set_error_handler( 'MWExceptionHandler::handleError' );
 
+               // This catches:
+               // * Fatal error for which no Throwable is thrown (PHP 7), and no Error emitted (HHVM).
+               //   This includes Out-Of-Memory and Timeout fatals.
+               //
                // Reserve 16k of memory so we can report OOM fatals
                self::$reservedMemory = str_repeat( ' ', 16384 );
                register_shutdown_function( 'MWExceptionHandler::handleFatalError' );
index 9d19f8b..9746c2b 100644 (file)
@@ -18,6 +18,8 @@
  * @file
  */
 
+use MediaWiki\Block\AbstractBlock;
+
 /**
  * Show an error when the user tries to do something whilst blocked.
  *
@@ -25,7 +27,7 @@
  * @ingroup Exception
  */
 class UserBlockedError extends ErrorPageError {
-       public function __construct( Block $block ) {
+       public function __construct( AbstractBlock $block ) {
                // @todo FIXME: Implement a more proper way to get context here.
                $params = $block->getPermissionsError( RequestContext::getMain() );
                parent::__construct( 'blockedtitle', array_shift( $params ), $params );
index c201c76..6b2a22a 100644 (file)
@@ -23,6 +23,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * @ingroup Dump
  */
@@ -32,6 +34,7 @@ class DumpNotalkFilter extends DumpFilter {
         * @return bool
         */
        protected function pass( $page ) {
-               return !MWNamespace::isTalk( $page->page_namespace );
+               return !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       isTalk( $page->page_namespace );
        }
 }
index 54249a8..39153cf 100644 (file)
@@ -141,6 +141,7 @@ class XmlDumpWriter {
         */
        function namespaces() {
                $spaces = "<namespaces>\n";
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
                foreach (
                        MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces()
                        as $ns => $title
@@ -149,7 +150,8 @@ class XmlDumpWriter {
                                Xml::element( 'namespace',
                                        [
                                                'key' => $ns,
-                                               'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
+                                               'case' => $nsInfo->isCapitalized( $ns )
+                                                       ? 'first-letter' : 'case-sensitive',
                                        ], $title ) . "\n";
                }
                $spaces .= "    </namespaces>";
index 3a366c8..3e11a48 100644 (file)
@@ -176,7 +176,8 @@ class FileRepo {
                }
 
                // Optional settings that have a default
-               $this->initialCapital = $info['initialCapital'] ?? MWNamespace::isCapitalized( NS_FILE );
+               $this->initialCapital = $info['initialCapital'] ??
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->isCapitalized( NS_FILE );
                $this->url = $info['url'] ?? false; // a subclass may set the URL (e.g. ForeignAPIRepo)
                if ( isset( $info['thumbUrl'] ) ) {
                        $this->thumbUrl = $info['thumbUrl'];
@@ -645,7 +646,10 @@ class FileRepo {
         * @return string
         */
        public function getNameFromTitle( Title $title ) {
-               if ( $this->initialCapital != MWNamespace::isCapitalized( NS_FILE ) ) {
+               if (
+                       $this->initialCapital !=
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->isCapitalized( NS_FILE )
+               ) {
                        $name = $title->getUserCaseDBKey();
                        if ( $this->initialCapital ) {
                                $name = MediaWikiServices::getInstance()->getContentLanguage()->ucfirst( $name );
index 9de7eb8..4d5222c 100644 (file)
@@ -169,7 +169,8 @@ class TraditionalImageGallery extends ImageGalleryBase {
 
                        // @todo Code is incomplete.
                        // $linkTarget = Title::newFromText( MediaWikiServices::getInstance()->
-                       // getContentLanguage()->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
+                       // getContentLanguage()->getNsText( MediaWikiServices::getInstance()->
+                       // getNamespaceInfo()->getUser() ) . ":{$ut}" );
                        // $ul = Linker::link( $linkTarget, $ut );
 
                        $meta = [];
index 466e3d8..8f58344 100644 (file)
@@ -257,7 +257,7 @@ class WikiImporter {
                        return true;
                } elseif (
                        $namespace >= 0 &&
-                       MWNamespace::exists( intval( $namespace ) )
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->exists( intval( $namespace ) )
                ) {
                        $namespace = intval( $namespace );
                        $this->setImportTitleFactory( new NamespaceImportTitleFactory( $namespace ) );
@@ -283,7 +283,10 @@ class WikiImporter {
 
                        if ( !$title || $title->isExternal() ) {
                                $status->fatal( 'import-rootpage-invalid' );
-                       } elseif ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+                       } elseif (
+                               !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $title->getNamespace() )
+                       ) {
                                $displayNSText = $title->getNamespace() == NS_MAIN
                                        ? wfMessage( 'blanknamespace' )->text()
                                        : MediaWikiServices::getInstance()->getContentLanguage()->
index c231288..5c3d1d0 100644 (file)
@@ -696,6 +696,7 @@ abstract class Installer {
                                'enableSectionEditLinks' => false,
                                'unwrap' => true,
                        ] );
+                       $html = Parser::stripOuterParagraph( $html );
                } catch ( Wikimedia\Services\ServiceDisabledException $e ) {
                        $html = '<!--DB access attempted during parse-->  ' . htmlspecialchars( $text );
                }
index 124437e..b20c83e 100644 (file)
@@ -1352,6 +1352,8 @@ class Article implements Page {
 
                $title = $this->getTitle();
 
+               $services = MediaWikiServices::getInstance();
+
                # Show info in user (talk) namespace. Does the user exist? Is he blocked?
                if ( $title->getNamespace() == NS_USER
                        || $title->getNamespace() == NS_USER_TALK
@@ -1374,7 +1376,8 @@ class Article implements Page {
                                LogEventsList::showLogExtract(
                                        $outputPage,
                                        'block',
-                                       MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget(),
+                                       $services->getNamespaceInfo()->getCanonicalName( NS_USER ) . ':' .
+                                               $block->getTarget(),
                                        '',
                                        [
                                                'lim' => 1,
@@ -1396,7 +1399,7 @@ class Article implements Page {
                # Show delete and move logs if there were any such events.
                # The logging query can DOS the site when bots/crawlers cause 404 floods,
                # so be careful showing this. 404 pages must be cheap as they are hard to cache.
-               $cache = MediaWikiServices::getInstance()->getMainObjectStash();
+               $cache = $services->getMainObjectStash();
                $key = $cache->makeKey( 'page-recent-delete', md5( $title->getPrefixedText() ) );
                $loggedIn = $this->getContext()->getUser()->isLoggedIn();
                $sessionExists = $this->getContext()->getRequest()->getSession()->isPersistent();
index 69a6f5f..8cbde09 100644 (file)
@@ -57,9 +57,10 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                $contLang = MediaWikiServices::getInstance()->getContentLanguage();
                $namespaceIds = $contLang->getNamespaceIds();
                $caseSensitiveNamespaces = [];
-               foreach ( MWNamespace::getCanonicalNamespaces() as $index => $name ) {
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
+               foreach ( $nsInfo->getCanonicalNamespaces() as $index => $name ) {
                        $namespaceIds[$contLang->lc( $name )] = $index;
-                       if ( !MWNamespace::isCapitalized( $index ) ) {
+                       if ( !$nsInfo->isCapitalized( $index ) ) {
                                $caseSensitiveNamespaces[] = $index;
                        }
                }
@@ -92,7 +93,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        'wgEnableWriteAPI' => true, // Deprecated since MW 1.32
                        'wgFormattedNamespaces' => $contLang->getFormattedNamespaces(),
                        'wgNamespaceIds' => $namespaceIds,
-                       'wgContentNamespaces' => MWNamespace::getContentNamespaces(),
+                       'wgContentNamespaces' => $nsInfo->getContentNamespaces(),
                        'wgSiteName' => $conf->get( 'Sitename' ),
                        'wgDBname' => $conf->get( 'DBname' ),
                        'wgExtraSignatureNamespaces' => $conf->get( 'ExtraSignatureNamespaces' ),
index d0912c5..65a3e6a 100644 (file)
@@ -245,6 +245,7 @@ abstract class SearchEngine {
         * search engine
         */
        public function transformSearchTerm( $term ) {
+               wfDeprecated( __METHOD__, '1.34' );
                return $term;
        }
 
index ac41c46..86a1c4c 100644 (file)
@@ -755,7 +755,10 @@ abstract class Skin extends ContextSource {
                        return $subpages;
                }
 
-               if ( $out->isArticle() && MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+               if (
+                       $out->isArticle() && MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $title->getNamespace() )
+               ) {
                        $ptext = $title->getPrefixedText();
                        if ( strpos( $ptext, '/' ) !== false ) {
                                $links = explode( '/', $ptext );
@@ -1620,11 +1623,10 @@ abstract class Skin extends ContextSource {
 
                $links = [
                        'editsection' => [
-                               'text' => $this->msg( 'editsection' )->inLanguage( $lang )->escaped(),
+                               'text' => $this->msg( 'editsection' )->inLanguage( $lang )->text(),
                                'targetTitle' => $nt,
                                'attribs' => $attribs,
-                               'query' => [ 'action' => 'edit', 'section' => $section ],
-                               'options' => [ 'noclasses', 'known' ]
+                               'query' => [ 'action' => 'edit', 'section' => $section ]
                        ]
                ];
 
@@ -1634,12 +1636,11 @@ abstract class Skin extends ContextSource {
 
                $linksHtml = [];
                foreach ( $links as $k => $linkDetails ) {
-                       $linksHtml[] = Linker::link(
+                       $linksHtml[] = Linker::linkKnown(
                                $linkDetails['targetTitle'],
-                               $linkDetails['text'],
+                               htmlspecialchars( $linkDetails['text'] ),
                                $linkDetails['attribs'],
-                               $linkDetails['query'],
-                               $linkDetails['options']
+                               $linkDetails['query']
                        );
                }
 
index 25771bc..ef45d15 100644 (file)
@@ -790,7 +790,8 @@ class SkinTemplate extends Skin {
                        }
                }
 
-               $linkClass = MediaWikiServices::getInstance()->getLinkRenderer()->getLinkClasses( $title );
+               $services = MediaWikiServices::getInstance();
+               $linkClass = $services->getLinkRenderer()->getLinkClasses( $title );
 
                // wfMessageFallback will nicely accept $message as an array of fallbacks
                // or just a single key
@@ -802,8 +803,9 @@ class SkinTemplate extends Skin {
                if ( $msg->exists() ) {
                        $text = $msg->text();
                } else {
-                       $text = MediaWikiServices::getInstance()->getContentLanguage()->getConverter()->
-                               convertNamespace( MWNamespace::getSubject( $title->getNamespace() ) );
+                       $text = $services->getContentLanguage()->getConverter()->
+                               convertNamespace( $services->getNamespaceInfo()->
+                                       getSubject( $title->getNamespace() ) );
                }
 
                // Avoid PHP 7.1 warning of passing $this by reference
@@ -1086,7 +1088,8 @@ class SkinTemplate extends Skin {
                                }
 
                                if ( $title->quickUserCan( 'protect', $user ) && $title->getRestrictionTypes() &&
-                                       MWNamespace::getRestrictionLevels( $title->getNamespace(), $user ) !== [ '' ]
+                                       MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                               getRestrictionLevels( $title->getNamespace(), $user ) !== [ '' ]
                                ) {
                                        $mode = $title->isProtected() ? 'unprotect' : 'protect';
                                        $content_navigation['actions'][$mode] = [
index dee31b2..f4b574b 100644 (file)
  * @file
  * @ingroup SpecialPage
  */
+
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\DBQueryTimeoutError;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\FakeResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
-use MediaWiki\MediaWikiServices;
 
 /**
  * Special page which uses a ChangesList to show query results.
@@ -1451,7 +1452,8 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                        if ( $opts[ 'associated' ] ) {
                                $associatedNamespaces = array_map(
                                        function ( $ns ) {
-                                               return MWNamespace::getAssociated( $ns );
+                                               return MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                                       getAssociated( $ns );
                                        },
                                        $namespaces
                                );
index cea6d37..a32393e 100644 (file)
@@ -45,7 +45,8 @@ class AncientPagesPage extends QueryPage {
        public function getQueryInfo() {
                $tables = [ 'page', 'revision' ];
                $conds = [
-                       'page_namespace' => MWNamespace::getContentNamespaces(),
+                       'page_namespace' =>
+                               MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces(),
                        'page_is_redirect' => 0
                ];
                $joinConds = [
index dc4d1bd..ce08392 100644 (file)
@@ -21,6 +21,7 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
 use MediaWiki\Widget\DateInputWidget;
 
 /**
@@ -328,7 +329,8 @@ class SpecialContributions extends IncludableSpecialPage {
 
                                if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
                                        if ( $block->getType() == Block::TYPE_RANGE ) {
-                                               $nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget();
+                                               $nt = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                                       getCanonicalName( NS_USER ) . ':' . $block->getTarget();
                                        }
 
                                        $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
index f13f231..2a967c5 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * A special page that list pages that contain no link to other pages
  *
@@ -66,7 +68,8 @@ class DeadendPagesPage extends PageQueryPage {
                        ],
                        'conds' => [
                                'pl_from IS NULL',
-                               'page_namespace' => MWNamespace::getContentNamespaces(),
+                               'page_namespace' => MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                       getContentNamespaces(),
                                'page_is_redirect' => 0
                        ],
                        'join_conds' => [
@@ -81,7 +84,9 @@ class DeadendPagesPage extends PageQueryPage {
        function getOrderFields() {
                // For some crazy reason ordering by a constant
                // causes a filesort
-               if ( count( MWNamespace::getContentNamespaces() ) > 1 ) {
+               if ( count( MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       getContentNamespaces() ) > 1
+               ) {
                        return [ 'page_namespace', 'page_title' ];
                } else {
                        return [ 'page_title' ];
index 65cf79e..73b438c 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Implements Special:DeletedContributions to display archived revisions
  * @ingroup SpecialPage
@@ -160,7 +162,8 @@ class DeletedContributionsPage extends SpecialPage {
                        $block = Block::newFromTarget( $userObj, $userObj );
                        if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
                                if ( $block->getType() == Block::TYPE_RANGE ) {
-                                       $nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget();
+                                       $nt = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                               getCanonicalName( NS_USER ) . ':' . $block->getTarget();
                                }
 
                                // LogEventsList::showLogExtract() wants the first parameter by ref
index b05c81a..480e81a 100644 (file)
@@ -380,8 +380,9 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
         */
        protected function getWatchlistInfo() {
                $titles = [];
+               $services = MediaWikiServices::getInstance();
 
-               $watchedItems = MediaWikiServices::getInstance()->getWatchedItemStore()
+               $watchedItems = $services->getWatchedItemStore()
                        ->getWatchedItemsForUser( $this->getUser(), [ 'sort' => WatchedItemStore::SORT_ASC ] );
 
                $lb = new LinkBatch();
@@ -390,7 +391,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        $namespace = $watchedItem->getLinkTarget()->getNamespace();
                        $dbKey = $watchedItem->getLinkTarget()->getDBkey();
                        $lb->add( $namespace, $dbKey );
-                       if ( !MWNamespace::isTalk( $namespace ) ) {
+                       if ( !$services->getNamespaceInfo()->isTalk( $namespace ) ) {
                                $titles[$namespace][$dbKey] = 1;
                        }
                }
@@ -511,6 +512,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
         */
        private function getExpandedTargets( array $targets ) {
                $expandedTargets = [];
+               $services = MediaWikiServices::getInstance();
                foreach ( $targets as $target ) {
                        if ( !$target instanceof LinkTarget ) {
                                try {
@@ -523,8 +525,10 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
 
                        $ns = $target->getNamespace();
                        $dbKey = $target->getDBkey();
-                       $expandedTargets[] = new TitleValue( MWNamespace::getSubject( $ns ), $dbKey );
-                       $expandedTargets[] = new TitleValue( MWNamespace::getTalk( $ns ), $dbKey );
+                       $expandedTargets[] =
+                               new TitleValue( $services->getNamespaceInfo()->getSubject( $ns ), $dbKey );
+                       $expandedTargets[] =
+                               new TitleValue( $services->getNamespaceInfo()->getTalk( $ns ), $dbKey );
                }
                return $expandedTargets;
        }
index 84454e2..c47d87b 100644 (file)
@@ -52,7 +52,8 @@ class FewestrevisionsPage extends QueryPage {
                                'redirect' => 'page_is_redirect'
                        ],
                        'conds' => [
-                               'page_namespace' => MWNamespace::getContentNamespaces(),
+                               'page_namespace' => MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                       getContentNamespaces(),
                                'page_id = rev_page' ],
                        'options' => [
                                'GROUP BY' => [ 'page_namespace', 'page_title', 'page_is_redirect' ]
index 1d10791..ae4b090 100644 (file)
@@ -84,7 +84,8 @@ class SpecialListGroupRights extends SpecialPage {
                        $groupnameLocalized = UserGroupMembership::getGroupName( $groupname );
 
                        $grouppageLocalizedTitle = UserGroupMembership::getGroupPage( $groupname )
-                               ?: Title::newFromText( MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $groupname );
+                               ?: Title::newFromText( MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               getCanonicalName( NS_PROJECT ) . ':' . $groupname );
 
                        if ( $group == '*' || !$grouppageLocalizedTitle ) {
                                // Do not make a link for the generic * group or group with invalid group page
@@ -162,7 +163,8 @@ class SpecialListGroupRights extends SpecialPage {
                );
                $linkRenderer = $this->getLinkRenderer();
                ksort( $namespaceProtection );
-               $validNamespaces = MWNamespace::getValidNamespaces();
+               $validNamespaces =
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->getValidNamespaces();
                $contLang = MediaWikiServices::getInstance()->getContentLanguage();
                foreach ( $namespaceProtection as $namespace => $rights ) {
                        if ( !in_array( $namespace, $validNamespaces ) ) {
index ff76a4b..ca3f4da 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * A special page looking for articles with no article linking to them,
  * thus being lonely.
@@ -52,7 +54,8 @@ class LonelyPagesPage extends PageQueryPage {
                $tables = [ 'page', 'pagelinks', 'templatelinks' ];
                $conds = [
                        'pl_namespace IS NULL',
-                       'page_namespace' => MWNamespace::getContentNamespaces(),
+                       'page_namespace' => MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               getContentNamespaces(),
                        'page_is_redirect' => 0,
                        'tl_namespace IS NULL'
                ];
@@ -89,7 +92,9 @@ class LonelyPagesPage extends PageQueryPage {
        function getOrderFields() {
                // For some crazy reason ordering by a constant
                // causes a filesort in MySQL 5
-               if ( count( MWNamespace::getContentNamespaces() ) > 1 ) {
+               if ( count( MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       getContentNamespaces() ) > 1
+               ) {
                        return [ 'page_namespace', 'page_title' ];
                } else {
                        return [ 'page_title' ];
index 123c174..0dd9437 100644 (file)
@@ -24,6 +24,7 @@
  * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
  */
 
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
 
@@ -53,7 +54,8 @@ class MostcategoriesPage extends QueryPage {
                                'title' => 'page_title',
                                'value' => 'COUNT(*)'
                        ],
-                       'conds' => [ 'page_namespace' => MWNamespace::getContentNamespaces() ],
+                       'conds' => [ 'page_namespace' =>
+                               MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces() ],
                        'options' => [
                                'HAVING' => 'COUNT(*) > 1',
                                'GROUP BY' => [ 'page_namespace', 'page_title' ]
index c963838..0fcf842 100644 (file)
@@ -21,6 +21,7 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
 
@@ -52,7 +53,8 @@ class MostinterwikisPage extends QueryPage {
                                'title' => 'page_title',
                                'value' => 'COUNT(*)'
                        ], 'conds' => [
-                               'page_namespace' => MWNamespace::getContentNamespaces()
+                               'page_namespace' =>
+                                       MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces()
                        ], 'options' => [
                                'HAVING' => 'COUNT(*) > 1',
                                'GROUP BY' => [
index 39976c0..b561e5b 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * A special page that allows users to change page titles
  *
@@ -297,7 +299,7 @@ class MovePageForm extends UnlistedSpecialPage {
 
                $immovableNamespaces = [];
                foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) {
-                       if ( !MWNamespace::isMovable( $nsId ) ) {
+                       if ( !MediaWikiServices::getInstance()->getNamespaceInfo()->isMovable( $nsId ) ) {
                                $immovableNamespaces[] = $nsId;
                        }
                }
@@ -664,11 +666,12 @@ class MovePageForm extends UnlistedSpecialPage {
                 */
 
                // @todo FIXME: Use Title::moveSubpages() here
+               $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
                $dbr = wfGetDB( DB_MASTER );
                if ( $this->moveSubpages && (
-                       MWNamespace::hasSubpages( $nt->getNamespace() ) || (
+                       $nsInfo->hasSubpages( $nt->getNamespace() ) || (
                                $this->moveTalk
-                                       && MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() )
+                                       && $nsInfo->hasSubpages( $nt->getTalkPage()->getNamespace() )
                        )
                ) ) {
                        $conds = [
@@ -676,11 +679,11 @@ class MovePageForm extends UnlistedSpecialPage {
                                        . ' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
                        ];
                        $conds['page_namespace'] = [];
-                       if ( MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
+                       if ( $nsInfo->hasSubpages( $nt->getNamespace() ) ) {
                                $conds['page_namespace'][] = $ot->getNamespace();
                        }
                        if ( $this->moveTalk &&
-                               MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() )
+                               $nsInfo->hasSubpages( $nt->getTalkPage()->getNamespace() )
                        ) {
                                $conds['page_namespace'][] = $ot->getTalkPage()->getNamespace();
                        }
@@ -799,7 +802,8 @@ class MovePageForm extends UnlistedSpecialPage {
         * @param Title $title Page being moved.
         */
        function showSubpages( $title ) {
-               $nsHasSubpages = MWNamespace::hasSubpages( $title->getNamespace() );
+               $nsHasSubpages = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       hasSubpages( $title->getNamespace() );
                $subpages = $title->getSubpages();
                $count = $subpages instanceof TitleArray ? $subpages->count() : 0;
 
index d09deab..9bd855a 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * This special page lists the defined password policies for user groups.
  * See also @ref $wgPasswordPolicy.
@@ -84,7 +86,8 @@ class SpecialPasswordPolicies extends SpecialPage {
                        $groupnameLocalized = UserGroupMembership::getGroupName( $group );
 
                        $grouppageLocalizedTitle = UserGroupMembership::getGroupPage( $group )
-                               ?: Title::newFromText( MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $group );
+                               ?: Title::newFromText( MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                       getCanonicalName( NS_PROJECT ) . ':' . $group );
 
                        $grouppage = $linkRenderer->makeLink(
                                $grouppageLocalizedTitle,
index 7e5a73f..c4ea005 100644 (file)
@@ -35,7 +35,8 @@ class RandomPage extends SpecialPage {
        protected $extra = []; // Extra SQL statements
 
        public function __construct( $name = 'Randompage' ) {
-               $this->namespaces = MWNamespace::getContentNamespaces();
+               $this->namespaces = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       getContentNamespaces();
                parent::__construct( $name );
        }
 
index f27a736..4adc247 100644 (file)
@@ -330,13 +330,6 @@ class SpecialSearch extends SpecialPage {
                $showSuggestion = $title === null || !$title->isKnown();
                $search->setShowSuggestion( $showSuggestion );
 
-               $rewritten = $search->transformSearchTerm( $term );
-               if ( $rewritten !== $term ) {
-                       $term = $rewritten;
-                       wfDeprecated( 'SearchEngine::transformSearchTerm() (overridden by ' .
-                               get_class( $search ) . ')', '1.32' );
-               }
-
                $rewritten = $search->replacePrefixes( $term );
                if ( $rewritten !== $term ) {
                        wfDeprecated( 'SearchEngine::replacePrefixes() (overridden by ' .
@@ -654,7 +647,9 @@ class SpecialSearch extends SpecialPage {
                ) {
                        // Reset namespace preferences: namespaces are not searched
                        // when they're not mentioned in the URL parameters.
-                       foreach ( MWNamespace::getValidNamespaces() as $n ) {
+                       foreach ( MediaWikiServices::getInstance()->getNamespaceInfo()->getValidNamespaces()
+                               as $n
+                       ) {
                                $user->setOption( 'searchNs' . $n, false );
                        }
                        // The request parameters include all the namespaces to be searched.
index d90f72c..94da25d 100644 (file)
@@ -21,6 +21,7 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
 
@@ -45,7 +46,10 @@ class ShortPagesPage extends QueryPage {
                $blacklist = $config->get( 'ShortPagesNamespaceBlacklist' );
                $tables = [ 'page' ];
                $conds = [
-                       'page_namespace' => array_diff( MWNamespace::getContentNamespaces(), $blacklist ),
+                       'page_namespace' => array_diff(
+                               MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces(),
+                               $blacklist
+                       ),
                        'page_is_redirect' => 0
                ];
                $joinConds = [];
index d5e14d2..eff8889 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Special page lists various statistics, including the contents of
  * `site_stats`, plus page view details if enabled
@@ -207,8 +209,8 @@ class SpecialStatistics extends SpecialPage {
                        }
                        $msg = $this->msg( 'grouppage-' . $groupname )->inContentLanguage();
                        if ( $msg->isBlank() ) {
-                               $grouppageLocalized = MWNamespace::getCanonicalName( NS_PROJECT ) .
-                                       ':' . $groupname;
+                               $grouppageLocalized = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                       getCanonicalName( NS_PROJECT ) . ':' . $groupname;
                        } else {
                                $grouppageLocalized = $msg->text();
                        }
index 30b33cc..9efa803 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * A special page looking for page without any category.
  *
@@ -60,7 +62,8 @@ class UncategorizedPagesPage extends PageQueryPage {
                                'cl_from IS NULL',
                                'page_namespace' => $this->requestedNamespace !== false
                                                ? $this->requestedNamespace
-                                               : MWNamespace::getContentNamespaces(),
+                                               : MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                                       getContentNamespaces(),
                                'page_is_redirect' => 0
                        ],
                        'join_conds' => [
@@ -72,7 +75,10 @@ class UncategorizedPagesPage extends PageQueryPage {
        function getOrderFields() {
                // For some crazy reason ordering by a constant
                // causes a filesort
-               if ( $this->requestedNamespace === false && count( MWNamespace::getContentNamespaces() ) > 1 ) {
+               if ( $this->requestedNamespace === false &&
+                       count( MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               getContentNamespaces() ) > 1
+               ) {
                        return [ 'page_namespace', 'page_title' ];
                }
 
index a1e5156..548e921 100644 (file)
@@ -22,6 +22,8 @@
  * @author Rob Church <robchur@gmail.com>
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Special page lists pages without language links
  *
@@ -91,7 +93,8 @@ class WithoutInterwikiPage extends PageQueryPage {
                        ],
                        'conds' => [
                                'll_title IS NULL',
-                               'page_namespace' => MWNamespace::getContentNamespaces(),
+                               'page_namespace' => MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                       getContentNamespaces(),
                                'page_is_redirect' => 0
                        ],
                        'join_conds' => [ 'langlinks' => [ 'LEFT JOIN', 'll_from = page_id' ] ]
index 7a47edf..be28417 100644 (file)
@@ -415,7 +415,8 @@ class UploadForm extends HTMLForm {
                        'wgCheckFileExtensions' => $config->get( 'CheckFileExtensions' ),
                        'wgStrictFileExtensions' => $config->get( 'StrictFileExtensions' ),
                        'wgFileExtensions' => array_values( array_unique( $config->get( 'FileExtensions' ) ) ),
-                       'wgCapitalizeUploads' => MWNamespace::isCapitalized( NS_FILE ),
+                       'wgCapitalizeUploads' => MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               isCapitalized( NS_FILE ),
                        'wgMaxUploadSize' => $this->mMaxUploadSize,
                        'wgFileCanRotate' => SpecialUpload::rotationEnabled(),
                ];
index a187a44..e0db715 100644 (file)
@@ -386,7 +386,7 @@ class ContribsPager extends RangeChronologicalPager {
                        }
 
                        $associatedNS = $this->mDb->addQuotes(
-                               MWNamespace::getAssociated( $this->namespace )
+                               MediaWikiServices::getInstance()->getAssociated( $this->namespace )
                        );
 
                        return [
index 4da9395..1a6ba72 100644 (file)
@@ -46,7 +46,10 @@ class NaiveImportTitleFactory implements ImportTitleFactory {
 
                        // For built-in namespaces (0 <= ID < 100), we try to find a local NS with
                        // the same namespace ID
-                       if ( $foreignNs < 100 && MWNamespace::exists( $foreignNs ) ) {
+                       if (
+                               $foreignNs < 100 &&
+                               MediaWikiServices::getInstance()->getNamespaceInfo()->exists( $foreignNs )
+                       ) {
                                return Title::makeTitleSafe( $foreignNs, $foreignTitle->getText() );
                        }
                }
index 7c756aa..7a44d0a 100644 (file)
@@ -18,6 +18,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * A class to convert page titles on a foreign wiki (ForeignTitle objects) into
  * page titles on the local wiki (Title objects), placing all pages in a fixed
@@ -31,7 +33,7 @@ class NamespaceImportTitleFactory implements ImportTitleFactory {
         * @param int $ns The namespace to use for all pages
         */
        public function __construct( $ns ) {
-               if ( !MWNamespace::exists( $ns ) ) {
+               if ( !MediaWikiServices::getInstance()->getNamespaceInfo()->exists( $ns ) ) {
                        throw new MWException( "Namespace $ns doesn't exist on this wiki" );
                }
                $this->ns = $ns;
index 4244350..415196a 100644 (file)
@@ -18,6 +18,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * A class to convert page titles on a foreign wiki (ForeignTitle objects) into
  * page titles on the local wiki (Title objects), placing all pages as subpages
@@ -32,7 +34,10 @@ class SubpageImportTitleFactory implements ImportTitleFactory {
         * created
         */
        public function __construct( Title $rootPage ) {
-               if ( !MWNamespace::hasSubpages( $rootPage->getNamespace() ) ) {
+               if (
+                       !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $rootPage->getNamespace() )
+               ) {
                        throw new MWException( "The root page you specified, $rootPage, is in a " .
                                "namespace where subpages are not allowed" );
                }
index 66674dc..41facc7 100644 (file)
@@ -64,9 +64,11 @@ class ExternalUserNames {
                if ( $pos !== false ) {
                        $iw = explode( ':', substr( $userName, 0, $pos ) );
                        $firstIw = array_shift( $iw );
-                       $interwikiLookup = MediaWikiServices::getInstance()->getInterwikiLookup();
+                       $services = MediaWikiServices::getInstance();
+                       $interwikiLookup = $services->getInterwikiLookup();
                        if ( $interwikiLookup->isValidInterwiki( $firstIw ) ) {
-                               $title = MWNamespace::getCanonicalName( NS_USER ) . ':' . substr( $userName, $pos + 1 );
+                               $title = $services->getNamespaceInfo()->getCanonicalName( NS_USER ) .
+                                       ':' . substr( $userName, $pos + 1 );
                                if ( $iw ) {
                                        $title = implode( ':', $iw ) . ':' . $title;
                                }
index 2cea712..2f6deb5 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use MediaWiki\Block\AbstractBlock;
+use MediaWiki\Block\SystemBlock;
 use MediaWiki\MediaWikiServices;
 use MediaWiki\Session\SessionManager;
 use MediaWiki\Session\Token;
@@ -278,7 +280,7 @@ class User implements IDBAccessObject, UserIdentity {
        protected $mImplicitGroups;
        /** @var array */
        protected $mFormerGroups;
-       /** @var Block */
+       /** @var AbstractBlock */
        protected $mGlobalBlock;
        /** @var bool */
        protected $mLocked;
@@ -290,13 +292,13 @@ class User implements IDBAccessObject, UserIdentity {
        /** @var WebRequest */
        private $mRequest;
 
-       /** @var Block */
+       /** @var AbstractBlock */
        public $mBlock;
 
        /** @var bool */
        protected $mAllowUsertalk;
 
-       /** @var Block */
+       /** @var AbstractBlock */
        private $mBlockedFromCreateAccount = false;
 
        /** @var int User::READ_* constant bitfield used to load data */
@@ -1848,7 +1850,7 @@ class User implements IDBAccessObject, UserIdentity {
                        $fromReplica
                );
 
-               if ( $block instanceof Block ) {
+               if ( $block instanceof AbstractBlock ) {
                        wfDebug( __METHOD__ . ": Found block.\n" );
                        $this->mBlock = $block;
                        $this->mBlockedby = $block->getByName();
@@ -2162,7 +2164,7 @@ class User implements IDBAccessObject, UserIdentity {
         * @return bool True if blocked, false otherwise
         */
        public function isBlocked( $fromReplica = true ) {
-               return $this->getBlock( $fromReplica ) instanceof Block &&
+               return $this->getBlock( $fromReplica ) instanceof AbstractBlock &&
                        $this->getBlock()->appliesToRight( 'edit' );
        }
 
@@ -2170,11 +2172,11 @@ class User implements IDBAccessObject, UserIdentity {
         * Get the block affecting the user, or null if the user is not blocked
         *
         * @param bool $fromReplica Whether to check the replica DB instead of the master
-        * @return Block|null
+        * @return AbstractBlock|null
         */
        public function getBlock( $fromReplica = true ) {
                $this->getBlockedStatus( $fromReplica );
-               return $this->mBlock instanceof Block ? $this->mBlock : null;
+               return $this->mBlock instanceof AbstractBlock ? $this->mBlock : null;
        }
 
        /**
@@ -2230,7 +2232,7 @@ class User implements IDBAccessObject, UserIdentity {
         * @return bool True if blocked, false otherwise
         */
        public function isBlockedGlobally( $ip = '' ) {
-               return $this->getGlobalBlock( $ip ) instanceof Block;
+               return $this->getGlobalBlock( $ip ) instanceof AbstractBlock;
        }
 
        /**
@@ -2239,7 +2241,7 @@ class User implements IDBAccessObject, UserIdentity {
         * This is intended for quick UI checks.
         *
         * @param string $ip IP address, uses current client if none given
-        * @return Block|null Block object if blocked, null otherwise
+        * @return AbstractBlock|null Block object if blocked, null otherwise
         * @throws FatalError
         * @throws MWException
         */
@@ -2261,7 +2263,7 @@ class User implements IDBAccessObject, UserIdentity {
 
                if ( $blocked && $block === null ) {
                        // back-compat: UserIsBlockedGlobally didn't have $block param first
-                       $block = new Block( [
+                       $block = new SystemBlock( [
                                'address' => $ip,
                                'systemBlock' => 'global-block'
                        ] );
@@ -4392,7 +4394,7 @@ class User implements IDBAccessObject, UserIdentity {
 
        /**
         * Get whether the user is explicitly blocked from account creation.
-        * @return bool|Block
+        * @return bool|AbstractBlock
         */
        public function isBlockedFromCreateAccount() {
                $this->getBlockedStatus();
@@ -4406,7 +4408,7 @@ class User implements IDBAccessObject, UserIdentity {
                if ( $this->mBlockedFromCreateAccount === false && !$this->isAllowed( 'ipblock-exempt' ) ) {
                        $this->mBlockedFromCreateAccount = Block::newFromTarget( null, $this->getRequest()->getIP() );
                }
-               return $this->mBlockedFromCreateAccount instanceof Block
+               return $this->mBlockedFromCreateAccount instanceof AbstractBlock
                        && $this->mBlockedFromCreateAccount->appliesToRight( 'createaccount' )
                        ? $this->mBlockedFromCreateAccount
                        : false;
index 5106c17..66b6566 100644 (file)
@@ -6,7 +6,6 @@ use Hooks;
 use Html;
 use MediaWiki\MediaWikiServices;
 use MediaWiki\Widget\SearchInputWidget;
-use MWNamespace;
 use SearchEngineConfig;
 use SpecialSearch;
 use Xml;
@@ -240,7 +239,8 @@ class SearchFormWidget {
                $activeNamespaces = $this->specialSearch->getNamespaces();
                $langConverter = $this->specialSearch->getLanguage();
                foreach ( $this->searchConfig->searchableNamespaces() as $namespace => $name ) {
-                       $subject = MWNamespace::getSubject( $namespace );
+                       $subject = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               getSubject( $namespace );
                        if ( !isset( $rows[$subject] ) ) {
                                $rows[$subject] = "";
                        }
index 539bdf4..7b89a9c 100644 (file)
@@ -27,6 +27,7 @@
  */
 
 use CLDRPluralRuleParser\Evaluator;
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Assert\Assert;
 
 /**
@@ -506,7 +507,8 @@ class Language {
                if ( is_null( $this->namespaceNames ) ) {
                        global $wgMetaNamespace, $wgMetaNamespaceTalk, $wgExtraNamespaces;
 
-                       $validNamespaces = MWNamespace::getCanonicalNamespaces();
+                       $validNamespaces = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               getCanonicalNamespaces();
 
                        $this->namespaceNames = $wgExtraNamespaces +
                                self::$dataCache->getItem( $this->mCode, 'namespaceNames' );
@@ -744,7 +746,8 @@ class Language {
         */
        public function getNsIndex( $text ) {
                $lctext = $this->lc( $text );
-               $ns = MWNamespace::getCanonicalIndex( $lctext );
+               $ns = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       getCanonicalIndex( $lctext );
                if ( $ns !== null ) {
                        return $ns;
                }
index 137e7ea..a950c79 100644 (file)
        "blocklink": "امنع",
        "unblocklink": "ارفع المنع",
        "change-blocklink": "تغيير المنع",
+       "empty-username": "(لا يوجد اسم مستخدم متاح)",
        "contribslink": "مساهمات",
        "emaillink": "أرسل بريدا إلكترونيا",
        "autoblocker": "تم منعك تلقائيا لأن الأيبي الخاص بك تم استخدامه مؤخرا بواسطة \"[[User:$1|$1]]\".\nالسبب المعطى لمنع $1 هو: \"$2\"",
index 5104364..8497c07 100644 (file)
        "savearticle": "Guardar la páxina",
        "savechanges": "Guardar los cambios",
        "publishpage": "Publicar la páxina",
-       "publishchanges": "Publicar los cambios",
+       "publishchanges": "Espublizar los cambeos",
        "savearticle-start": "Guardar la páxina...",
        "savechanges-start": "Guardar los cambios...",
        "publishpage-start": "Publicar la páxina...",
index 6720cc5..1865722 100644 (file)
        "revdelete-show-file-confirm": "\"<nowiki>$1</nowiki>\" faylının $2 $3 tarixli silinmiş bir redaktəsini görmək istədiyinizdən əminsizinizmi?",
        "revdelete-show-file-submit": "Bəli",
        "logdelete-selected": "Jurnalın {{PLURAL:$1|seçilmiş qeydi|seçilmiş qeydləri}}:",
+       "logdelete-text": "Silinən versiyalar jurnalda hələ də görünəcək, ancaq onların məzmununun müəyyən hissəsi iştirakçılar üçün əlçatmaz olacaqdır.",
+       "revdelete-text-others": "Əlavə məhdudiyyətlər müəyyən edilmədiyi halda, digər idarəçilər hələ də gizli məzmuna giriş edə, onu geri qaytara bilərlər.",
        "revdelete-legend": "Məhdudiyyətləri müəyyənləşdir:",
        "revdelete-hide-text": "Dəyişikliyin mətni",
        "revdelete-hide-image": "Faylın məzmununu gizlə",
index 00e65d3..2d8c17e 100644 (file)
                        "Sultanselim baloch"
                ]
        },
-       "tog-underline": ":لینکانآ خط کش",
-       "tog-hideminor": "هوردین تغییراتآ ته نوکین تغییرات پناه کن",
+       "tog-underline": ":لینکاں کِشک کن",
+       "tog-hideminor": "ھوردݔں ٹگلاں پناہ کن",
        "tog-hidepatrolled": "ته نوکین تغییرات اصلاحاتی که گردگ بیتگن پناه کن",
-       "tog-newpageshidepatrolled": "پناه کتن صفحاتی که گردگ بوتگن چه لیست نوکین صفحه",
-       "tog-extendwatchlist": "لیست چارگ مزن کن دان کل تغییرات پیش داریت نه که فقط نوکینءَ",
-       "tog-usenewrc": "گرÙ\88پء ØªØºÛ\8cÛ\8cراÙ\86 ØªØ§Ú©Ø¡ Ù\88استÙ\87 Ù\85اÙ\86 Ù\86Ù\88Ú©Û\8cÙ\86 ØªØºÛ\8cÛ\8cراÙ\86 Ø¡Ù\8f Ú\86ارÙ\88Ú© Ù\84Û\8cست",
-       "tog-numberheadings": "اتÙ\88Ù\85اتÛ\8cÚ© Ø´Ù\85ارÙ\87 Ú©ØªÙ\86 Ø¹Ù\86اÙ\88Û\8cن",
-       "tog-editondblclick": "ویبتاکانء مان دو کلیک ٹگل بدئ",
+       "tog-newpageshidepatrolled": "تاکاتے کہ گندگ بیتگ اَنت پناہ کن",
+       "tog-extendwatchlist": "چارگ لیستءَ مزن کن کہ دراھیگݔں گندگ بہ بَنت",
+       "tog-usenewrc": "گرÙ\88پء ØªØ§Ú© Ø¡Ù\8f Ú\86ارگ Ù\84Û\8cستء Ù¹Ú¯Ù\84اں",
+       "tog-numberheadings": "سرگاÙ\84اں Ù\88تاÙ\88ت ØªØ±ØªÛ\8cÙ¾ Ú©ن",
+       "tog-editondblclick": "وبتاکاں پہ دو مݔن ٹگل دئے",
        "tog-editsectiononrightclick": "فعال کتن زرتگین بهرء اصلاح کتن گون کلیک زرتگین عنوانانء سرا",
-       "tog-watchcreations": "Ù\85Ù\86Û\8c Ø§Ú\88 Ú©ØªÚ¯Û\8cÙ\86 Ù¾Û\8cج Ù\88 Ø§Ù¾Ù\84Ù\88د Ú©ØªÚ¯Û\8cÙ\86 Ù\81اÛ\8cÙ\84اÙ\86Ø¡ Ú\86ارگ Ù\84Û\8cستء ØªÙ\88کا Ù\87Ù\88ار کن",
-       "tog-watchdefault": "منی اصلاح کتگین فایل و پیجانء چارگ لیستء توکا هوار کن",
-       "tog-watchmoves": "منی سُرینتگین فایل و پیجانء چارگ لیستء توکا هوار کن",
-       "tog-watchdeletion": "منی حذف کتگین فایل و پیجانء چارگ لیستء توکا هوار بکن",
-       "tog-watchrollback": "Ø¢ Ø¯Û\8cÙ\85اÙ\86Û\8c Ø¢Ú\88 Ú©Ù\88رتÛ\8cÙ\86 Ú©Ù\87 Ø¢Ù\88اÙ\86ا Ø¨Ø±Ú¯Ø±Ø¯Ø§Ù\86 Ú©Ù\88رتÙ\87 Ø§Ù\88Ù\86 Ù¾Ù\87 Ù\85Ù\86Û\8c Ù¾Û\8cÚ¯Û\8cرÛ\8c Ù\84Û\8cستÛ\8c Ù\87اتÛ\8cرا",
-       "tog-minordefault": "په طور پیش فرض کل اصلاحات آ په داب جزی مشخص کن",
+       "tog-watchcreations": "Ù\85Ù\86Û\8c Ø¬Û\8fÚ\88 Ú©Ù\8fتگÝ\94Úº ØªØ§Ú© Ø¡Ù\8f Ø³Ø±Ú¯Ý\94تکگÝ\94Úº Ù¾Ø§Û\8cÙ\84اں Ú\86ارگ Ù\84Û\8cستءÙ\8e Ú¾Û\8fر کن",
+       "tog-watchdefault": "منی ٹگل داتگݔں تاک ءُ پایلان چارگ لیستءَ ھۏر کن",
+       "tog-watchmoves": "منی سُرݔنتگݔں تاک ءُ پایلان چارگ لیستءَ ھۏر کن",
+       "tog-watchdeletion": "منی پاک کتگݔں تاک ءُ پایلان چارگ لیستءَ ھۏر کن",
+       "tog-watchrollback": "Ø¢ ØªØ§Ú©Ø§Úº Ú©Û\81 Ú\86ھر Ø¯Ø§ØªÚ¯Ù\86 Ù\85Ù\86Û\8c  Ú\86ارگ Ù\84Û\8cستءÙ\8e Ú¾Û\8fر Ú©Ù\86",
+       "tog-minordefault": "دراھیگݔں ٹگلاں پݔسری پئیما کن",
        "tog-previewontop": "بازبین پیش دار پیش چه جعبه اصلاح",
        "tog-previewonfirst": "ته اولین اصلاح بازبینی پیش دار",
        "tog-enotifwatchlistpages": "وهدی که یک پیج یان که فایلء ٹگل وارت پر منء ایمیل دیم بدئ",
        "tog-norollbackdiff": "تفاوتء حذف کن بعد چه اجرای یک ترینگ",
        "tog-useeditwarning": "وهدی دربیگ مان اصلاح کتگین پیج اگان تغییران سیو نبوت اتنت منء هشتار بدئ",
        "tog-prefershttps": "پر مان بوتنء واسته هروهدء یک ایمنین کنکشنء کارمرز بکن",
-       "underline-always": "یکسره",
-       "underline-never": "هچ وهد",
-       "underline-default": "وفاولتء پێم پر برۆزر یان پۆسته",
-       "editfont-style": "اصلاح کنۆکێن فۆنتء استایل",
-       "editfont-monospace": "Ù\81Û\86Ù\86ت Ú¯Û\86Ù\86 Ù\85اÙ\84Ù\88Ù\85Û\8eÙ\86 Ù¾Ø§Ø³Ù\84Ú¯",
-       "editfont-sansserif": "بئ گۆشگێن فۆنت",
-       "editfont-serif": "گۆشه دارێن فۆنت",
-       "sunday": "Û\8cÚ© Ø´Ù\85بÛ\8c",
-       "monday": "دÙ\88Ø´Ù\85بÛ\8c",
-       "tuesday": "سئه شمبی",
-       "wednesday": "Ú\86ارشÙ\85بÛ\8c",
-       "thursday": "Ù¾Ù\86Ú\86 Ø´Ù\85بÛ\8c",
-       "friday": "آدÛ\8cÙ\86Ú¯ Ù¬Ø¬Ù\88Ù\85ا",
-       "saturday": "Ø´Ù\85بÛ\8c",
-       "sun": "یک شمی",
-       "mon": "دÙ\88 Ø´Ù\85بÛ\8c",
-       "tue": "سئه شمبی",
-       "wed": "چار شمبی",
-       "thu": "پنچ شمبی",
-       "fri": "آدینگ٬ جوما",
-       "sat": "Ø´Ù\85بÛ\8c",
-       "january": "جنوری",
-       "february": "پیبروری",
+       "underline-always": "دراہءَ",
+       "underline-never": "هچبر",
+       "underline-default": "بروزر پݔسری پئیما",
+       "editfont-style": "پونتءِ ٹگلݔنگ",
+       "editfont-monospace": "Ù¾Ù\88Ù\86ت Ú¯Û\8f Ø­Ø¯",
+       "editfont-sansserif": "بے سریکݔں پونت",
+       "editfont-serif": "سریکی پونت",
+       "sunday": "Û\8cÚ© Ø´Ù\86بÛ\81",
+       "monday": "دÙ\88Ø´Ù\86بÛ\81",
+       "tuesday": "سئ شنبہ",
+       "wednesday": "Ú\86ارشÙ\86بÛ\81",
+       "thursday": "Ù¾Ù\86Ú\86 Ø´Ù\86بÛ\81",
+       "friday": "جÙ\88Ù\85Û\81/آدÝ\94Ù\86Ú¯",
+       "saturday": "Ø´Ù\86بÛ\81",
+       "sun": "درۏچ",
+       "mon": "سرÛ\8fÚ\86",
+       "tue": "چرۏچ",
+       "wed": "پرۏچ",
+       "thu": "شرۏچ",
+       "fri": "ھرۏچ",
+       "sat": "زرÛ\8fÚ\86",
+       "january": "ژانویہ",
+       "february": "پبرݔر",
        "march": "مارچ",
-       "april": "آپریل",
+       "april": "آپرݔل",
        "may_long": "می",
-       "june": "جون",
-       "july": "جولای",
+       "june": "جۏن",
+       "july": "جۏلی",
        "august": "آگوست",
-       "september": "سپٹامبر",
+       "september": "سپتمبر",
        "october": "اکتوبر",
        "november": "نوامبر",
        "december": "دسمبر",
-       "january-gen": "جنوری",
-       "february-gen": "پیبروری",
+       "january-gen": "جنۏری",
+       "february-gen": "پبرݔر",
        "march-gen": "مارچ",
-       "april-gen": "آپریل",
+       "april-gen": "آپرݔل",
        "may-gen": "می",
-       "june-gen": "جون",
-       "july-gen": "جولای",
+       "june-gen": "جۏن",
+       "july-gen": "جۏلی",
        "august-gen": "آگوست",
-       "september-gen": "سپٹامبر",
+       "september-gen": "سپتمبر",
        "october-gen": "اکتوبر",
        "november-gen": "نوامبر",
        "december-gen": "دسمبر",
-       "jan": "جنوری",
-       "feb": "پیبروری",
+       "jan": "جنو",
+       "feb": "پبر",
        "mar": "مارچ",
        "apr": "آپریل",
        "may": "می",
-       "jun": "جون",
-       "jul": "جولای",
-       "aug": "آگوست",
-       "sep": "سپٹ\tامبر",
+       "jun": "جۏن",
+       "jul": "جۏل",
+       "aug": "آگو",
+       "sep": "سپتمبر",
        "oct": "اکتوبر",
        "nov": "نوامبر",
        "dec": "دسمبر",
-       "january-date": "جنوری، بهارگاه $1",
-       "february-date": "پیبروری، اۆستپان $1",
-       "march-date": "مارچ، مۆلمان $1",
-       "april-date": "اپرÛ\8cÙ\84Ø\8c Ú©Ø±Ø§ $1",
-       "may-date": "مئ، سۆچکان $1",
-       "june-date": "جون، جلکان $1",
-       "july-date": "جولای، سهێل $1",
-       "august-date": "اگÙ\88ستØ\8c Ø³Ø§Ú\86اÙ\86 $1",
-       "september-date": "سپٹامبر، تۆمشان $1",
-       "october-date": "اکتۆبر، سارتان $1",
-       "november-date": "نوامبر، گۆپشان $1",
-       "december-date": "دسمبر، تۆمشان $1",
-       "period-am": "صبح",
-       "period-pm": "عصر",
+       "january-date": "جنۏری $1",
+       "february-date": "پبرݔر$1",
+       "march-date": "مارچ $1",
+       "april-date": "آپرÝ\94Ù\84 $1",
+       "may-date": "می $1",
+       "june-date": "جۏن $1",
+       "july-date": "جۏلی $1",
+       "august-date": "Ø¢Ú¯Ù\88ست $1",
+       "september-date": "سپتمبر $1",
+       "october-date": "اکتوبر $1",
+       "november-date": "نومبر $1",
+       "december-date": "دسمبر $1",
+       "period-am": "SW",
+       "period-pm": "BW",
        "pagecategories": "{{PLURAL:$1|دسته|دسته جات}}",
-       "category_header": "صÙ\81حات ØªÙ\87 Ø¯Ø³ØªÙ\87 \"$1\"",
-       "subcategories": "زیردسته جات",
-       "category-media-header": "مدیا ته دسته \"$1\"",
-       "category-empty": "''ای دسته ی هچ صفحه یا مدیا نیست''",
+       "category_header": "تاک Ù\85Û\81 Ø¯Ø³ØªÛ\81 \"$1\"",
+       "subcategories": "چݔردستہ",
+       "category-media-header": "رسانک مہ دستہ \"$1\"",
+       "category-empty": "<em>''اے دستگءَ ھچ رسانک نے''</em>",
        "hidden-categories": "{{PLURAL:$1|پناهین دسته|پناهین دسته جات}}",
        "hidden-category-category": "پناهین دسته جات",
        "category-subcat-count": "{{PLURAL:$2|ای دسته فقط جهلیگین زیر دسته ای هست..|ای دسته  جهلیگین {{PLURAL:$1|subcategory|$1 زیردسته}}, چه $2 کل.}}",
index 63a4659..c441b04 100644 (file)
        "action-unblockself": "разблякаваньне самога сябе",
        "action-noratelimit": "адсутнасьць абмежаваньня хуткасьці",
        "action-reupload-own": "перазапіс уласных існых файлаў",
+       "action-nominornewtalk": "дробныя праўкі, якія не паведамляюць удзельніку пра зьмены на старонцы абмеркаваньня",
+       "action-markbotedits": "пазначэньне адкатаў як правак робатам",
+       "action-patrolmarks": "прагляд адзнакаў патруляваньня апошніх зьменаў",
        "nchanges": "$1 {{PLURAL:$1|зьмена|зьмены|зьменаў}}",
        "enhancedrc-since-last-visit": "$1 {{PLURAL:$1|з апошняга візыту}}",
        "enhancedrc-history": "гісторыя",
        "listgrouprights-addgroup-self": "можа дадаць уласны рахунак да {{PLURAL:$2|1=групы|групаў}}: $1",
        "listgrouprights-removegroup-self": "можа выдаліць уласны рахунак з {{PLURAL:$2|1=групы|групаў}}: $1",
        "listgrouprights-addgroup-self-all": "Можа дадаць уласны рахунак да ўсіх груп",
-       "listgrouprights-removegroup-self-all": "Ð\9cожа Ð²Ñ\8bдалÑ\96Ñ\86Ñ\8c Ñ\83лаÑ\81нÑ\8b Ñ\80аÑ\85Ñ\83нак Ð· Ñ\9eÑ\81Ñ\96Ñ\85 Ð³Ñ\80Ñ\83п",
+       "listgrouprights-removegroup-self-all": "Ð\92Ñ\8bдаленÑ\8cне Ñ\9eлаÑ\81нага Ñ\80аÑ\85Ñ\83нкÑ\83 Ð· Ñ\83Ñ\81Ñ\96Ñ\85 Ð³Ñ\80Ñ\83паÑ\9e",
        "listgrouprights-namespaceprotection-header": "Абмежаваньні прасторы назваў",
        "listgrouprights-namespaceprotection-namespace": "Прастора назваў",
        "listgrouprights-namespaceprotection-restrictedto": "Правы, якія дазваляюць удзельніку рэдагаваць",
index 880db61..541508b 100644 (file)
        "rcfilters-savedqueries-already-saved": "Тези филтри вече са съхранени. Променете настройките си, за да създадете нов Запазен филтър.",
        "rcfilters-restore-default-filters": "Възстановяване на филтрите по подразбиране",
        "rcfilters-clear-all-filters": "Изчистване на всички филтри",
-       "rcfilters-show-new-changes": "Преглед на най-новите промени от $1",
+       "rcfilters-show-new-changes": "Преглед на най-новите промени след $1",
        "rcfilters-search-placeholder": "Филтриране на промените (използвайте менюто или търсете по име на филтър)",
        "rcfilters-invalid-filter": "Невалиден филтър",
        "rcfilters-empty-filter": "Няма активни филтри. Показани са всички редакции.",
index 478ecef..993c58d 100644 (file)
        "category-file-count-limited": "Tumbung ngini baisi {{PLURAL:$1|barakas|$1 barakas}} barikut.",
        "listingcontinuesabbrev": "samb.",
        "index-category": "Tungkaran tasusun bapadalakan kata",
-       "noindex-category": "Tungkaran kada tasusun bapadalakan kata",
+       "noindex-category": "Tungkaran nang diindéks",
        "broken-file-category": "Tutungkaran lawan tatautan barakas pagat",
        "about": "Pasal",
        "article": "Tungkaran isi",
        "youhavenewmessages": "Pian baisi $1 ($2)",
        "youhavenewmessagesfromusers": "Pian baisi $1 matan {{PLURAL:$3|$3 pamakai lain}} ($2).",
        "youhavenewmessagesmanyusers": "Pian baisi $1 matan pamakai lain ($2).",
-       "newmessageslinkplural": "{{PLURAL:$1|pasan hanyar}}",
-       "newmessagesdifflinkplural": "{{PLURAL:$1|paubahan}} pahabisnya",
+       "newmessageslinkplural": "{{PLURAL:$1|pasan hanyar|pasan hanyar}}",
+       "newmessagesdifflinkplural": "{{PLURAL:$1|paubahan|999=paubahan}} pauncitnya",
        "youhavenewmessagesmulti": "Pian baisi pasan hanyar dalam $1",
        "editsection": "babak",
        "editold": "babak",
        "userpage-userdoesnotexist": "Akun pamakai \"<nowiki>$1</nowiki>\" kada tadaptar.\nMuhun pariksa/ditukui amun Pian handak maulah/mambabak tungkaran ngini.",
        "userpage-userdoesnotexist-view": "Akun pamakai \"$1\" kada tadaptar.",
        "blocked-notice-logextract": "Pamakai nangini parhatan diblukir.\nLog blukir pahabisannya tasadia di bawah ngini gasan rujukan:",
-       "clearyourcache": "x'''Catatan: Habis manyimpan, Pian harus malingarakan cache panjalajah web Pian hagan malihat paubahan.'''\n*'''Firefox/Safari:''' tahan ''Shift'' parhatan klik ''Reload'', atawa picik ''Ctrl-F5'' atawa ''Ctrl-R'' (''Command-R'' pada sabuting Mac);\n* '''Google Chrome:''' picik ''Ctrl-Shift-R'' (''Command-Shift-R''  pada sabuting Mac)\n*'''Internet Explorer:''' tahan ''Ctrl'' parhatan klik ''Refresh,'' atawa picik ''Ctrl-F5''\n* '''Konqueror:''' kalik ''Reload'' atawa picik ''F5''\n*'''Opera:''' barasihakan cache pada ''Tools → Preferences''",
+       "clearyourcache": "<strong>Catatan:</strong>Limbah disimpan, Pian mungkin parlu malincau talih paramban wéb gasan malihat paubahan.\n* <strong>Firefox/Safari:</strong> Tahan <em>Shift</em> wayah dikalik <em>Reload</em>, atawa tikin <em>Ctrl-F5</em> atawa <em>Ctrl-R</em> (<em>⌘-R</em> di Mac)\n* <strong>Google Chrome:</strong> Tikin <em>Ctrl-Shift-R</em> (<em>⌘-Shift-R</em> di Mac)\n* <strong>Internet Explorer:</strong> Tikin <em>Ctrl</em> wayah dikalik <em>Refresh</em>, atawa tikin <em>Ctrl-F5</em>\n* <strong>Opera:</strong> Tulak ka <em>Menu → Settings </em> (<em>Opera → Preferences</em> di Mac) lalu ka <em>Privacy & security → Clear browsing data → Cached images and files</em>.",
        "usercssyoucanpreview": "'''Tip:''' Puruk picikan \"{{int:showpreview}}\" hagan tis CSS hanyar Pian sabalum manyimpan.",
        "userjsyoucanpreview": "'''Tip:''' Puruk picikan \"{{int:showpreview}}\" hagan tis JavaScript hanyar Pian sabalum manyimpan.",
        "usercsspreview": "'''Ingatakan bahwasa Pian manilik pamakai CSS Pian haja.'''\n'''Nangini baluman tasimpan pulang!'''",
        "booksources-text": "Di bawah adalah sabuah daptar tautan ka situs lain nang manjual bubuku hanyar wan bakas, wan jua baisi panjalasan labih pasal bubuku nang Pian ugai:",
        "booksources-invalid-isbn": "ISBN nang dibari mancungul kada sah; pariksa kalua-ai tasalah marekap matan asal-mula aslinya.",
        "specialloguserlabel": "Pamakai:",
-       "speciallogtitlelabel": "Tujuan (judul atawa pamakai):",
+       "speciallogtitlelabel": "Tujuan (judul atawa {{ns:user}}:ngaran pamakai gasan pamakai)",
        "log": "Log",
        "all-logs-page": "Samunyaan log umum",
        "alllogstext": "Tampaian baimbai matan sabataan log nang ada matan {{SITENAME}}.\nPian kada mawatasi tiringan lawan mamilih sabuah macam log, ngaran-pamuruk (sansitip kapital), atawa tungkaran tapangaruh (sansitip kapital jua).",
        "emailuserfooter": "Suril ngini dikirim ulih $1 hagan $2 lung pungsi \"Suril pamuruk\" pada {{SITENAME}}.",
        "usermessage-summary": "Tinggalakan sistim pasan.",
        "usermessage-editor": " Sistim panyampai pasan",
-       "watchlist": "Daptar itihan ulun",
+       "watchlist": "Daptar itihan",
        "mywatchlist": "Daptar itihan",
        "watchlistfor2": "Gasan $1 $2",
        "nowatchlist": "Pian kada baisi apa pun pada daptar itihan Pian.",
        "pageinfo-length": "Panjang tungkaran (dalam bita)",
        "pageinfo-article-id": "ID Tungkaran",
        "pageinfo-language": "Bahasa isi tungkaran",
-       "pageinfo-robot-policy": "Status masin panggagai",
-       "pageinfo-robot-index": "Kawa diindeks",
+       "pageinfo-content-model": "Mudil isi tungkaran",
+       "pageinfo-robot-policy": "Pangindéksan ulih robot",
+       "pageinfo-robot-index": "Dibulihakan",
        "pageinfo-robot-noindex": "Kada kawa diindeks",
        "pageinfo-watchers": "Jumlah pa-itih tungkaran",
        "pageinfo-few-watchers": "Kurang matan $1 {{PLURAL:$1|pa-ilang}}",
-       "pageinfo-redirects-name": "Paugahan ka tungkaran ngini",
+       "pageinfo-redirects-name": "Jumlah paugahan ka tungkaran ngini",
        "pageinfo-subpages-name": "Subtungkaran tungkaran ngini",
        "pageinfo-subpages-value": "$1 ($2 {{PLURAL:$2|paugahan|paugahan}}; $3 {{PLURAL:$3|non-paugahan|non-paugahan}})",
        "pageinfo-firstuser": "Pa-ulah tungkaran",
        "version-software-product": "Produk",
        "version-software-version": "Virsi",
        "version-entrypoints-header-url": "URL",
+       "redirect": "Paugahan badasarakan ID barakas, pamakai, tungkaran, ralatan, atawa log",
        "redirect-submit": "Lanjut",
        "redirect-lookup": "Panggagaian:",
        "redirect-value": "Nilai:",
        "tags-description-header": "Diskripsi hibak matan arti",
        "tags-hitcount-header": "Gantungan diganti",
        "tags-edit": "babak",
-       "tags-hitcount": "$1 {{PLURAL:$1|paubahan|paubahan}}",
+       "tags-hitcount": "$1 {{PLURAL:$1|paubahan}}",
        "comparepages": "Bandingakan tutungkaran",
        "compare-page1": "Tungkaran 1",
        "compare-page2": "Tungkaran 2",
        "logentry-delete-delete": "$1 {{GENDER:$2|mahapus}} tungkaran $3",
        "logentry-delete-restore": "$1 dibulikakan tungkaran $3",
        "logentry-delete-event": "$1 mangganti kakawaan dijanaki {{PLURAL:$5|sabuah log kajadian|$5 log kajadian}} pintangan $3: $4",
-       "logentry-delete-revision": "$1 mangganti kakawaan dijanaki {{PLURAL:$5|sabuah ralatan|$5 ralatan}} pintangan tungkaran $3: $4",
+       "logentry-delete-revision": "$1 {{GENDER:$2|maubah}} tampaian {{PLURAL:$5|$5 ralatan}} di tungkaran $3: $4",
        "logentry-delete-event-legacy": "$1 mangganti kakawaan dijanaki log kajadian pintangan $3",
        "logentry-delete-revision-legacy": "$1 mangganti kakawaan dijanaki ralatan pintangan tungkaran $3",
        "logentry-suppress-delete": "$1 ditikin tungkaran $3",
        "revdelete-unrestricted": "Buang pambatasan gasan pambakal-pambakal",
        "logentry-move-move": "$1 {{GENDER:$2|mamindahakan}} tungkaran $3 ka $4",
        "logentry-move-move-noredirect": "$1 {{GENDER:$2|mamindahakan}} tungkaran $3 ka $4 kada pakai maulah paugahan",
-       "logentry-move-move_redir": "$1 diugah tungkaran $3 ka $4 lung paugahan",
+       "logentry-move-move_redir": "$1 {{GENDER:$2|mamindahakan}} tungkaran $3 ka $4 manimpa paugahan lawas",
        "logentry-move-move_redir-noredirect": "$1 diugah tungkaran $3 ka $4 lung sabuah paugahan awan-kada maninggalakan sabuah paugahan",
        "logentry-patrol-patrol": "$1 diciri'i ralatan $4 matan tungkaran $3 taawasi",
        "logentry-patrol-patrol-auto": "$1 utumatis diciri'i ralatan $4 matan tungkaran $3 taawasi",
        "logentry-newusers-newusers": "$1 ma-ulah sabuting akun pamakai",
        "logentry-newusers-create": "$1 {{GENDER:$2|maulah}} akun pamakai",
        "logentry-newusers-create2": "$1 ma-ulah sabuting akun pamakai $3",
-       "logentry-newusers-autocreate": "Akun $1 utumatis diulah",
+       "logentry-newusers-autocreate": "Akun $1 {{GENDER:$2|diulah}} sacara utumatis",
        "logentry-upload-upload": "$1 {{GENDER:$2|ma-unggah}} $3",
        "rightsnone": "(kadada)",
        "feedback-adding": "Manambahi kitihanbalik ka tungkaran...",
        "api-error-stashfailed": "Kasalahan intarnal: server gagal manyimban barakas samantara.",
        "api-error-unknown-warning": "Paringatan kada dipinandui: \"$1\".",
        "api-error-unknownerror": "Kasalahan kada dipinandui: \"$1\".",
+       "duration-days": "$1 {{PLURAL:$1|hari}}",
        "special-characters-group-latin": "Latin",
        "special-characters-group-ipa": "IPA",
        "special-characters-group-symbols": "Simbul",
        "special-characters-group-gujarati": "Gujarati",
        "special-characters-group-thai": "Thai",
        "special-characters-group-lao": "Lao",
-       "special-characters-group-khmer": "Khmer"
+       "special-characters-group-khmer": "Khmer",
+       "randomrootpage": "Tungkaran dasar sambarang"
 }
index 725b8e9..0efca22 100644 (file)
        "pageinfo-robot-noindex": "অনুনমোদিন",
        "pageinfo-watchers": "পাতাটি প্রদর্শনের সংখ্যা",
        "pageinfo-visiting-watchers": "পাতা পর্যবেক্ষকদের সংখ্যা যারা সাম্প্রতিক সম্পাদনাগুলি পরিদর্শন করেছেন",
-       "pageinfo-few-watchers": "$1 জন {{PLURAL:$1|নজরকারীও}} কম",
+       "pageinfo-few-watchers": "$1 à¦\9cন {{PLURAL:$1|নà¦\9cরà¦\95ারà§\80রà¦\93}} à¦\95ম",
        "pageinfo-few-visiting-watchers": "সাম্প্রতিক সম্পাদনাগুলি সম্ভবত একজন নজরকারী পর্যবেক্ষক করেছেন বা করেনি",
        "pageinfo-redirects-name": "এই পাতায় পুননির্দেশনাসমূহের সংখ্যা",
        "pageinfo-subpages-name": "এই পাতার উপপাতাসমূহ",
index 53b0054..9d893d6 100644 (file)
        "blocklist-tempblocks": "Skjul midlertidige blokeringer",
        "blocklist-addressblocks": "Skjul enkel IP blokeringer",
        "blocklist-type": "Type:",
+       "blocklist-type-opt-all": "Alle",
        "blocklist-type-opt-partial": "Delvis",
        "blocklist-rangeblocks": "Skjul blokeringsklasser",
        "blocklist-timestamp": "Tidsstempel",
        "watchlistedit-normal-done": "{{PLURAL:$1|1 side|$1 sider}} er fjernet fra din overvågningsliste:",
        "watchlistedit-raw-title": "Direkte redigering af overvågningsliste",
        "watchlistedit-raw-legend": "Direkte redigering af overvågningsliste",
-       "watchlistedit-raw-explain": "Siderne i din overvågningsliste er vist nedenfor, og kan ændres ved at tilføje og fjerne fra listen;\nen side per linie\nNår du er færdig, klik \"{{int:Watchlistedit-raw-submit}}\".\nDu kan også [[Special:EditWatchlist|bruge standard editoren]].",
+       "watchlistedit-raw-explain": "Siderne i din overvågningsliste er vist nedenfor, og kan ændres ved&nb