Merge "HTMLForm: Remove parameters 'notice', 'notice-messages', 'notice-message'"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 24 Oct 2018 17:14:34 +0000 (17:14 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 24 Oct 2018 17:14:34 +0000 (17:14 +0000)
137 files changed:
RELEASE-NOTES-1.32
autoload.php
composer.json
docs/hooks.txt
includes/AutoLoader.php
includes/Block.php
includes/DefaultSettings.php
includes/EditPage.php
includes/api/ApiBase.php
includes/api/ApiBlock.php
includes/api/ApiEditPage.php
includes/api/ApiQueryBlocks.php
includes/api/ApiQueryUserInfo.php
includes/api/i18n/en.json
includes/api/i18n/pt-br.json
includes/api/i18n/pt.json
includes/api/i18n/qqq.json
includes/api/i18n/sv.json
includes/block/BlockRestriction.php [new file with mode: 0644]
includes/block/Restriction/AbstractRestriction.php [new file with mode: 0644]
includes/block/Restriction/PageRestriction.php [new file with mode: 0644]
includes/block/Restriction/Restriction.php [new file with mode: 0644]
includes/export/WikiExporter.php
includes/htmlform/HTMLForm.php
includes/htmlform/fields/HTMLTitlesMultiselectField.php [new file with mode: 0644]
includes/installer/i18n/ar.json
includes/installer/i18n/be-tarask.json
includes/installer/i18n/fr.json
includes/installer/i18n/ia.json
includes/installer/i18n/nb.json
includes/installer/i18n/pt-br.json
includes/installer/i18n/sv.json
includes/logging/BlockLogFormatter.php
includes/page/Article.php
includes/page/WikiPage.php
includes/preferences/DefaultPreferencesFactory.php
includes/resourceloader/ResourceLoaderEditToolbarModule.php [deleted file]
includes/specials/SpecialBlock.php
includes/specials/SpecialEmailuser.php
includes/specials/SpecialUpload.php
includes/specials/pagers/BlockListPager.php
includes/user/User.php
includes/widget/TitlesMultiselectWidget.php [new file with mode: 0644]
languages/Language.php
languages/LanguageConverter.php
languages/i18n/ace.json
languages/i18n/ar.json
languages/i18n/be-tarask.json
languages/i18n/bn.json
languages/i18n/de.json
languages/i18n/en.json
languages/i18n/eo.json
languages/i18n/eu.json
languages/i18n/fr.json
languages/i18n/gcr.json
languages/i18n/hr.json
languages/i18n/ia.json
languages/i18n/io.json
languages/i18n/it.json
languages/i18n/kjp.json
languages/i18n/ko.json
languages/i18n/li.json
languages/i18n/mk.json
languages/i18n/nb.json
languages/i18n/nl.json
languages/i18n/pt-br.json
languages/i18n/pt.json
languages/i18n/qqq.json
languages/i18n/ru.json
languages/i18n/sl.json
languages/i18n/sr-ec.json
languages/i18n/sv.json
languages/i18n/th.json
languages/i18n/yue.json
languages/i18n/zh-hant.json
languages/messages/MessagesAr.php
languages/messages/MessagesBe_tarask.php
languages/messages/MessagesDe.php
languages/messages/MessagesEn.php
languages/messages/MessagesFa.php
languages/messages/MessagesKsh.php
languages/messages/MessagesRu.php
maintenance/dictionary/mediawiki.dic
maintenance/jsduck/categories.json
resources/Resources.php
resources/src/mediawiki.special.block.js
resources/src/mediawiki.special.block.less [new file with mode: 0644]
resources/src/mediawiki.toolbar/images/ar/button_bold.png [deleted file]
resources/src/mediawiki.toolbar/images/ar/button_headline.png [deleted file]
resources/src/mediawiki.toolbar/images/ar/button_italic.png [deleted file]
resources/src/mediawiki.toolbar/images/ar/button_link.png [deleted file]
resources/src/mediawiki.toolbar/images/ar/button_nowiki.png [deleted file]
resources/src/mediawiki.toolbar/images/be-tarask/button_bold.png [deleted file]
resources/src/mediawiki.toolbar/images/be-tarask/button_italic.png [deleted file]
resources/src/mediawiki.toolbar/images/be-tarask/button_link.png [deleted file]
resources/src/mediawiki.toolbar/images/de/button_bold.png [deleted file]
resources/src/mediawiki.toolbar/images/de/button_italic.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_bold.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_extlink.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_headline.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_hr.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_image.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_italic.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_link.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_media.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_nowiki.png [deleted file]
resources/src/mediawiki.toolbar/images/en/button_sig.png [deleted file]
resources/src/mediawiki.toolbar/images/fa/button_bold.png [deleted file]
resources/src/mediawiki.toolbar/images/fa/button_headline.png [deleted file]
resources/src/mediawiki.toolbar/images/fa/button_italic.png [deleted file]
resources/src/mediawiki.toolbar/images/fa/button_link.png [deleted file]
resources/src/mediawiki.toolbar/images/fa/button_nowiki.png [deleted file]
resources/src/mediawiki.toolbar/images/ksh/LICENSE [deleted file]
resources/src/mediawiki.toolbar/images/ksh/button_italic.png [deleted file]
resources/src/mediawiki.toolbar/images/ru/LICENSE [deleted file]
resources/src/mediawiki.toolbar/images/ru/button_bold.png [deleted file]
resources/src/mediawiki.toolbar/images/ru/button_italic.png [deleted file]
resources/src/mediawiki.toolbar/images/ru/button_link.png [deleted file]
resources/src/mediawiki.toolbar/toolbar.js [deleted file]
resources/src/mediawiki.toolbar/toolbar.less [deleted file]
resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
resources/src/mediawiki.widgets/mw.widgets.TitlesMultiselectWidget.js [new file with mode: 0644]
tests/common/TestsAutoLoader.php
tests/phpunit/includes/BlockTest.php
tests/phpunit/includes/TitlePermissionTest.php
tests/phpunit/includes/api/ApiBlockTest.php
tests/phpunit/includes/api/ApiQueryBlocksTest.php [new file with mode: 0644]
tests/phpunit/includes/api/ApiQueryInfoTest.php
tests/phpunit/includes/api/ApiQueryUserInfoTest.php [new file with mode: 0644]
tests/phpunit/includes/block/BlockRestrictionTest.php [new file with mode: 0644]
tests/phpunit/includes/block/Restriction/PageRestrictionTest.php [new file with mode: 0644]
tests/phpunit/includes/block/Restriction/RestrictionTestCase.php [new file with mode: 0644]
tests/phpunit/includes/logging/BlockLogFormatterTest.php
tests/phpunit/includes/specials/SpecialBlockTest.php [new file with mode: 0644]
tests/phpunit/includes/specials/pagers/BlockListPagerTest.php [new file with mode: 0644]
tests/phpunit/languages/LanguageTest.php
tests/phpunit/languages/classes/LanguageSrTest.php

index 9e86cb0..5d11653 100644 (file)
@@ -135,7 +135,7 @@ production.
 ==== New external libraries ====
 * Added wikimedia/xmp-reader 0.6.0.
 * Added Add pear/Net_SMTP 1.8.0.
-* 
+* Added EasyDeflate (unversioned).
 
 ==== Changed external libraries ====
 * Updated qunitjs from 2.4.0 to 2.6.2.
@@ -147,11 +147,17 @@ production.
 * Updated jquery.i18n from 1.0.4 to 1.0.5.
 * Updated wikimedia/timestamp from 1.0.0 to 2.2.0.
 * Updated wikimedia/remex-html from 1.0.3 to 2.0.1.
-* Updated jquery from v3.2.1 to v3.3.1.
+* Updated jquery from 3.2.1 to 3.3.1.
+* Updated wikimedia/base-convert from 1.0.1 to 2.0.0
+* Updated OOjs from 2.2.0 to 2.2.2
+* Updated mustache.js from 0.8.2-d9aa703 to 1.0.0
+* Updated sinonjs from 1.17.3 to 1.17.7
+* Updated OOUI from 0.26.3 to 0.29.2
+* Updated CLDRPluralRuleParser from 0.1.0 to 1.3.2-pre
+* Updated jquery.client from 2.0.0 to 2.0.1.
 
 ==== Removed external libraries ====
 * pear/mail_mime-decode was removed.
-* …
 
 === Bug fixes in 1.32 ===
 * SpecialPage::execute() will now only call checkLoginSecurityLevel() if
@@ -420,6 +426,26 @@ because of Phabricator reports.
   * ApiUsageException::getCodeString() (deprecated in 1.29)
   * ApiUsageException::getMessageArray() (deprecated in 1.29)
 * Class UsageException, deprecated in 1.29, has been removed.
+* MediaWiki no longer has a 'JavaScript-powered' wikitext toolbar built in. The
+  old "bulletin board style toolbar", known as "the 2006 wikitext editor", has
+  been removed, and instead sysadmins will be required to choose one (or more)
+  of the several extensions available for this purpose if they need the
+  functionality. The MediaWiki "tarball" releases have included the replacement
+  extension for this, the WikiEditor extension aka "the 2010 wikitext editor",
+  for many years now. As part of this, several parts of MediaWiki have been
+  removed or simplified:
+  * The user option 'showtoolbar' (shown as "Show edit toolbar") is no longer
+    available; if an extension adds a toolbar via the EditPageBeforeEditToolbar
+    hook, it will be shown; extensions should provide a specific user preference
+    to disable themselves as needed.
+  * The public methods Language::getImageFile() and ::getImageFiles(), and the
+    related specification of $imageFiles within individual languages' code file,
+    as well as the referenced static media assets, all of which were only used
+    inside MediaWiki itself for providing the icons for the old toolbar, have
+    been removed without explicit deprecation.
+  * The internal ResourceLoader module "mediawiki.toolbar", which is unused
+    except by MediaWiki itself and back-compatibility code, has been removed.
+  * The internal ResourceLoaderEditToolbarModule class has been removed.
 
 === Deprecations in 1.32 ===
 * HTMLForm::setSubmitProgressive() is deprecated. No need to call it. Submit
index e3ce02c..f951ce9 100644 (file)
@@ -613,6 +613,7 @@ $wgAutoloadLocalClasses = [
        'HTMLTextField' => __DIR__ . '/includes/htmlform/fields/HTMLTextField.php',
        'HTMLTextFieldWithButton' => __DIR__ . '/includes/htmlform/fields/HTMLTextFieldWithButton.php',
        'HTMLTitleTextField' => __DIR__ . '/includes/htmlform/fields/HTMLTitleTextField.php',
+       'HTMLTitlesMultiselectField' => __DIR__ . '/includes/htmlform/fields/HTMLTitlesMultiselectField.php',
        'HTMLUserTextField' => __DIR__ . '/includes/htmlform/fields/HTMLUserTextField.php',
        'HTMLUsersMultiselectField' => __DIR__ . '/includes/htmlform/fields/HTMLUsersMultiselectField.php',
        'HTTPFileStreamer' => __DIR__ . '/includes/libs/filebackend/HTTPFileStreamer.php',
@@ -937,6 +938,7 @@ $wgAutoloadLocalClasses = [
        'MediaWiki\\Widget\\SelectWithInputWidget' => __DIR__ . '/includes/widget/SelectWithInputWidget.php',
        'MediaWiki\\Widget\\SizeFilterWidget' => __DIR__ . '/includes/widget/SizeFilterWidget.php',
        'MediaWiki\\Widget\\TitleInputWidget' => __DIR__ . '/includes/widget/TitleInputWidget.php',
+       'MediaWiki\\Widget\\TitlesMultiselectWidget' => __DIR__ . '/includes/widget/TitlesMultiselectWidget.php',
        'MediaWiki\\Widget\\UserInputWidget' => __DIR__ . '/includes/widget/UserInputWidget.php',
        'MediaWiki\\Widget\\UsersMultiselectWidget' => __DIR__ . '/includes/widget/UsersMultiselectWidget.php',
        'MemcLockManager' => __DIR__ . '/includes/libs/lockmanager/MemcLockManager.php',
@@ -1211,7 +1213,6 @@ $wgAutoloadLocalClasses = [
        'ResourceLoader' => __DIR__ . '/includes/resourceloader/ResourceLoader.php',
        'ResourceLoaderClientHtml' => __DIR__ . '/includes/resourceloader/ResourceLoaderClientHtml.php',
        'ResourceLoaderContext' => __DIR__ . '/includes/resourceloader/ResourceLoaderContext.php',
-       'ResourceLoaderEditToolbarModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderEditToolbarModule.php',
        'ResourceLoaderFileModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderFileModule.php',
        'ResourceLoaderFilePath' => __DIR__ . '/includes/resourceloader/ResourceLoaderFilePath.php',
        'ResourceLoaderForeignApiModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderForeignApiModule.php',
index d7a25e3..832645b 100644 (file)
@@ -34,7 +34,7 @@
                "psr/log": "1.0.2",
                "wikimedia/assert": "0.2.2",
                "wikimedia/at-ease": "1.2.0",
-               "wikimedia/base-convert": "1.0.1",
+               "wikimedia/base-convert": "2.0.0",
                "wikimedia/cdb": "1.4.1",
                "wikimedia/cldr-plural-rule-parser": "1.0.0",
                "wikimedia/composer-merge-plugin": "1.4.1",
index 90b2b05..ffefe97 100644 (file)
@@ -1480,11 +1480,10 @@ textarea in the edit form.
 &$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff"
 &$tabindex: HTML tabindex of the last edit check/button
 
-'EditPageBeforeEditToolbar': Allows modifying the edit toolbar above the
-textarea in the edit form.
-Hook subscribers can return false to avoid the default toolbar code being
-loaded.
-&$toolbar: The toolbar HTML
+'EditPageBeforeEditToolbar': Allow adding an edit toolbar above the textarea in
+the edit form.
+&$toolbar: The toolbar HTML, initially an empty `<div id="toolbar"></div>`
+Hook subscribers can return false to have no toolbar HTML be loaded.
 
 'EditPageCopyrightWarning': Allow for site and per-namespace customization of
 contribution/copyright notice.
index e4e59da..677fd01 100644 (file)
@@ -130,6 +130,7 @@ class AutoLoader {
        public static function getAutoloadNamespaces() {
                return [
                        'MediaWiki\\Auth\\' => __DIR__ . '/auth/',
+                       'MediaWiki\\Block\\' => __DIR__ . '/block/',
                        'MediaWiki\\Edit\\' => __DIR__ . '/edit/',
                        'MediaWiki\\EditPage\\' => __DIR__ . '/editpage/',
                        'MediaWiki\\Linker\\' => __DIR__ . '/linker/',
index bf8bad1..befc50c 100644 (file)
@@ -22,6 +22,8 @@
 
 use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
+use MediaWiki\Block\BlockRestriction;
+use MediaWiki\Block\Restriction\Restriction;
 use MediaWiki\MediaWikiServices;
 
 class Block {
@@ -79,6 +81,12 @@ class Block {
        /** @var string|null */
        private $systemBlockType;
 
+       /** @var bool */
+       private $isSitewide;
+
+       /** @var Restriction[] */
+       private $restrictions;
+
        # TYPE constants
        const TYPE_USER = 1;
        const TYPE_IP = 2;
@@ -129,6 +137,7 @@ class Block {
                        'allowUsertalk'   => false,
                        'byText'          => '',
                        'systemBlock'     => null,
+                       'sitewide'        => true,
                ];
 
                if ( func_num_args() > 1 || !is_array( $options ) ) {
@@ -165,6 +174,7 @@ class Block {
                $this->mHideName = (bool)$options['hideName'];
                $this->isHardblock( !$options['anonOnly'] );
                $this->isAutoblocking( (bool)$options['enableAutoblock'] );
+               $this->isSitewide( (bool)$options['sitewide'] );
 
                # Prevention measures
                $this->prevents( 'sendemail', (bool)$options['blockEmail'] );
@@ -236,6 +246,7 @@ class Block {
                        'ipb_block_email',
                        'ipb_allow_usertalk',
                        'ipb_parent_block_id',
+                       'ipb_sitewide',
                ] + CommentStore::getStore()->getFields( 'ipb_reason' );
        }
 
@@ -266,6 +277,7 @@ class Block {
                                'ipb_block_email',
                                'ipb_allow_usertalk',
                                'ipb_parent_block_id',
+                               'ipb_sitewide',
                        ] + $commentQuery['fields'] + $actorQuery['fields'],
                        'joins' => $commentQuery['joins'] + $actorQuery['joins'],
                ];
@@ -292,6 +304,10 @@ class Block {
                        && $this->prevents( 'sendemail' ) == $block->prevents( 'sendemail' )
                        && $this->prevents( 'editownusertalk' ) == $block->prevents( 'editownusertalk' )
                        && $this->mReason == $block->mReason
+                       && $this->isSitewide() == $block->isSitewide()
+                       // Block::getRestrictions() may perform a database query, so keep it at
+                       // the end.
+                       && BlockRestriction::equals( $this->getRestrictions(), $block->getRestrictions() )
                );
        }
 
@@ -477,6 +493,7 @@ class Block {
 
                $this->isHardblock( !$row->ipb_anon_only );
                $this->isAutoblocking( $row->ipb_enable_autoblock );
+               $this->isSitewide( (bool)$row->ipb_sitewide );
 
                $this->prevents( 'createaccount', $row->ipb_create_account );
                $this->prevents( 'sendemail', $row->ipb_block_email );
@@ -510,7 +527,11 @@ class Block {
                }
 
                $dbw = wfGetDB( DB_MASTER );
+
+               BlockRestriction::deleteByParentBlockId( $this->getId() );
                $dbw->delete( 'ipblocks', [ 'ipb_parent_block_id' => $this->getId() ], __METHOD__ );
+
+               BlockRestriction::deleteByBlockId( $this->getId() );
                $dbw->delete( 'ipblocks', [ 'ipb_id' => $this->getId() ], __METHOD__ );
 
                return $dbw->affectedRows() > 0;
@@ -546,7 +567,12 @@ class Block {
 
                $dbw->insert( 'ipblocks', $row, __METHOD__, [ 'IGNORE' ] );
                $affected = $dbw->affectedRows();
-               $this->mId = $dbw->insertId();
+               if ( $affected ) {
+                       $this->setId( $dbw->insertId() );
+                       if ( $this->restrictions ) {
+                               BlockRestriction::insert( $this->restrictions );
+                       }
+               }
 
                # Don't collide with expired blocks.
                # Do this after trying to insert to avoid locking.
@@ -564,9 +590,13 @@ class Block {
                        );
                        if ( $ids ) {
                                $dbw->delete( 'ipblocks', [ 'ipb_id' => $ids ], __METHOD__ );
+                               BlockRestriction::deleteByBlockId( $ids );
                                $dbw->insert( 'ipblocks', $row, __METHOD__, [ 'IGNORE' ] );
                                $affected = $dbw->affectedRows();
-                               $this->mId = $dbw->insertId();
+                               $this->setId( $dbw->insertId() );
+                               if ( $this->restrictions ) {
+                                       BlockRestriction::insert( $this->restrictions );
+                               }
                        }
                }
 
@@ -598,14 +628,24 @@ class Block {
 
                $dbw->startAtomic( __METHOD__ );
 
-               $dbw->update(
+               $result = $dbw->update(
                        'ipblocks',
                        $this->getDatabaseArray( $dbw ),
                        [ 'ipb_id' => $this->getId() ],
                        __METHOD__
                );
 
-               $affected = $dbw->affectedRows();
+               // Only update the restrictions if they have been modified.
+               if ( $this->restrictions !== null ) {
+                       // An empty array should remove all of the restrictions.
+                       if ( empty( $this->restrictions ) ) {
+                               $success = BlockRestriction::deleteByBlockId( $this->getId() );
+                       } else {
+                               $success = BlockRestriction::update( $this->restrictions );
+                       }
+                       // Update the result. The first false is the result, otherwise, true.
+                       $result = $result && $success;
+               }
 
                if ( $this->isAutoblocking() ) {
                        // update corresponding autoblock(s) (T50813)
@@ -615,8 +655,14 @@ class Block {
                                [ 'ipb_parent_block_id' => $this->getId() ],
                                __METHOD__
                        );
+
+                       // Only update the restrictions if they have been modified.
+                       if ( $this->restrictions !== null ) {
+                               BlockRestriction::updateByParentBlockId( $this->getId(), $this->restrictions );
+                       }
                } else {
                        // autoblock no longer required, delete corresponding autoblock(s)
+                       BlockRestriction::deleteByParentBlockId( $this->getId() );
                        $dbw->delete(
                                'ipblocks',
                                [ 'ipb_parent_block_id' => $this->getId() ],
@@ -626,12 +672,12 @@ class Block {
 
                $dbw->endAtomic( __METHOD__ );
 
-               if ( $affected ) {
+               if ( $result ) {
                        $auto_ipd_ids = $this->doRetroactiveAutoblock();
                        return [ 'id' => $this->mId, 'autoIds' => $auto_ipd_ids ];
                }
 
-               return false;
+               return $result;
        }
 
        /**
@@ -662,7 +708,8 @@ class Block {
                        'ipb_deleted'          => intval( $this->mHideName ), // typecast required for SQLite
                        'ipb_block_email'      => $this->prevents( 'sendemail' ),
                        'ipb_allow_usertalk'   => !$this->prevents( 'editownusertalk' ),
-                       'ipb_parent_block_id'  => $this->mParentBlockId
+                       'ipb_parent_block_id'  => $this->mParentBlockId,
+                       'ipb_sitewide'         => $this->isSitewide(),
                ] + CommentStore::getStore()->insert( $dbw, 'ipb_reason', $this->mReason )
                        + ActorMigration::newMigration()->getInsertValues( $dbw, 'ipb_by', $this->getBlocker() );
 
@@ -865,6 +912,8 @@ class Block {
                $autoblock->mHideName = $this->mHideName;
                $autoblock->prevents( 'editownusertalk', $this->prevents( 'editownusertalk' ) );
                $autoblock->mParentBlockId = $this->mId;
+               $autoblock->isSitewide( $this->isSitewide() );
+               $autoblock->setRestrictions( $this->getRestrictions() );
 
                if ( $this->mExpiry == 'infinity' ) {
                        # Original block was indefinite, start an autoblock now
@@ -1014,6 +1063,22 @@ class Block {
                return $this->mId;
        }
 
+       /**
+        * Set the block ID
+        *
+        * @param int $blockId
+        * @return int
+        */
+       private function setId( $blockId ) {
+               $this->mId = (int)$blockId;
+
+               if ( is_array( $this->restrictions ) ) {
+                       $this->restrictions = BlockRestriction::setBlockId( $blockId, $this->restrictions );
+               }
+
+               return $this;
+       }
+
        /**
         * Get the system block type, if any
         * @since 1.29
@@ -1061,6 +1126,18 @@ 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).
+        *
+        * @param null|bool $x
+        * @return bool
+        */
+       public function isSitewide( $x = null ) {
+               return wfSetVar( $this->isSitewide, $x );
+       }
+
        /**
         * Get/set whether the Block prevents a given action
         *
@@ -1069,7 +1146,10 @@ class Block {
         * @return bool|null Null for unrecognized rights.
         */
        public function prevents( $action, $x = null ) {
-               global $wgBlockDisablesLogin;
+               $config = RequestContext::getMain()->getConfig();
+               $blockDisablesLogin = $config->get( 'BlockDisablesLogin' );
+               $blockAllowsUTEdit = $config->get( 'BlockAllowsUTEdit' );
+
                $res = null;
                switch ( $action ) {
                        case 'edit':
@@ -1082,14 +1162,22 @@ class Block {
                        case 'sendemail':
                                $res = wfSetVar( $this->mBlockEmail, $x );
                                break;
+                       case 'upload':
+                               // Until T6995 is completed
+                               $res = $this->isSitewide();
+                               break;
                        case 'editownusertalk':
                                $res = wfSetVar( $this->mDisableUsertalk, $x );
+                               // edit own user talk can be disabled by config
+                               if ( !$blockAllowsUTEdit ) {
+                                       $res = true;
+                               }
                                break;
                        case 'read':
                                $res = false;
                                break;
                }
-               if ( !$res && $wgBlockDisablesLogin ) {
+               if ( !$res && $blockDisablesLogin ) {
                        // If a block would disable login, then it should
                        // prevent any action that all users cannot do
                        $anon = new User;
@@ -1145,6 +1233,7 @@ class Block {
                                        $fname
                                );
                                if ( $ids ) {
+                                       BlockRestriction::deleteByBlockId( $ids );
                                        $dbw->delete( 'ipblocks', [ 'ipb_id' => $ids ], $fname );
                                }
                        }
@@ -1614,6 +1703,29 @@ class Block {
         * @return array
         */
        public function getPermissionsError( IContextSource $context ) {
+               $params = $this->getBlockErrorParams( $context );
+
+               $msg = 'blockedtext';
+               if ( $this->getSystemBlockType() !== null ) {
+                       $msg = 'systemblockedtext';
+               } elseif ( $this->mAuto ) {
+                       $msg = 'autoblockedtext';
+               } elseif ( !$this->isSitewide() ) {
+                       $msg = 'blockedtext-partial';
+               }
+
+               array_unshift( $params, $msg );
+
+               return $params;
+       }
+
+       /**
+        * Get block information used in different block error messages
+        *
+        * @param IContextSource $context
+        * @return array
+        */
+       public function getBlockErrorParams( IContextSource $context ) {
                $blocker = $this->getBlocker();
                if ( $blocker instanceof User ) { // local user
                        $blockerUserpage = $blocker->getUserPage();
@@ -1630,14 +1742,10 @@ class Block {
                /* $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 [
-                       $systemBlockType !== null
-                               ? 'systemblockedtext'
-                               : ( $this->mAuto ? 'autoblockedtext' : 'blockedtext' ),
                        $link,
                        $reason,
                        $context->getRequest()->getIP(),
@@ -1648,4 +1756,70 @@ class Block {
                        $lang->userTimeAndDate( $this->mTimestamp, $context->getUser() ),
                ];
        }
+
+       /**
+        * Get Restrictions.
+        *
+        * Getting the restrictions will perform a database query if the restrictions
+        * are not already loaded.
+        *
+        * @return Restriction[]
+        */
+       public function getRestrictions() {
+               if ( $this->restrictions === null ) {
+                       // If the block id has not been set, then do not attempt to load the
+                       // restrictions.
+                       if ( !$this->mId ) {
+                               return [];
+                       }
+                       $this->restrictions = BlockRestriction::loadByBlockId( $this->mId );
+               }
+
+               return $this->restrictions;
+       }
+
+       /**
+        * Set Restrictions.
+        *
+        * @param Restriction[] $restrictions
+        *
+        * @return self
+        */
+       public function setRestrictions( array $restrictions ) {
+               $this->restrictions = array_filter( $restrictions, function ( $restriction ) {
+                       return $restriction instanceof Restriction;
+               } );
+
+               return $this;
+       }
+
+       /**
+        * Checks if a block prevents an edit on a given article
+        *
+        * @param \Title $title
+        * @return bool
+        */
+       public function preventsEdit( \Title $title ) {
+               $blocked = $this->isSitewide();
+
+               // user talk page has it's own rules
+               // This check happens before partial blocks because the flag
+               // to allow user to edit their user talk page could be
+               // overwritten by a partial block restriction (E.g. user talk namespace)
+               $user = $this->getTarget();
+               if ( $title->equals( $user->getTalkPage() ) ) {
+                       $blocked = $this->prevents( 'editownusertalk' );
+               }
+
+               if ( !$this->isSitewide() ) {
+                       $restrictions = $this->getRestrictions();
+                       foreach ( $restrictions as $restriction ) {
+                               if ( $restriction->matches( $title ) ) {
+                                       $blocked = true;
+                               }
+                       }
+               }
+
+               return $blocked;
+       }
 }
index 4a3b6db..731abb5 100644 (file)
@@ -4887,7 +4887,6 @@ $wgDefaultUserOptions = [
        'rows' => 25, // @deprecated since 1.29 No longer used in core
        'showhiddencats' => 0,
        'shownumberswatching' => 1,
-       'showtoolbar' => 1,
        'skin' => false,
        'stubthreshold' => 0,
        'thumbsize' => 5,
@@ -9027,6 +9026,16 @@ $wgChangeTagsSchemaMigrationStage = MIGRATION_WRITE_BOTH;
  */
 $wgTagStatisticsNewTable = false;
 
+/**
+ * Flag to enable Partial Blocks. This allows an admin to prevent a user from editing specific pages
+ * or namespaces.
+ *
+ * @since 1.32
+ * @deprecated 1.32
+ * @var bool
+ */
+$wgEnablePartialBlocks = false;
+
 /**
  * For really cool vim folding this needs to be at the end:
  * vim: foldmarker=@{,@} foldmethod=marker
index 90db70f..a79b974 100644 (file)
@@ -2479,13 +2479,6 @@ ERROR;
                $out->addModuleStyles( 'mediawiki.editfont.styles' );
 
                $user = $this->context->getUser();
-               if ( $user->getOption( 'showtoolbar' ) ) {
-                       // The addition of default buttons is handled by getEditToolbar() which
-                       // has its own dependency on this module. The call here ensures the module
-                       // is loaded in time (it has position "top") for other modules to register
-                       // buttons (e.g. extensions, gadgets, user scripts).
-                       $out->addModules( 'mediawiki.toolbar' );
-               }
 
                if ( $user->getOption( 'uselivepreview' ) ) {
                        $out->addModules( 'mediawiki.action.edit.preview' );
@@ -2788,13 +2781,8 @@ ERROR;
 
                $out->addHTML( $this->editFormTextTop );
 
-               $showToolbar = true;
                if ( $this->wasDeletedSinceLastEdit() ) {
-                       if ( $this->formtype == 'save' ) {
-                               // Hide the toolbar and edit area, user can click preview to get it back
-                               // Add an confirmation checkbox and explanation.
-                               $showToolbar = false;
-                       } else {
+                       if ( $this->formtype !== 'save' ) {
                                $out->wrapWikiMsg( "<div class='error mw-deleted-while-editing'>\n$1\n</div>",
                                        'deletedwhileediting' );
                        }
@@ -2932,7 +2920,7 @@ ERROR;
                        $out->addHTML( $editConflictHelper->getEditFormHtmlBeforeContent() );
                }
 
-               if ( !$this->mTitle->isUserConfigPage() && $showToolbar && $user->getOption( 'showtoolbar' ) ) {
+               if ( !$this->mTitle->isUserConfigPage() ) {
                        $out->addHTML( self::getEditToolbar( $this->mTitle ) );
                }
 
@@ -4088,145 +4076,20 @@ ERROR;
        }
 
        /**
-        * Shows a bulletin board style toolbar for common editing functions.
-        * It can be disabled in the user preferences.
+        * Allow extensions to provide a toolbar.
         *
         * @param Title|null $title Title object for the page being edited (optional)
-        * @return string
+        * @return string|null
         */
        public static function getEditToolbar( $title = null ) {
-               global $wgOut, $wgEnableUploads, $wgForeignFileRepos;
-
-               $imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos );
-               $showSignature = true;
-               if ( $title ) {
-                       $showSignature = MWNamespace::wantSignatures( $title->getNamespace() );
-               }
-
-               $contLang = MediaWikiServices::getInstance()->getContentLanguage();
-
-               /**
-                * $toolarray is an array of arrays each of which includes the
-                * opening tag, the closing tag, optionally a sample text that is
-                * inserted between the two when no selection is highlighted
-                * and.  The tip text is shown when the user moves the mouse
-                * over the button.
-                *
-                * Images are defined in ResourceLoaderEditToolbarModule.
-                */
-               $toolarray = [
-                       [
-                               'id'     => 'mw-editbutton-bold',
-                               'open'   => '\'\'\'',
-                               'close'  => '\'\'\'',
-                               'sample' => wfMessage( 'bold_sample' )->text(),
-                               'tip'    => wfMessage( 'bold_tip' )->text(),
-                       ],
-                       [
-                               'id'     => 'mw-editbutton-italic',
-                               'open'   => '\'\'',
-                               'close'  => '\'\'',
-                               'sample' => wfMessage( 'italic_sample' )->text(),
-                               'tip'    => wfMessage( 'italic_tip' )->text(),
-                       ],
-                       [
-                               'id'     => 'mw-editbutton-link',
-                               'open'   => '[[',
-                               'close'  => ']]',
-                               'sample' => wfMessage( 'link_sample' )->text(),
-                               'tip'    => wfMessage( 'link_tip' )->text(),
-                       ],
-                       [
-                               'id'     => 'mw-editbutton-extlink',
-                               'open'   => '[',
-                               'close'  => ']',
-                               'sample' => wfMessage( 'extlink_sample' )->text(),
-                               'tip'    => wfMessage( 'extlink_tip' )->text(),
-                       ],
-                       [
-                               'id'     => 'mw-editbutton-headline',
-                               'open'   => "\n== ",
-                               'close'  => " ==\n",
-                               'sample' => wfMessage( 'headline_sample' )->text(),
-                               'tip'    => wfMessage( 'headline_tip' )->text(),
-                       ],
-                       $imagesAvailable ? [
-                               'id'     => 'mw-editbutton-image',
-                               'open'   => '[[' . $contLang->getNsText( NS_FILE ) . ':',
-                               'close'  => ']]',
-                               'sample' => wfMessage( 'image_sample' )->text(),
-                               'tip'    => wfMessage( 'image_tip' )->text(),
-                       ] : false,
-                       $imagesAvailable ? [
-                               'id'     => 'mw-editbutton-media',
-                               'open'   => '[[' . $contLang->getNsText( NS_MEDIA ) . ':',
-                               'close'  => ']]',
-                               'sample' => wfMessage( 'media_sample' )->text(),
-                               'tip'    => wfMessage( 'media_tip' )->text(),
-                       ] : false,
-                       [
-                               'id'     => 'mw-editbutton-nowiki',
-                               'open'   => "<nowiki>",
-                               'close'  => "</nowiki>",
-                               'sample' => wfMessage( 'nowiki_sample' )->text(),
-                               'tip'    => wfMessage( 'nowiki_tip' )->text(),
-                       ],
-                       $showSignature ? [
-                               'id'     => 'mw-editbutton-signature',
-                               'open'   => wfMessage( 'sig-text', '~~~~' )->inContentLanguage()->text(),
-                               'close'  => '',
-                               'sample' => '',
-                               'tip'    => wfMessage( 'sig_tip' )->text(),
-                       ] : false,
-                       [
-                               'id'     => 'mw-editbutton-hr',
-                               'open'   => "\n----\n",
-                               'close'  => '',
-                               'sample' => '',
-                               'tip'    => wfMessage( 'hr_tip' )->text(),
-                       ]
-               ];
-
-               $script = '';
-               foreach ( $toolarray as $tool ) {
-                       if ( !$tool ) {
-                               continue;
-                       }
-
-                       $params = [
-                               // Images are defined in ResourceLoaderEditToolbarModule
-                               false,
-                               // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
-                               // Older browsers show a "speedtip" type message only for ALT.
-                               // Ideally these should be different, realistically they
-                               // probably don't need to be.
-                               $tool['tip'],
-                               $tool['open'],
-                               $tool['close'],
-                               $tool['sample'],
-                               $tool['id'],
-                       ];
+               $startingToolbar = '<div id="toolbar"></div>';
+               $toolbar = $startingToolbar;
 
-                       $script .= Xml::encodeJsCall(
-                               'mw.toolbar.addButton',
-                               $params,
-                               ResourceLoader::inDebugMode()
-                       );
-               }
-
-               $toolbar = '<div id="toolbar"></div>';
-
-               if ( Hooks::run( 'EditPageBeforeEditToolbar', [ &$toolbar ] ) ) {
-                       // Only add the old toolbar cruft to the page payload if the toolbar has not
-                       // been over-written by a hook caller
-                       $nonce = $wgOut->getCSPNonce();
-                       $wgOut->addScript( Html::inlineScript(
-                               ResourceLoader::makeInlineCodeWithModule( 'mediawiki.toolbar', $script ),
-                               $nonce
-                       ) );
+               if ( !Hooks::run( 'EditPageBeforeEditToolbar', [ &$toolbar ] ) ) {
+                       return null;
                };
-
-               return $toolbar;
+               // Don't add a pointless `<div>` to the page unless a hook caller populated it
+               return ( $toolbar === $startingToolbar ) ? null : $toolbar;
        }
 
        /**
index bb86536..1ca54c1 100644 (file)
@@ -1853,6 +1853,12 @@ abstract class ApiBase extends ContextSource {
                                        'blocked',
                                        [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) ]
                                ) );
+                       } elseif ( is_array( $error ) && $error[0] === 'blockedtext-partial' && $user->getBlock() ) {
+                               $status->fatal( ApiMessage::create(
+                                       'apierror-blocked-partial',
+                                       'blocked',
+                                       [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) ]
+                               ) );
                        } elseif ( is_array( $error ) && $error[0] === 'autoblockedtext' && $user->getBlock() ) {
                                $status->fatal( ApiMessage::create(
                                        'apierror-autoblocked',
@@ -2027,6 +2033,12 @@ abstract class ApiBase extends ContextSource {
                                'autoblocked',
                                [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ]
                        );
+               } elseif ( !$block->isSitewide() ) {
+                       $this->dieWithError(
+                               'apierror-blocked-partial',
+                               'blocked',
+                               [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ]
+                       );
                } else {
                        $this->dieWithError(
                                'apierror-blocked',
index 8f40283..3581ac8 100644 (file)
@@ -54,6 +54,30 @@ class ApiBlock extends ApiBase {
                        }
                }
 
+               $editingRestriction = 'sitewide';
+               $pageRestrictions = '';
+               if ( $this->getConfig()->get( 'EnablePartialBlocks' ) ) {
+                       if ( $params['pagerestrictions'] ) {
+                               $count = count( $params['pagerestrictions'] );
+                               if ( $count > 10 ) {
+                                       $this->dieWithError(
+                                               $this->msg(
+                                                       'apierror-integeroutofrange-abovebotmax',
+                                                       'pagerestrictions',
+                                                       10,
+                                                       $count
+                                               )
+                                       );
+                               }
+                       }
+
+                       if ( $params['partial'] ) {
+                               $editingRestriction = 'partial';
+                       }
+
+                       $pageRestrictions = implode( "\n", $params['pagerestrictions'] );
+               }
+
                if ( $params['userid'] !== null ) {
                        $username = User::whoIs( $params['userid'] );
 
@@ -107,6 +131,8 @@ class ApiBlock extends ApiBase {
                        'Watch' => $params['watchuser'],
                        'Confirm' => true,
                        'Tags' => $params['tags'],
+                       'EditingRestriction' => $editingRestriction,
+                       'PageRestrictions' => $pageRestrictions,
                ];
 
                $retval = SpecialBlock::processForm( $data, $this->getContext() );
@@ -137,6 +163,11 @@ class ApiBlock extends ApiBase {
                $res['allowusertalk'] = $params['allowusertalk'];
                $res['watchuser'] = $params['watchuser'];
 
+               if ( $this->getConfig()->get( 'EnablePartialBlocks' ) ) {
+                       $res['partial'] = $params['partial'];
+                       $res['pagerestrictions'] = $params['pagerestrictions'];
+               }
+
                $this->getResult()->addValue( null, $this->getModuleName(), $res );
        }
 
@@ -149,7 +180,7 @@ class ApiBlock extends ApiBase {
        }
 
        public function getAllowedParams() {
-               return [
+               $params = [
                        'user' => [
                                ApiBase::PARAM_TYPE => 'user',
                        ],
@@ -171,6 +202,15 @@ class ApiBlock extends ApiBase {
                                ApiBase::PARAM_ISMULTI => true,
                        ],
                ];
+
+               if ( $this->getConfig()->get( 'EnablePartialBlocks' ) ) {
+                       $params['partial'] = false;
+                       $params['pagerestrictions'] = [
+                               ApiBase::PARAM_ISMULTI => true,
+                       ];
+               }
+
+               return $params;
        }
 
        public function needsToken() {
index 83f72e5..5e5efa5 100644 (file)
@@ -414,11 +414,7 @@ class ApiEditPage extends ApiBase {
                        // obvious that this is even possible.
                        // @codeCoverageIgnoreStart
                        case EditPage::AS_BLOCKED_PAGE_FOR_USER:
-                               $this->dieWithError(
-                                       'apierror-blocked',
-                                       'blocked',
-                                       [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) ]
-                               );
+                               $this->dieBlocked( $user->getBlock() );
 
                        case EditPage::AS_READ_ONLY_PAGE:
                                $this->dieReadOnly();
index 08c13e7..3cd2ace 100644 (file)
@@ -20,6 +20,9 @@
  * @file
  */
 
+use Wikimedia\Rdbms\IResultWrapper;
+use MediaWiki\Block\BlockRestriction;
+
 /**
  * Query module to enumerate all user blocks
  *
@@ -48,6 +51,7 @@ class ApiQueryBlocks extends ApiQueryBase {
                $fld_reason = isset( $prop['reason'] );
                $fld_range = isset( $prop['range'] );
                $fld_flags = isset( $prop['flags'] );
+               $fld_restrictions = isset( $prop['restrictions'] );
 
                $result = $this->getResult();
 
@@ -64,8 +68,9 @@ class ApiQueryBlocks extends ApiQueryBase {
                $this->addFieldsIf( 'ipb_expiry', $fld_expiry );
                $this->addFieldsIf( [ 'ipb_range_start', 'ipb_range_end' ], $fld_range );
                $this->addFieldsIf( [ 'ipb_anon_only', 'ipb_create_account', 'ipb_enable_autoblock',
-                       'ipb_block_email', 'ipb_deleted', 'ipb_allow_usertalk' ],
+                       'ipb_block_email', 'ipb_deleted', 'ipb_allow_usertalk', 'ipb_sitewide' ],
                        $fld_flags );
+               $this->addFieldsIf( 'ipb_sitewide', $fld_restrictions );
 
                if ( $fld_reason ) {
                        $commentQuery = $commentStore->getJoin( 'ipb_reason' );
@@ -180,6 +185,11 @@ class ApiQueryBlocks extends ApiQueryBase {
 
                $res = $this->select( __METHOD__ );
 
+               $restrictions = [];
+               if ( $fld_restrictions ) {
+                       $restrictions = $this->getRestrictionData( $res, $params['limit'] );
+               }
+
                $count = 0;
                foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
@@ -227,7 +237,16 @@ class ApiQueryBlocks extends ApiQueryBase {
                                $block['noemail'] = (bool)$row->ipb_block_email;
                                $block['hidden'] = (bool)$row->ipb_deleted;
                                $block['allowusertalk'] = (bool)$row->ipb_allow_usertalk;
+                               $block['partial'] = !(bool)$row->ipb_sitewide;
+                       }
+
+                       if ( $fld_restrictions ) {
+                               $block['restrictions'] = [];
+                               if ( !$row->ipb_sitewide && isset( $restrictions[$row->ipb_id] ) ) {
+                                       $block['restrictions'] = $restrictions[$row->ipb_id];
+                               }
                        }
+
                        $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $block );
                        if ( !$fit ) {
                                $this->setContinueEnumParameter( 'continue', "$row->ipb_timestamp|$row->ipb_id" );
@@ -256,6 +275,52 @@ class ApiQueryBlocks extends ApiQueryBase {
                return $name;
        }
 
+       /**
+        * Retrieves the restrictions based on the query result.
+        *
+        * @param IResultWrapper $result
+        * @param int $limit
+        *
+        * @return array
+        */
+       private static function getRestrictionData( IResultWrapper $result, $limit ) {
+               $partialIds = [];
+               $count = 0;
+               foreach ( $result as $row ) {
+                       if ( ++$count <= $limit && !$row->ipb_sitewide ) {
+                               $partialIds[] = (int)$row->ipb_id;
+                       }
+               }
+
+               $restrictions = BlockRestriction::loadByBlockId( $partialIds );
+
+               $data = [];
+               $keys = [
+                       'page' => 'pages',
+                       'ns' => 'namespaces',
+               ];
+               foreach ( $restrictions as $restriction ) {
+                       $key = $keys[$restriction->getType()];
+                       $id = $restriction->getBlockId();
+                       switch ( $restriction->getType() ) {
+                               case 'page':
+                                       $value = [ 'id' => $restriction->getValue() ];
+                                       self::addTitleInfo( $value, $restriction->getTitle() );
+                                       break;
+                               default:
+                                       $value = $restriction->getValue();
+                       }
+
+                       if ( !isset( $data[$id][$key] ) ) {
+                               $data[$id][$key] = [];
+                               ApiResult::setIndexedTagName( $data[$id][$key], $restriction->getType() );
+                       }
+                       $data[$id][$key][] = $value;
+               }
+
+               return $data;
+       }
+
        public function getAllowedParams() {
                $blockCIDRLimit = $this->getConfig()->get( 'BlockCIDRLimit' );
 
@@ -308,7 +373,8 @@ class ApiQueryBlocks extends ApiQueryBase {
                                        'expiry',
                                        'reason',
                                        'range',
-                                       'flags'
+                                       'flags',
+                                       'restrictions',
                                ],
                                ApiBase::PARAM_ISMULTI => true,
                                ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
index fa151c9..44e2703 100644 (file)
@@ -70,6 +70,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
                $vals['blockreason'] = $block->mReason;
                $vals['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $block->mTimestamp );
                $vals['blockexpiry'] = ApiResult::formatExpiry( $block->getExpiry(), 'infinite' );
+               $vals['blockpartial'] = !$block->isSitewide();
                if ( $block->getSystemBlockType() !== null ) {
                        $vals['systemblocktype'] = $block->getSystemBlockType();
                }
index 25bf3f7..588dbef 100644 (file)
@@ -40,6 +40,8 @@
        "apihelp-block-param-reblock": "If the user is already blocked, overwrite the existing block.",
        "apihelp-block-param-watchuser": "Watch the user's or IP address's user and talk pages.",
        "apihelp-block-param-tags": "Change tags to apply to the entry in the block log.",
+       "apihelp-block-param-partial": "Block user from specific pages or namespaces rather than the entire site.",
+       "apihelp-block-param-pagerestrictions": "List of titles to block the user from editing. Only applies when 'partial' is set to true.",
        "apihelp-block-example-ip-simple": "Block IP address <kbd>192.0.2.5</kbd> for three days with reason <kbd>First strike</kbd>.",
        "apihelp-block-example-user-complex": "Block user <kbd>Vandal</kbd> indefinitely with reason <kbd>Vandalism</kbd>, and prevent new account creation and email sending.",
 
        "apihelp-query+blocks-paramvalue-prop-reason": "Adds the reason given for the block.",
        "apihelp-query+blocks-paramvalue-prop-range": "Adds the range of IP addresses affected by the block.",
        "apihelp-query+blocks-paramvalue-prop-flags": "Tags the ban with (autoblock, anononly, etc.).",
+       "apihelp-query+blocks-paramvalue-prop-restrictions": "Adds the partial block restrictions if the block is not sitewide.",
        "apihelp-query+blocks-param-show": "Show only items that meet these criteria.\nFor example, to see only indefinite blocks on IP addresses, set <kbd>$1show=ip|!temp</kbd>.",
        "apihelp-query+blocks-example-simple": "List blocks.",
        "apihelp-query+blocks-example-users": "List blocks of users <kbd>Alice</kbd> and <kbd>Bob</kbd>.",
        "apierror-bad-watchlist-token": "Incorrect watchlist token provided. Please set a correct token in [[Special:Preferences]].",
        "apierror-blockedfrommail": "You have been blocked from sending email.",
        "apierror-blocked": "You have been blocked from editing.",
+       "apierror-blocked-partial": "You have been blocked from editing this page.",
        "apierror-botsnotsupported": "This interface is not supported for bots.",
        "apierror-cannot-async-upload-file": "The parameters <var>async</var> and <var>file</var> cannot be combined. If you want asynchronous processing of your uploaded file, first upload it to stash (using the <var>stash</var> parameter) and then publish the stashed file asynchronously (using <var>filekey</var> and <var>async</var>).",
        "apierror-cannotreauthenticate": "This action is not available as your identity cannot be verified.",
index 67888b6..ce1010e 100644 (file)
        "apihelp-query+info-paramvalue-prop-displaytitle": "Fornece o modo como o título da página é exibido.",
        "apihelp-query+info-paramvalue-prop-varianttitles": "Fornece o título de apresentação em todas as variantes da língua de conteúdo da wiki.",
        "apihelp-query+info-param-testactions": "Testa se o usuário atual pode executar determinadas ações na página.",
+       "apihelp-query+info-param-testactionsdetail": "Nível de detalhe de <var>$1testactions</var>. Use os parâmetros <var>errorformat</var> e <var>errorlang</var> do [[Special:ApiHelp/main|módulo principal]] para controlar o formato das mensagens devolvidas.",
        "apihelp-query+info-paramvalue-testactionsdetail-boolean": "Retorna um valor booleano para cada ação.",
        "apihelp-query+info-paramvalue-testactionsdetail-full": "Retornar mensagens descrevendo por que a ação não é permitida ou uma matriz vazia, se for permitida.",
        "apihelp-query+info-paramvalue-testactionsdetail-quick": "Como <kbd>completo</kbd>, mas pulando verificação de caros.",
index 38cdaf2..14637cf 100644 (file)
        "apihelp-query+info-paramvalue-prop-notificationtimestamp": "A data e hora das notificações de alterações de cada página vigiada.",
        "apihelp-query+info-paramvalue-prop-subjectid": "O identificador da página progenitora de cada página de discussão.",
        "apihelp-query+info-paramvalue-prop-url": "Fornece um URL completo, um URL de edição e o URL canónico, para cada página.",
-       "apihelp-query+info-paramvalue-prop-readable": "Indica se o utilizador pode ler esta página.",
+       "apihelp-query+info-paramvalue-prop-readable": "Indica se o utilizador pode ler esta página. Em vez deste parâmetro, use <kbd>intestactions=read</kbd>.",
        "apihelp-query+info-paramvalue-prop-preload": "Fornece o texto devolvido por EditFormPreloadText.",
        "apihelp-query+info-paramvalue-prop-displaytitle": "Fornece a forma como o título da página é apresentado.",
        "apihelp-query+info-paramvalue-prop-varianttitles": "Fornece o título de apresentação em todas as variantes da língua de conteúdo da wiki.",
        "apihelp-query+info-param-testactions": "Testar se o utilizador pode realizar certas operações na página.",
+       "apihelp-query+info-param-testactionsdetail": "Nível de detalhe de <var>$1testactions</var>. Use os parâmetros <var>errorformat</var> e <var>errorlang</var> do [[Special:ApiHelp/main|módulo principal]] para controlar o formato das mensagens devolvidas.",
+       "apihelp-query+info-paramvalue-testactionsdetail-boolean": "Devolver um valor booliano para cada ação.",
+       "apihelp-query+info-paramvalue-testactionsdetail-full": "Devolver mensagens que descrevem porque a ação não é permitida, ou uma matriz vazia se ela for permitida.",
+       "apihelp-query+info-paramvalue-testactionsdetail-quick": "Como <kbd>full</kbd> mas saltando verificações exigentes.",
        "apihelp-query+info-param-token": "Em substituição, usar [[Special:ApiHelp/query+tokens|action=query&meta=tokens]].",
        "apihelp-query+info-example-simple": "Obter informações sobre a página <kbd>Main Page</kbd>.",
        "apihelp-query+info-example-protection": "Obter informação geral e de proteção sobre a página <kbd>Main Page</kbd>.",
        "apierror-assertnameduserfailed": "A asserção de que o utilizador é \"$1\" falhou.",
        "apierror-assertuserfailed": "A asserção de que o utilizador está autenticado falhou.",
        "apierror-autoblocked": "O seu endereço IP foi bloqueado automaticamente, porque foi usado por um utilizador bloqueado.",
+       "apierror-bad-badfilecontexttitle": "Título inválido no parâmetro <var>$1badfilecontexttitle</var>.",
        "apierror-badconfig-resulttoosmall": "O valor de <code>$wgAPIMaxResultSize</code> nesta wiki é demasiado pequeno para conter informação básica de resultados.",
        "apierror-badcontinue": "Parâmetro de continuação inválido. Deve passar o valor original devolvido pela consulta anterior.",
        "apierror-baddiff": "Não foi possível obter a lista de diferenças. Uma das revisões, ou ambas, não existem, ou não tem permissão para vê-las.",
index d279330..1d5485b 100644 (file)
@@ -48,6 +48,8 @@
        "apihelp-block-param-reblock": "{{doc-apihelp-param|block|reblock}}",
        "apihelp-block-param-watchuser": "{{doc-apihelp-param|block|watchuser}}",
        "apihelp-block-param-tags": "{{doc-apihelp-param|block|tags}}",
+       "apihelp-block-param-partial": "{{doc-apihelp-param|block|partial}}",
+       "apihelp-block-param-pagerestrictions": "{{doc-apihelp-param|block|pagerestrictions}}",
        "apihelp-block-example-ip-simple": "{{doc-apihelp-example|block}}",
        "apihelp-block-example-user-complex": "{{doc-apihelp-example|block}}",
        "apihelp-changeauthenticationdata-summary": "{{doc-apihelp-summary|changeauthenticationdata}}",
        "apihelp-query+blocks-paramvalue-prop-reason": "{{doc-apihelp-paramvalue|query+blocks|prop|reason}}",
        "apihelp-query+blocks-paramvalue-prop-range": "{{doc-apihelp-paramvalue|query+blocks|prop|range}}",
        "apihelp-query+blocks-paramvalue-prop-flags": "{{doc-apihelp-paramvalue|query+blocks|prop|flags}}",
+       "apihelp-query+blocks-paramvalue-prop-restrictions": "{{doc-apihelp-paramvalue|query+blocks|prop|flags}}",
        "apihelp-query+blocks-param-show": "{{doc-apihelp-param|query+blocks|show}}",
        "apihelp-query+blocks-example-simple": "{{doc-apihelp-example|query+blocks}}",
        "apihelp-query+blocks-example-users": "{{doc-apihelp-example|query+blocks}}",
        "apierror-bad-watchlist-token": "{{doc-apierror}}",
        "apierror-blockedfrommail": "{{doc-apierror}}",
        "apierror-blocked": "{{doc-apierror}}",
+       "apierror-blocked-partial": "{{doc-apierror}}",
        "apierror-botsnotsupported": "{{doc-apierror}}",
        "apierror-cannot-async-upload-file": "{{doc-apierror}}",
        "apierror-cannotreauthenticate": "{{doc-apierror}}",
index 1cb6f5c..811ccc7 100644 (file)
        "apihelp-query+imageusage-example-simple": "Visa sidor med hjälp av [[:File:Albert Einstein Head.jpg]].",
        "apihelp-query+imageusage-example-generator": "Hämta information om sidor med hjälp av [[:File:Albert Einstein Head.jpg]].",
        "apihelp-query+info-summary": "Få grundläggande sidinformation.",
+       "apihelp-query+info-paramvalue-prop-readable": "Om användaren kan läsa denna sida. Använd <kbd>intestactions=read</kbd> istället.",
        "apihelp-query+info-paramvalue-prop-varianttitles": "Ger visningstiteln i alla variationer på webbplatsens innehållsspråk.",
+       "apihelp-query+info-paramvalue-testactionsdetail-boolean": "Returnera ett booleskt värde för varje åtgärd.",
        "apihelp-query+iwbacklinks-param-limit": "Hur många sidor att returnera totalt.",
        "apihelp-query+iwbacklinks-param-dir": "Riktningen att lista mot.",
        "apihelp-query+iwlinks-param-dir": "Riktningen att lista mot.",
diff --git a/includes/block/BlockRestriction.php b/includes/block/BlockRestriction.php
new file mode 100644 (file)
index 0000000..3ce682b
--- /dev/null
@@ -0,0 +1,417 @@
+<?php
+/**
+ * Block restriction interface.
+ *
+ * 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 MediaWiki\Block\Restriction\PageRestriction;
+use MediaWiki\Block\Restriction\Restriction;
+use Wikimedia\Rdbms\IResultWrapper;
+use Wikimedia\Rdbms\IDatabase;
+
+class BlockRestriction {
+
+       /**
+        * Retrieves the restrictions from the database by block id.
+        *
+        * @param int|array $blockId
+        * @param IDatabase|null $db
+        * @param array $options Options to pass to the select query.
+        * @return Restriction[]
+        */
+       public static function loadByBlockId( $blockId, IDatabase $db = null ) {
+               if ( is_null( $blockId ) || $blockId === [] ) {
+                       return [];
+               }
+
+               $db = $db ?: wfGetDb( DB_REPLICA );
+
+               $result = $db->select(
+                       [ 'ipblocks_restrictions', 'page' ],
+                       [ 'ir_ipb_id', 'ir_type', 'ir_value', 'page_namespace', 'page_title' ],
+                       [ 'ir_ipb_id' => $blockId ],
+                       __METHOD__,
+                       [],
+                       [ 'page' => [ 'LEFT JOIN', [ 'ir_type' => PageRestriction::TYPE_ID, 'ir_value=page_id' ] ] ]
+               );
+
+               return self::resultToRestrictions( $result );
+       }
+
+       /**
+        * Inserts the restrictions into the database.
+        *
+        * @param Restriction[] $restrictions
+        * @return bool
+        */
+       public static function insert( array $restrictions ) {
+               if ( empty( $restrictions ) ) {
+                       return false;
+               }
+
+               $rows = [];
+               foreach ( $restrictions as $restriction ) {
+                       if ( !$restriction instanceof Restriction ) {
+                               continue;
+                       }
+                       $rows[] = $restriction->toRow();
+               }
+
+               if ( empty( $rows ) ) {
+                       return false;
+               }
+
+               $dbw = wfGetDB( DB_MASTER );
+
+               return $dbw->insert(
+                       'ipblocks_restrictions',
+                       $rows,
+                       __METHOD__,
+                       [ 'IGNORE' ]
+               );
+       }
+
+       /**
+        * Updates the list of restrictions. This method does not allow removing all
+        * of the restrictions. To do that, use ::deleteByBlockId().
+        *
+        * @param Restriction[] $restrictions
+        * @return bool
+        */
+       public static function update( array $restrictions ) {
+               $dbw = wfGetDB( DB_MASTER );
+
+               $dbw->startAtomic( __METHOD__ );
+
+               // Organize the restrictions by blockid.
+               $restrictionList = self::restrictionsByBlockId( $restrictions );
+
+               // Load the existing restrictions and organize by block id. Any block ids
+               // that were passed into this function will be used to load all of the
+               // existing restrictions. This list might be the same, or may be completely
+               // different.
+               $existingList = [];
+               $blockIds = array_keys( $restrictionList );
+               if ( !empty( $blockIds ) ) {
+                       $result = $dbw->select(
+                               [ 'ipblocks_restrictions', 'page' ],
+                               [ 'ir_ipb_id', 'ir_type', 'ir_value' ],
+                               [ 'ir_ipb_id' => $blockIds ],
+                               __METHOD__,
+                               [ 'FOR UPDATE' ]
+                       );
+
+                       $existingList = self::restrictionsByBlockId(
+                               self::resultToRestrictions( $result )
+                       );
+               }
+
+               $result = true;
+               // Perform the actions on a per block-id basis.
+               foreach ( $restrictionList as $blockId => $blockRestrictions ) {
+                       // Insert all of the restrictions first, ignoring ones that already exist.
+                       $success = self::insert( $blockRestrictions );
+
+                       // Update the result. The first false is the result, otherwise, true.
+                       $result = $success && $result;
+
+                       $restrictionsToRemove = self::restrictionsToRemove(
+                               $existingList[$blockId] ?? [],
+                               $restrictions
+                       );
+
+                       // Nothing to remove.
+                       if ( empty( $restrictionsToRemove ) ) {
+                               continue;
+                       }
+
+                       $success = self::delete( $restrictionsToRemove );
+
+                       // Update the result. The first false is the result, otherwise, true.
+                       $result = $success && $result;
+               }
+
+               $dbw->endAtomic( __METHOD__ );
+
+               return $result;
+       }
+
+       /**
+        * Updates the list of restrictions by parent id.
+        *
+        * @param int $parentBlockId
+        * @param Restriction[] $restrictions
+        * @return bool
+        */
+       public static function updateByParentBlockId( $parentBlockId, array $restrictions ) {
+               // If removing all of the restrictions, then just delete them all.
+               if ( empty( $restrictions ) ) {
+                       return self::deleteByParentBlockId( $parentBlockId );
+               }
+
+               $parentBlockId = (int)$parentBlockId;
+
+               $db = wfGetDb( DB_MASTER );
+
+               $db->startAtomic( __METHOD__ );
+
+               $blockIds = $db->selectFieldValues(
+                       'ipblocks',
+                       'ipb_id',
+                       [ 'ipb_parent_block_id' => $parentBlockId ],
+                       __METHOD__,
+                       [ 'FOR UPDATE' ]
+               );
+
+               $result = true;
+               foreach ( $blockIds as $id ) {
+                       $success = self::update( self::setBlockId( $id, $restrictions ) );
+                       // Update the result. The first false is the result, otherwise, true.
+                       $result = $success && $result;
+               }
+
+               $db->endAtomic( __METHOD__ );
+
+               return $result;
+       }
+
+       /**
+        * Delete the restrictions.
+        *
+        * @param Restriction[]|null $restrictions
+        * @throws MWException
+        * @return bool
+        */
+       public static function delete( array $restrictions ) {
+               $dbw = wfGetDB( DB_MASTER );
+               $result = true;
+               foreach ( $restrictions as $restriction ) {
+                       if ( !$restriction instanceof Restriction ) {
+                               continue;
+                       }
+
+                       $success = $dbw->delete(
+                               'ipblocks_restrictions',
+                               // The restriction row is made up of a compound primary key. Therefore,
+                               // the row and the delete conditions are the same.
+                               $restriction->toRow(),
+                               __METHOD__
+                       );
+                       // Update the result. The first false is the result, otherwise, true.
+                       $result = $success && $result;
+               }
+
+               return $result;
+       }
+
+       /**
+        * Delete the restrictions by Block ID.
+        *
+        * @param int|array $blockId
+        * @throws MWException
+        * @return bool
+        */
+       public static function deleteByBlockId( $blockId ) {
+               $dbw = wfGetDB( DB_MASTER );
+               return $dbw->delete(
+                       'ipblocks_restrictions',
+                       [ 'ir_ipb_id' => $blockId ],
+                       __METHOD__
+               );
+       }
+
+       /**
+        * Delete the restrictions by Parent Block ID.
+        *
+        * @param int|array $parentBlockId
+        * @throws MWException
+        * @return bool
+        */
+       public static function deleteByParentBlockId( $parentBlockId ) {
+               $dbw = wfGetDB( DB_MASTER );
+               return $dbw->deleteJoin(
+                       'ipblocks_restrictions',
+                       'ipblocks',
+                       'ir_ipb_id',
+                       'ipb_id',
+                       [ 'ipb_parent_block_id' => $parentBlockId ],
+                       __METHOD__
+               );
+       }
+
+       /**
+        * Checks if two arrays of Restrictions are effectively equal. This is a loose
+        * equality check as the restrictions do not have to contain the same block
+        * ids.
+        *
+        * @param Restriction[] $a
+        * @param Restriction[] $b
+        * @return bool
+        */
+       public static function equals( array $a, array $b ) {
+               $filter = function ( $restriction ) {
+                       return $restriction instanceof Restriction;
+               };
+
+               // Ensure that every item in the array is a Restriction. This prevents a
+               // fatal error from calling Restriction::getHash if something in the array
+               // is not a restriction.
+               $a = array_filter( $a, $filter );
+               $b = array_filter( $b, $filter );
+
+               $aCount = count( $a );
+               $bCount = count( $b );
+
+               // If the count is different, then they are obviously a different set.
+               if ( $aCount !== $bCount ) {
+                       return false;
+               }
+
+               // If both sets contain no items, then they are the same set.
+               if ( $aCount === 0 && $bCount === 0 ) {
+                       return true;
+               }
+
+               $hasher = function ( $r ) {
+                       return $r->getHash();
+               };
+
+               $aHashes = array_map( $hasher, $a );
+               $bHashes = array_map( $hasher, $b );
+
+               sort( $aHashes );
+               sort( $bHashes );
+
+               return $aHashes === $bHashes;
+       }
+
+       /**
+        * Set the blockId on a set of restrictions and return a new set.
+        *
+        * @param int $blockId
+        * @param Restriction[] $restrictions
+        * @return Restriction[]
+        */
+       public static function setBlockId( $blockId, array $restrictions ) {
+               $blockRestrictions = [];
+
+               foreach ( $restrictions as $restriction ) {
+                       if ( !$restriction instanceof Restriction ) {
+                               continue;
+                       }
+
+                       // Clone the restriction so any references to the current restriction are
+                       // not suddenly changed to a different blockId.
+                       $restriction = clone $restriction;
+                       $restriction->setBlockId( $blockId );
+
+                       $blockRestrictions[] = $restriction;
+               }
+
+               return $blockRestrictions;
+       }
+
+       /**
+        * Get the restrictions that should be removed, which are existing
+        * restrictions that are not in the new list of restrictions.
+        *
+        * @param Restriction[] $existing
+        * @param Restriction[] $new
+        * @return array
+        */
+       private static function restrictionsToRemove( array $existing, array $new ) {
+               return array_filter( $existing, function ( $e ) use ( $new ) {
+                       foreach ( $new as $restriction ) {
+                               if ( !$restriction instanceof Restriction ) {
+                                       continue;
+                               }
+
+                               if ( $restriction->equals( $e ) ) {
+                                       return false;
+                               }
+                       }
+
+                       return true;
+               } );
+       }
+
+       /**
+        * Converts an array of restrictions to an associative array of restrictions
+        * where the keys are the block ids.
+        *
+        * @param Restriction[] $restrictions
+        * @return array
+        */
+       private static function restrictionsByBlockId( array $restrictions ) {
+               $blockRestrictions = [];
+
+               foreach ( $restrictions as $restriction ) {
+                       // Ensure that all of the items in the array are restrictions.
+                       if ( !$restriction instanceof Restriction ) {
+                               continue;
+                       }
+
+                       if ( !isset( $blockRestrictions[$restriction->getBlockId()] ) ) {
+                               $blockRestrictions[$restriction->getBlockId()] = [];
+                       }
+
+                       $blockRestrictions[$restriction->getBlockId()][] = $restriction;
+               }
+
+               return $blockRestrictions;
+       }
+
+       /**
+        * Convert an Result Wrapper to an array of restrictions.
+        *
+        * @param IResultWrapper $result
+        * @return Restriction[]
+        */
+       private static function resultToRestrictions( IResultWrapper $result ) {
+               $restrictions = [];
+               foreach ( $result as $row ) {
+                       $restriction = self::rowToRestriction( $row );
+
+                       if ( !$restriction ) {
+                               continue;
+                       }
+
+                       $restrictions[] = $restriction;
+               }
+
+               return $restrictions;
+       }
+
+       /**
+        * Convert a result row from the database into a restriction object.
+        *
+        * @param \stdClass $row
+        * @return Restriction|null
+        */
+       private static function rowToRestriction( \stdClass $row ) {
+               switch ( $row->ir_type ) {
+                       case PageRestriction::TYPE_ID:
+                               return PageRestriction::newFromRow( $row );
+                       default:
+                               return null;
+               }
+       }
+}
diff --git a/includes/block/Restriction/AbstractRestriction.php b/includes/block/Restriction/AbstractRestriction.php
new file mode 100644 (file)
index 0000000..88a6a0f
--- /dev/null
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Abstract block restriction.
+ *
+ * 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\Restriction;
+
+abstract class AbstractRestriction implements Restriction {
+
+       /**
+        * @var int
+        */
+       protected $blockId;
+
+       /**
+        * @var int
+        */
+       protected $value;
+
+       /**
+        * Create Restriction.
+        *
+        * @param int $blockId
+        * @param int $value
+        */
+       public function __construct( $blockId, $value ) {
+               $this->blockId = (int)$blockId;
+               $this->value = (int)$value;
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function getBlockId() {
+               return $this->blockId;
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function setBlockId( $blockId ) {
+               $this->blockId = (int)$blockId;
+
+               return $this;
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function getValue() {
+               return $this->value;
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public static function newFromRow( \stdClass $row ) {
+               return new static( $row->ir_ipb_id, $row->ir_value );
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function toRow() {
+               return [
+                       'ir_ipb_id' => $this->getBlockId(),
+                       'ir_type' => $this->getTypeId(),
+                       'ir_value' => $this->getValue(),
+               ];
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function equals( Restriction $other ) {
+               return $this->getHash() === $other->getHash();
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function getHash() {
+               return $this->getType() . '-' . $this->getValue();
+       }
+}
diff --git a/includes/block/Restriction/PageRestriction.php b/includes/block/Restriction/PageRestriction.php
new file mode 100644 (file)
index 0000000..209b148
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+/**
+ * A Block restriction object of type 'Page'.
+ *
+ * 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\Restriction;
+
+class PageRestriction extends AbstractRestriction {
+
+       const TYPE = 'page';
+       const TYPE_ID = 1;
+
+       /**
+        * @var \Title
+        */
+       protected $title;
+
+       /**
+        * {@inheritdoc}
+        */
+       public function matches( \Title $title ) {
+               return $title->equals( $this->getTitle() );
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function getType() {
+               return self::TYPE;
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function getTypeId() {
+               return self::TYPE_ID;
+       }
+
+       /**
+        * Set the title.
+        *
+        * @param \Title $title
+        * @return self
+        */
+       public function setTitle( \Title $title ) {
+               $this->title = $title;
+
+               return $this;
+       }
+
+       /**
+        * Get Title.
+        *
+        * @return \Title|null
+        */
+       public function getTitle() {
+               if ( !$this->title ) {
+                       $this->title = \Title::newFromID( $this->value );
+               }
+
+               return $this->title;
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public static function newFromRow( \stdClass $row ) {
+               $restriction = parent::newFromRow( $row );
+
+               // If the page_namespace and the page_title were provided, add the title to
+               // the restriction.
+               if ( isset( $row->page_namespace ) && isset( $row->page_title ) ) {
+                       // Clone the row so it is not mutated.
+                       $row = clone $row;
+                       $row->page_id = $row->ir_value;
+                       $title = \Title::newFromRow( $row );
+                       $restriction->setTitle( $title );
+               }
+
+               return $restriction;
+       }
+}
diff --git a/includes/block/Restriction/Restriction.php b/includes/block/Restriction/Restriction.php
new file mode 100644 (file)
index 0000000..f1cc1b0
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Block restriction interface.
+ *
+ * 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\Restriction;
+
+interface Restriction {
+
+       /**
+        * Gets the id of the block.
+        *
+        * @return int
+        */
+       public function getBlockId();
+
+       /**
+        * Sets the id of the block.
+        *
+        * @param int $blockId
+        * @return self
+        */
+       public function setBlockId( $blockId );
+
+       /**
+        * Gets the value of the restriction.
+        *
+        * @return int
+        */
+       public function getValue();
+
+       /**
+        * Gets the type of restriction
+        *
+        * @return string
+        */
+       public function getType();
+
+       /**
+        * Gets the id of the type of restriction. This id is used in the database.
+        *
+        * @return string
+        */
+       public function getTypeId();
+
+       /**
+        * Creates a new Restriction from a database row.
+        *
+        * @return self
+        */
+       public static function newFromRow( \stdClass $row );
+
+       /**
+        * Convert a restriction object into a row array for insertion.
+        *
+        * @return array
+        */
+       public function toRow();
+
+       /**
+        * Determine if a restriction matches a given title.
+        *
+        * @param \Title $title
+        * @return bool
+        */
+       public function matches( \Title $title );
+
+       /**
+        * Determine if a restriction equals another restriction.
+        *
+        * @param Restriction $other
+        * @return bool
+        */
+       public function equals( Restriction $other );
+
+       /**
+        * Create a unique hash of the block restriction based on the type and value.
+        *
+        * @return string
+        */
+       public function getHash();
+
+}
index 1f2b81d..32f7519 100644 (file)
@@ -55,7 +55,7 @@ class WikiExporter {
        const TEXT = 0;
        const STUB = 1;
 
-       const BATCH_SIZE = 1000;
+       const BATCH_SIZE = 50000;
 
        /** @var int */
        public $text;
@@ -367,8 +367,9 @@ class WikiExporter {
                } elseif ( $this->history & self::FULL ) {
                        # Full history dumps...
                        # query optimization for history stub dumps
-                       if ( $this->text == self::STUB && $orderRevs ) {
+                       if ( $this->text == self::STUB ) {
                                $tables = $revQuery['tables'];
+                               $opts[] = 'STRAIGHT_JOIN';
                                $opts['USE INDEX']['revision'] = 'rev_page_id';
                                unset( $join['revision'] );
                                $join['page'] = [ 'INNER JOIN', 'rev_page=page_id' ];
index 50c7e3e..c6882c4 100644 (file)
@@ -172,6 +172,7 @@ class HTMLForm extends ContextSource {
                'title' => HTMLTitleTextField::class,
                'user' => HTMLUserTextField::class,
                'usersmultiselect' => HTMLUsersMultiselectField::class,
+               'titlesmultiselect' => HTMLTitlesMultiselectField::class,
        ];
 
        public $mFieldData;
diff --git a/includes/htmlform/fields/HTMLTitlesMultiselectField.php b/includes/htmlform/fields/HTMLTitlesMultiselectField.php
new file mode 100644 (file)
index 0000000..c93c940
--- /dev/null
@@ -0,0 +1,120 @@
+<?php
+
+use MediaWiki\Widget\TitlesMultiselectWidget;
+
+/**
+ * Implements a tag multiselect input field for titles.
+ *
+ * Besides the parameters recognized by HTMLTitleTextField, additional recognized
+ * parameters are:
+ *  default - (optional) Array of usernames to use as preset data
+ *  placeholder - (optional) Custom placeholder message for input
+ *
+ * The result is the array of titles
+ *
+ * This widget is a duplication of HTMLUsersMultiselectField, except for:
+ * - The configuration variable changed to 'titles' (from 'users')
+ * - OOUI modules were adjusted for the TitlesMultiselectWidget
+ * - The PHP version instantiates a MediaWiki\Widget\TitlesMultiselectWidget
+ *
+ * @note This widget is not likely to remain functional in non-OOUI forms.
+ */
+class HTMLTitlesMultiselectField extends HTMLTitleTextField {
+       public function __construct( $params ) {
+               $params += [
+                       // This overrides the default from HTMLTitleTextField
+                       'required' => false,
+               ];
+
+               parent::__construct( $params );
+       }
+
+       public function loadDataFromRequest( $request ) {
+               $value = $request->getText( $this->mName, $this->getDefault() );
+
+               $titlesArray = explode( "\n", $value );
+               // Remove empty lines
+               $titlesArray = array_values( array_filter( $titlesArray, function ( $title ) {
+                       return trim( $title ) !== '';
+               } ) );
+               // This function is expected to return a string
+               return implode( "\n", $titlesArray );
+       }
+
+       public function validate( $value, $alldata ) {
+               if ( !$this->mParams['exists'] ) {
+                       return true;
+               }
+
+               if ( is_null( $value ) ) {
+                       return false;
+               }
+
+               // $value is a string, because HTMLForm fields store their values as strings
+               $titlesArray = explode( "\n", $value );
+
+               if ( isset( $this->mParams['max'] ) ) {
+                       if ( count( $titlesArray ) > $this->mParams['max'] ) {
+                               return $this->msg( 'htmlform-int-toohigh', $this->mParams['max'] );
+                       }
+               }
+
+               foreach ( $titlesArray as $title ) {
+                       $result = parent::validate( $title, $alldata );
+                       if ( $result !== true ) {
+                               return $result;
+                       }
+               }
+
+               return true;
+       }
+
+       public function getInputHTML( $value ) {
+               $this->mParent->getOutput()->enableOOUI();
+               return $this->getInputOOUI( $value );
+       }
+
+       public function getInputOOUI( $value ) {
+               $params = [
+                       'id' => $this->mID,
+                       'name' => $this->mName,
+                       'dir' => $this->mDir,
+               ];
+
+               if ( isset( $this->mParams['disabled'] ) ) {
+                       $params['disabled'] = $this->mParams['disabled'];
+               }
+
+               if ( isset( $this->mParams['default'] ) ) {
+                       $params['default'] = $this->mParams['default'];
+               }
+
+               if ( isset( $this->mParams['placeholder'] ) ) {
+                       $params['placeholder'] = $this->mParams['placeholder'];
+               } else {
+                       $params['placeholder'] = $this->msg( 'mw-widgets-titlesmultiselect-placeholder' )->plain();
+               }
+
+               if ( !is_null( $value ) ) {
+                       // $value is a string, but the widget expects an array
+                       $params['default'] = $value === '' ? [] : explode( "\n", $value );
+               }
+
+               // Make the field auto-infusable when it's used inside a legacy HTMLForm rather than OOUIHTMLForm
+               $params['infusable'] = true;
+               $params['classes'] = [ 'mw-htmlform-field-autoinfuse' ];
+               $widget = new TitlesMultiselectWidget( $params );
+               $widget->setAttributes( [ 'data-mw-modules' => implode( ',', $this->getOOUIModules() ) ] );
+
+               return $widget;
+       }
+
+       protected function shouldInfuseOOUI() {
+               return true;
+       }
+
+       protected function getOOUIModules() {
+               return [ 'mediawiki.widgets.TitlesMultiselectWidget' ];
+       }
+
+}
index 8112ccb..47d9f48 100644 (file)
        "config-help": "مساعدة",
        "config-help-tooltip": "اضغط للتوسيع",
        "config-nofile": "لا يمكن العثور على الملف \"$1\". هل حُذف؟",
-       "config-extension-link": "هل كنت تعلم أن الويكي الخاصة بك تدعم [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions الامتدادات]؟\n\nيمكنك تصفح [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category الامتدادات حسب التصنيف] أو [https://www.mediawiki.org/wiki/Extension_Matrix مصفوفة الامتدادت] لترى القائمة الكاملة للامتدادات.",
+       "config-extension-link": "هل كنت تعلم أن الويكي الخاص بك تدعم [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions الامتدادات]؟\n\nيمكنك تصفح [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category الامتدادات حسب التصنيف].",
        "config-skins-screenshots": "$1 (لقطات شاشة: $2)",
        "config-extensions-requires": "$1 (يتطلب $2)",
        "config-screenshot": "لقطة شاشة",
index 4acde23..f76ffab 100644 (file)
        "config-help": "дапамога",
        "config-help-tooltip": "націсьніце, каб разгарнуць",
        "config-nofile": "Файл «$1» ня знойдзены. Ці быў ён выдалены?",
-       "config-extension-link": "Ці ведаеце вы, што вашая вікі падтрымлівае [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions пашырэньні]?\n\nВы можаце праглядзець [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category пашырэньні паводле катэгорыяў] або [https://www.mediawiki.org/wiki/Extension_Matrix матрыцу пашырэньняў], каб пабачыць поўны сьпіс.",
+       "config-extension-link": "Ці ведаеце вы, што вашая вікі падтрымлівае [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions пашырэньні]?\n\nВы можаце праглядзець [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category пашырэньні паводле катэгорыяў].",
        "config-skins-screenshots": "$1 (здымкі экрану: $2)",
        "config-extensions-requires": "$1 (патрабуе $2)",
        "config-screenshot": "здымак экрану",
index 95fd726..ecddb39 100644 (file)
        "config-help": "aide",
        "config-help-tooltip": "cliquer pour agrandir",
        "config-nofile": "Le fichier « $1 » est introuvable. A-t-il été supprimé ?",
-       "config-extension-link": "Saviez-vous que votre wiki prend en charge [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions des extensions] ?\n\nVous pouvez consulter les [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category extensions par catégorie] ou la [https://www.mediawiki.org/wiki/Extension_Matrix matrice des extensions] pour voir la liste complète des extensions.",
+       "config-extension-link": "Saviez-vous que votre wiki prend en charge [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions des extensions] ?\n\nVous pouvez consulter les [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category extensions par catégorie].",
        "config-skins-screenshots": "$1 (captures d’écran : $2)",
        "config-extensions-requires": "$1 (nécessite $2)",
        "config-screenshot": "Captures d’écrans",
index b526d5a..c336c06 100644 (file)
        "config-help": "adjuta",
        "config-help-tooltip": "clicca pro displicar",
        "config-nofile": "Le file \"$1\" non poteva esser trovate. Ha illo essite delite?",
-       "config-extension-link": "Sapeva tu que tu wiki supporta [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions extensiones]?\n\nTu pote explorar le [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category extensiones per category] o le [https://www.mediawiki.org/wiki/Extension_Matrix matrice de extensiones] pro vider le lista complete de extensiones.",
+       "config-extension-link": "Sapeva tu que tu wiki supporta [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions extensiones]?\n\nTu pote explorar le [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category extensiones per categoria].",
        "config-skins-screenshots": "$1 (capturas de schermo: $2)",
        "config-extensions-requires": "$1 (require $2)",
        "config-screenshot": "captura de schermo",
index 1e88f7b..fef5391 100644 (file)
        "config-install-mainpage-failed": "Kunne ikke sette inn hovedside: $1",
        "config-install-done": "<strong>Gratulrerer!</strong>\nDu har lykkes i å installere MediaWiki.\n\nInstallasjonsprogrammet har generert en <code>LocalSettings.php</code>-fil.\nDen inneholder alle dine konfigureringer.\n\nDu må laste den ned og legge den på hovedfolderen for din wiki-installasjon (der index.php ligger). Nedlastingen skulle ha startet automatisk.\n\nHvis ingen nedlasting ble tilbudt, eller du avbrøt den, kan du få den i gang ved å klikke på lenken under:\n\n$3\n\n<strong>OBS:</strong> Hvis du ikke gjør dette nå, vil den genererte konfigurasjonsfilen ikke være tilgjengelig for deg senere.\n\nNår dette er gjort, kan du <strong>[$2 gå inn i wikien]</strong>.",
        "config-install-done-path": "<strong>Gratulerer!</strong>\nDu har installert MediaWiki.\n\nInstallereren har generert en <code>LocalSettings.php</code>-fil.\nDen inneholder all konfigurasjonen for wikien.\n\nDu må laste den ned og legge den i <code>$4</code>. Nedlastingen skal ha startet automatisk.\n\nOm nedlastingen ikke ble startet, eller om du avbrøt den, kan du starte på nytt ved å klikke lenken nedenfor:\n\n$3\n\n<strong>Merk:</strong> Om du ikke gjør dette nå vil den genererte konfigurasjonen ikke være tilgjengelig senere.\n\nNår dette er gjort kan du <strong>[$2 gå til wikien din]</strong>.",
-       "config-install-success": "MediaWiki har blitt installert. Du kan nå\nbesøke <$1$2> for å se wikien din.\nOm du har spørsmål, sjekk de ofte stilte spørsmålene:\n<https://www.mediawiki.org/wiki/Manual:FAQ> eller bruk et av\nsupportforumene som lenkes til fra den siden.",
+       "config-install-success": "MediaWiki har blitt installert. Du kan nå\nbesøke <$1$2> for å se wikien din.\nOm du har spørsmål, sjekk de ofte stilte spørsmålene:\n<https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ> eller bruk et av\nsupportforumene som lenkes til fra den siden.",
        "config-download-localsettings": "Last ned <code>LocalSettings.php</code>",
        "config-help": "hjelp",
        "config-help-tooltip": "klikk for å utvide",
        "config-nofile": "Filen \"$1\" ble ikke funnet. Kan den være blitt slettet?",
-       "config-extension-link": "Visste du at wikien din kan brukes sammen med en mengde [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions utvidelser]?\n\nDu kan sjekke gjennom [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category utvidelser per kategori] eller [https://www.mediawiki.org/wiki/Extension_Matrix utvidelsesmatrisen] for å se den komplette listen av utvidelser.",
+       "config-extension-link": "Visste du at wikien din kan brukes sammen med en mengde [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions utvidelser]?\n\nDu kan sjekke gjennom [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category utvidelser per kategori] for å se den komplette listen av utvidelser.",
        "config-skins-screenshots": "$1 (skjermbilder: $2)",
        "config-extensions-requires": "$1 (krever $2)",
        "config-screenshot": "skjermbilde",
+       "config-extension-not-found": "Kunne ikke finne registreringsfil for utvidelsen «$1»",
+       "config-extension-dependency": "En avhengighetsfeil inntraff under installering av utvidelsen «$1»: $2",
        "mainpagetext": "<strong>MediaWiki har blitt installert.</strong>",
        "mainpagedocfooter": "Sjekk [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents brukerveiledningen] for å få informasjon om hvordan du bruker wiki-programvaren.\n\n==Hvordan komme igang==\n*[https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Innstillingsliste]\n*[https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ Ofte stilte spørsmål om MediaWiki]\n*[https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki e-postliste]\n*[https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Tilpass MediaWiki for ditt språk]\n*[https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Lær deg å beskytte deg mot spam på wikien din]"
 }
index e4a3734..9d6fe7c 100644 (file)
        "config-help": "ajuda",
        "config-help-tooltip": "clique para expandir",
        "config-nofile": "O arquivo \"$1\" não foi encontrado. Ele foi apagado?",
-       "config-extension-link": "Você sabia que sua wiki suporta [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions extensões]?\n\nVocê pode explorar as [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category extensões por categoria] ou visitar a [https://www.mediawiki.org/wiki/Extension_Matrix Matriz de Extensões] para ver a lista completa.",
+       "config-extension-link": "Você sabia que sua wiki suporta [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Extensions extensões]?\n\nVocê pode explorar as [https://www.mediawiki.org/wiki/Special:MyLanguage/Category:Extensions_by_category extensões por categoria]",
        "config-skins-screenshots": "$1 (screenshots: $2)",
        "config-extensions-requires": "$1 (requer $2)",
        "config-screenshot": "screenshot",
index dd2e51f..1f82d3b 100644 (file)
        "config-install-mainpage-failed": "Kunde inte infoga huvudsidan: $1",
        "config-install-done": "<strong>Grattis!</strong>\nDu har installerat MediaWiki.\n\nInstallationsprogrammet har genererat filen <code>LocalSettings.php</code>.\nDet innehåller alla dina konfigurationer.\n\nDu kommer att behöva ladda ner den och placera den i roten för din wiki-installation (samma katalog som index.php). Nedladdningen borde ha startats automatiskt.\n\nOm ingen nedladdning erbjöds, eller om du har avbrutit det kan du starta om nedladdningen genom att klicka på länken nedan:\n\n$3\n\n<strong>OBS</strong>: Om du inte gör detta nu, kommer denna genererade konfigurationsfil inte vara tillgänglig för dig senare om du avslutar installationen utan att ladda ned den.\n\nNär det är klart, kan du <strong>[$2 gå in på din wiki]</strong>",
        "config-install-done-path": "<strong>Grattis!</strong>\nDu har installerat MediaWiki.\n\nInstallationsprogrammet har genererat filen <code>LocalSettings.php</code>.\nDet innehåller alla dina konfigurationer.\n\nDu kommer att behöva ladda ner den och placera den i <code>$4</code>. Nedladdningen borde ha startats automatiskt.\n\nOm ingen nedladdning erbjöds, eller om du har avbrutit det kan du starta om nedladdningen genom att klicka på länken nedan:\n\n$3\n\n<strong>OBS</strong>: Om du inte gör detta nu, kommer denna genererade konfigurationsfil inte vara tillgänglig för dig senare om du avslutar installationen utan att ladda ned den.\n\nNär det är klart, kan du <strong>[$2 gå in på din wiki]</strong>",
-       "config-install-success": "MediaWiki har installerats. Du kan nu besöka <$1$2> för att se din wiki.\nOm du undrar någonting, kolla in vår lista över vanliga ställda frågor:\n<https://www.mediawiki.org/wiki/Manual:FAQ> eller använda något supportforum som länkas på sidan.",
+       "config-install-success": "MediaWiki har installerats. Du kan nu besöka <$1$2> för att se din wiki.\nOm du undrar någonting, kolla in vår lista över vanliga ställda frågor:\n<https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ> eller använda något supportforum som länkas på sidan.",
        "config-download-localsettings": "Ladda ner <code>LocalSettings.php</code>",
        "config-help": "hjälp",
        "config-help-tooltip": "klicka för att expandera",
        "config-skins-screenshots": "$1 (skärmbilder: $2)",
        "config-extensions-requires": "$1 (kräver $2)",
        "config-screenshot": "skärmbild",
+       "config-extension-not-found": "Kunde inte hitta registreringsfilen för tillägget \"$1\"",
+       "config-extension-dependency": "En beroendefel inträffade när tillägget \"$1\" installerades: $2",
        "mainpagetext": "<strong>MediaWiki har installerats utan problem.</strong>",
        "mainpagedocfooter": "Information om hur wiki-programvaran används finns i [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents användarguiden].\n\n== Att komma igång ==\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Lista över konfigurationsinställningar]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ MediaWiki FAQ]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce E-postlista för nya versioner av MediaWiki]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Lokalisera MediaWiki för ditt språk]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Läs om hur du bekämpar spam på din wiki]"
 }
index 3762d62..2698cbe 100644 (file)
@@ -68,6 +68,17 @@ class BlockLogFormatter extends LogFormatter {
                        );
                        $params[5] = isset( $params[5] ) ?
                                self::formatBlockFlags( $params[5], $this->context->getLanguage() ) : '';
+
+                       // block restrictions
+                       if ( isset( $params[6] ) ) {
+                               $pages = $params[6]['pages'] ?? [];
+                               $pages = array_map( function ( $page ){
+                                       return $this->makePageLink( Title::newFromText( ( $page ) ) );
+                               }, $pages );
+
+                               $params[6] = Message::rawParam( $this->context->getLanguage()->listToText( $pages ) );
+                               $params[7] = count( $pages );
+                       }
                }
 
                return $params;
@@ -188,6 +199,7 @@ class BlockLogFormatter extends LogFormatter {
                        '6:array:flags',
                        '6::flags' => '6:array:flags',
                ];
+
                foreach ( $map as $index => $key ) {
                        if ( isset( $params[$index] ) ) {
                                $params[$key] = $params[$index];
@@ -195,6 +207,8 @@ class BlockLogFormatter extends LogFormatter {
                        }
                }
 
+               ksort( $params );
+
                $subtype = $entry->getSubtype();
                if ( $subtype === 'block' || $subtype === 'reblock' ) {
                        // Defaults for old log entries missing some fields
@@ -226,7 +240,37 @@ class BlockLogFormatter extends LogFormatter {
                if ( isset( $ret['flags'] ) ) {
                        ApiResult::setIndexedTagName( $ret['flags'], 'f' );
                }
+
+               if ( isset( $ret['restrictions']['pages'] ) ) {
+                       $ret['restrictions']['pages'] = array_map( function ( $title ) {
+                               return $this->formatParameterValueForApi( 'page', 'title-link', $title );
+                       }, $ret['restrictions']['pages'] );
+                       ApiResult::setIndexedTagName( $ret['restrictions']['pages'], 'p' );
+               }
+
                return $ret;
        }
 
+       protected function getMessageKey() {
+               $type = $this->entry->getType();
+               $subtype = $this->entry->getSubtype();
+               $sitewide = $this->entry->getParameters()['sitewide'] ?? true;
+
+               $key = "logentry-$type-$subtype";
+               if ( ( $subtype === 'block' || $subtype === 'reblock' ) && !$sitewide ) {
+                       // $this->getMessageParameters is doing too much. We just need
+                       // to check the presence of restrictions ($param[6]) and calling
+                       // on parent gives us that
+                       $params = parent::getMessageParameters();
+
+                       // message changes depending on whether there are editing restrictions or not
+                       if ( isset( $params[6] ) ) {
+                               $key = "logentry-partial$type-$subtype";
+                       } else {
+                               $key = "logentry-non-editing-$type-$subtype";
+                       }
+               }
+
+               return $key;
+       }
 }
index af4f293..9f7f280 100644 (file)
@@ -820,7 +820,6 @@ class Article implements Page {
                // Note that the ArticleViewHeader hook is allowed to set $outputDone to a
                // ParserOutput instance.
                $pOutput = ( $outputDone instanceof ParserOutput )
-                       // phpcs:ignore MediaWiki.Usage.NestedInlineTernary.UnparenthesizedTernary -- FIXME T203805
                        ? $outputDone // object fetched by hook
                        : ( $this->mParserOutput ?: null ); // ParserOutput or null, avoid false
 
index 081af19..18797d9 100644 (file)
@@ -2727,8 +2727,13 @@ class WikiPage implements Page, IDBAccessObject {
                        // in the job queue to avoid simultaneous deletion operations would add overhead.
                        // Number of archived revisions cannot be known beforehand, because edits can be made
                        // while deletion operations are being processed, changing the number of archivals.
-                       $archivedRevisionCount = $dbw->selectRowCount(
-                               'archive', '1', [ 'ar_page_id' => $id ], __METHOD__
+                       $archivedRevisionCount = $dbw->selectField(
+                               'archive', 'COUNT(*)',
+                               [
+                                       'ar_namespace' => $this->getTitle()->getNamespace(),
+                                       'ar_title' => $this->getTitle()->getDBkey(),
+                                       'ar_page_id' => $id
+                               ], __METHOD__
                        );
 
                        // Clone the title and wikiPage, so we have the information we need when
index f32b1b7..3265ce7 100644 (file)
@@ -911,11 +911,6 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                        'section' => 'editing/editor',
                        'label-message' => 'tog-useeditwarning',
                ];
-               $defaultPreferences['showtoolbar'] = [
-                       'type' => 'toggle',
-                       'section' => 'editing/editor',
-                       'label-message' => 'tog-showtoolbar',
-               ];
 
                $defaultPreferences['previewonfirst'] = [
                        'type' => 'toggle',
diff --git a/includes/resourceloader/ResourceLoaderEditToolbarModule.php b/includes/resourceloader/ResourceLoaderEditToolbarModule.php
deleted file mode 100644 (file)
index 2a6af71..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/**
- * ResourceLoader module for the edit toolbar.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * ResourceLoader module for the edit toolbar.
- *
- * @since 1.24
- */
-class ResourceLoaderEditToolbarModule extends ResourceLoaderFileModule {
-       /**
-        * Get language-specific LESS variables for this module.
-        *
-        * @since 1.27
-        * @param ResourceLoaderContext $context
-        * @return array
-        */
-       protected function getLessVars( ResourceLoaderContext $context ) {
-               $vars = parent::getLessVars( $context );
-               $language = Language::factory( $context->getLanguage() );
-               foreach ( $language->getImageFiles() as $key => $value ) {
-                       $vars[$key] = CSSMin::serializeStringValue( $value );
-               }
-               return $vars;
-       }
-}
index a60595a..6b9b9d4 100644 (file)
@@ -21,6 +21,9 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\Block\BlockRestriction;
+use MediaWiki\Block\Restriction\PageRestriction;
+
 /**
  * A special page that allows users with 'block' right to block users from
  * editing pages and other actions
@@ -137,41 +140,63 @@ class SpecialBlock extends FormSpecialPage {
 
                $conf = $this->getConfig();
                $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
+               $enablePartialBlocks = $conf->get( 'EnablePartialBlocks' );
 
-               $a = [
-                       'Target' => [
-                               'type' => 'user',
-                               'ipallowed' => true,
-                               'iprange' => true,
-                               'label-message' => 'ipaddressorusername',
-                               'id' => 'mw-bi-target',
-                               'size' => '45',
-                               'autofocus' => true,
-                               'required' => true,
-                               'validation-callback' => [ __CLASS__, 'validateTargetField' ],
-                       ],
-                       'Expiry' => [
-                               'type' => 'expiry',
-                               'label-message' => 'ipbexpiry',
-                               'required' => true,
-                               'options' => $suggestedDurations,
-                               'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
-                       ],
-                       'Reason' => [
-                               'type' => 'selectandother',
-                               // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
-                               // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
-                               // Unicode codepoints (or 255 UTF-8 bytes for old schema).
-                               'maxlength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
-                               'maxlength-unit' => 'codepoints',
-                               'label-message' => 'ipbreason',
-                               'options-message' => 'ipbreason-dropdown',
-                       ],
-                       'CreateAccount' => [
-                               'type' => 'check',
-                               'label-message' => 'ipbcreateaccount',
-                               'default' => true,
-                       ],
+               $a = [];
+
+               $a['Target'] = [
+                       'type' => 'user',
+                       'ipallowed' => true,
+                       'iprange' => true,
+                       'label-message' => 'ipaddressorusername',
+                       'id' => 'mw-bi-target',
+                       'size' => '45',
+                       'autofocus' => true,
+                       'required' => true,
+                       'validation-callback' => [ __CLASS__, 'validateTargetField' ],
+               ];
+
+               if ( $enablePartialBlocks ) {
+                       $a['EditingRestriction'] = [
+                               'type' => 'radio',
+                               'label' => $this->msg( 'ipb-type-label' )->text(),
+                               'options' => [
+                                       $this->msg( 'ipb-sitewide' )->text() => 'sitewide',
+                                       $this->msg( 'ipb-partial' )->text() => 'partial',
+                               ],
+                       ];
+                       $a['PageRestrictions'] = [
+                               'type' => 'titlesmultiselect',
+                               'label' => $this->msg( 'ipb-pages-label' )->text(),
+                               'exists' => true,
+                               'max' => 10,
+                               'cssclass' => 'mw-block-page-restrictions',
+                       ];
+               }
+
+               $a['Expiry'] = [
+                       'type' => 'expiry',
+                       'label-message' => 'ipbexpiry',
+                       'required' => true,
+                       'options' => $suggestedDurations,
+                       'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
+               ];
+
+               $a['Reason'] = [
+                       'type' => 'selectandother',
+                       // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
+                       // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
+                       // Unicode codepoints (or 255 UTF-8 bytes for old schema).
+                       'maxlength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
+                       'maxlength-unit' => 'codepoints',
+                       'label-message' => 'ipbreason',
+                       'options-message' => 'ipbreason-dropdown',
+               ];
+
+               $a['CreateAccount'] = [
+                       'type' => 'check',
+                       'label-message' => 'ipbcreateaccount',
+                       'default' => true,
                ];
 
                if ( self::canBlockEmail( $user ) ) {
@@ -327,6 +352,29 @@ class SpecialBlock extends FormSpecialPage {
                        unset( $fields['Confirm']['default'] );
                        $this->preErrors[] = [ 'ipb-blockingself', 'ipb-confirmaction' ];
                }
+
+               if ( $this->getConfig()->get( 'EnablePartialBlocks' ) ) {
+                       if ( $block instanceof Block && !$block->isSitewide() ) {
+                               $fields['EditingRestriction']['default'] = 'partial';
+                       } else {
+                               $fields['EditingRestriction']['default'] = 'sitewide';
+                       }
+
+                       if ( $block instanceof Block ) {
+                               $pageRestrictions = [];
+                               foreach ( $block->getRestrictions() as $restriction ) {
+                                       if ( $restriction->getType() !== 'page' ) {
+                                               continue;
+                                       }
+
+                                       $pageRestrictions[] = $restriction->getTitle()->getPrefixedText();
+                               }
+
+                               // Sort the restrictions so they are in alphabetical order.
+                               sort( $pageRestrictions );
+                               $fields['PageRestrictions']['default'] = implode( "\n", $pageRestrictions );
+                       }
+               }
        }
 
        /**
@@ -632,6 +680,7 @@ class SpecialBlock extends FormSpecialPage {
                global $wgBlockAllowsUTEdit, $wgHideUserContribLimit;
 
                $performer = $context->getUser();
+               $enablePartialBlocks = $context->getConfig()->get( 'EnablePartialBlocks' );
 
                // Handled by field validator callback
                // self::validateTargetField( $data['Target'] );
@@ -740,11 +789,35 @@ class SpecialBlock extends FormSpecialPage {
                $block->isAutoblocking( $data['AutoBlock'] );
                $block->mHideName = $data['HideUser'];
 
+               if (
+                       $enablePartialBlocks &&
+                       isset( $data['EditingRestriction'] ) &&
+                       $data['EditingRestriction'] === 'partial'
+                ) {
+                        $block->isSitewide( false );
+               }
+
                $reason = [ 'hookaborted' ];
                if ( !Hooks::run( 'BlockIp', [ &$block, &$performer, &$reason ] ) ) {
                        return $reason;
                }
 
+               $restrictions = [];
+               if ( $enablePartialBlocks ) {
+                       if ( !empty( $data['PageRestrictions'] ) ) {
+                               $restrictions = array_map( function ( $text ) {
+                                       $title = Title::newFromText( $text );
+                                       // Use the link cache since the title has already been loaded when
+                                       // the field was validated.
+                                       $restriction = new PageRestriction( 0, $title->getArticleId() );
+                                       $restriction->setTitle( $title );
+                                       return $restriction;
+                               }, explode( "\n", $data['PageRestrictions'] ) );
+                       }
+
+                       $block->setRestrictions( $restrictions );
+               }
+
                $priorBlock = null;
                # Try to insert block. Is there a conflicting block?
                $status = $block->insert();
@@ -784,6 +857,17 @@ class SpecialBlock extends FormSpecialPage {
                                $currentBlock->prevents( 'editownusertalk', $block->prevents( 'editownusertalk' ) );
                                $currentBlock->mReason = $block->mReason;
 
+                               if ( $enablePartialBlocks ) {
+                                       // Maintain the sitewide status. If partial blocks is not enabled,
+                                       // saving the block will result in a sitewide block.
+                                       $currentBlock->isSitewide( $block->isSitewide() );
+
+                                       // Set the block id of the restrictions.
+                                       $currentBlock->setRestrictions(
+                                               BlockRestriction::setBlockId( $currentBlock->getId(), $restrictions )
+                                       );
+                               }
+
                                $status = $currentBlock->update();
 
                                $logaction = 'reblock';
@@ -826,6 +910,13 @@ class SpecialBlock extends FormSpecialPage {
                $logParams = [];
                $logParams['5::duration'] = $data['Expiry'];
                $logParams['6::flags'] = self::blockLogFlags( $data, $type );
+               $logParams['sitewide'] = $block->isSitewide();
+
+               if ( $enablePartialBlocks && !empty( $data['PageRestrictions'] ) ) {
+                       $logParams['7::restrictions'] = [
+                               'pages' => explode( "\n", $data['PageRestrictions'] ),
+                       ];
+               }
 
                # Make log entry, if the name is hidden, put it in the suppression log
                $log_type = $data['HideUser'] ? 'suppress' : 'block';
@@ -965,7 +1056,10 @@ class SpecialBlock extends FormSpecialPage {
         * @return string
         */
        protected static function blockLogFlags( array $data, $type ) {
-               global $wgBlockAllowsUTEdit;
+               $config = RequestContext::getMain()->getConfig();
+
+               $blockAllowsUTEdit = $config->get( 'BlockAllowsUTEdit' );
+
                $flags = [];
 
                # when blocking a user the option 'anononly' is not available/has no effect
@@ -991,7 +1085,7 @@ class SpecialBlock extends FormSpecialPage {
                        $flags[] = 'noemail';
                }
 
-               if ( $wgBlockAllowsUTEdit && $data['DisableUTEdit'] ) {
+               if ( $blockAllowsUTEdit && $data['DisableUTEdit'] ) {
                        // For grepping: message block-log-flags-nousertalk
                        $flags[] = 'nousertalk';
                }
index 342f6db..aebec2f 100644 (file)
@@ -134,7 +134,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        case 'badaccess':
                                throw new PermissionsError( 'sendemail' );
                        case 'blockedemailuser':
-                               throw new UserBlockedError( $this->getUser()->mBlock );
+                               throw $this->getBlockedEmailError();
                        case 'actionthrottledtext':
                                throw new ThrottledError;
                        case 'mailnologin':
@@ -156,7 +156,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                // if the user opens Special:EmailUser/Florian (e.g.). So check, if the user did that
                // and show the "Send email to user" form directly, if so. Show the "enter username"
                // form, otherwise.
-               $this->mTargetObj = self::getTarget( $this->mTarget );
+               $this->mTargetObj = self::getTarget( $this->mTarget, $this->getUser() );
                if ( !$this->mTargetObj instanceof User ) {
                        $this->userForm( $this->mTarget );
                } else {
@@ -318,7 +318,6 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        ->setMethod( 'post' )
                        ->setSubmitCallback( [ $this, 'sendEmailForm' ] )
                        ->setFormIdentifier( 'userForm' )
-                       ->setSubmitProgressive()
                        ->setId( 'askusername' )
                        ->setWrapperLegendMsg( 'emailtarget' )
                        ->setSubmitTextMsg( 'emailusernamesubmit' )
@@ -520,4 +519,17 @@ class SpecialEmailUser extends UnlistedSpecialPage {
        protected function getGroupName() {
                return 'users';
        }
+
+       /**
+        * Builds an error message based on the block params
+        *
+        * @return ErrorPageError
+        */
+       private function getBlockedEmailError() {
+               $block = $this->getUser()->mBlock;
+               $params = $block->getBlockErrorParams( $this->getContext() );
+
+               $msg = $block->isSitewide() ? 'blockedtext' : 'blocked-email-user';
+               return new ErrorPageError( 'blockedtitle', $msg, $params );
+       }
 }
index f9d6b5f..836b6df 100644 (file)
@@ -177,7 +177,7 @@ class SpecialUpload extends SpecialPage {
                }
 
                # Check blocks
-               if ( $user->isBlocked() ) {
+               if ( $user->isBlockedFromUpload() ) {
                        throw new UserBlockedError( $user->getBlock() );
                }
 
index 5789c28..74ec6b5 100644 (file)
@@ -22,6 +22,8 @@
 /**
  * @ingroup Pager
  */
+use MediaWiki\Block\BlockRestriction;
+use MediaWiki\Block\Restriction\Restriction;
 use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\IResultWrapper;
 
@@ -30,6 +32,13 @@ class BlockListPager extends TablePager {
        protected $conds;
        protected $page;
 
+       /**
+        * Array of restrictions.
+        *
+        * @var Restriction[]
+        */
+       protected $restrictions = [];
+
        /**
         * @param SpecialPage $page
         * @param array $conds
@@ -72,6 +81,8 @@ class BlockListPager extends TablePager {
                                'blocklist-nousertalk',
                                'unblocklink',
                                'change-blocklink',
+                               'blocklist-editing',
+                               'blocklist-editing-sitewide',
                        ];
 
                        foreach ( $keys as $key ) {
@@ -179,6 +190,18 @@ class BlockListPager extends TablePager {
 
                        case 'ipb_params':
                                $properties = [];
+
+                               if ( $this->getConfig()->get( 'EnablePartialBlocks' ) ) {
+                                       if ( $row->ipb_sitewide ) {
+                                               $properties[] = htmlspecialchars( $msg['blocklist-editing-sitewide'] );
+                                       }
+                               }
+
+                               if ( !$row->ipb_sitewide && $this->restrictions ) {
+                                       $list = $this->getRestrictionListHTML( $this->restrictions, $row );
+                                       $properties[] = htmlspecialchars( $msg['blocklist-editing'] ) . $list;
+                               }
+
                                if ( $row->ipb_anon_only ) {
                                        $properties[] = htmlspecialchars( $msg['anononlyblock'] );
                                }
@@ -197,7 +220,17 @@ class BlockListPager extends TablePager {
                                        $properties[] = htmlspecialchars( $msg['blocklist-nousertalk'] );
                                }
 
-                               $formatted = $language->commaList( $properties );
+                               $formatted = Html::rawElement(
+                                               'ul',
+                                               [],
+                                               implode( '', array_map( function ( $prop ) {
+                                                       return HTML::rawElement(
+                                                               'li',
+                                                               [],
+                                                               $prop
+                                                       );
+                                               }, $properties ) )
+                                       );
                                break;
 
                        default:
@@ -208,6 +241,47 @@ class BlockListPager extends TablePager {
                return $formatted;
        }
 
+       /**
+        * Get Restriction List HTML
+        *
+        * @param Restriction[] $restrictions
+        * @param stdClass $row
+        *
+        * @return string
+        */
+       private static function getRestrictionListHTML(
+               array $restrictions,
+               stdClass $row
+       ) {
+               $items = [];
+
+               foreach ( $restrictions as $restriction ) {
+                       if ( $restriction->getBlockId() !== (int)$row->ipb_id ) {
+                               continue;
+                       }
+
+                       if ( $restriction->getType() !== 'page' ) {
+                               continue;
+                       }
+
+                       $items[] = HTML::rawElement(
+                               'li',
+                               [],
+                               Linker::link( $restriction->getTitle() )
+                       );
+               }
+
+               if ( empty( $items ) ) {
+                       return '';
+               }
+
+               return Html::rawElement(
+                       'ul',
+                       [],
+                       implode( '', $items )
+               );
+       }
+
        function getQueryInfo() {
                $commentQuery = CommentStore::getStore()->getJoin( 'ipb_reason' );
                $actorQuery = ActorMigration::newMigration()->getJoin( 'ipb_by' );
@@ -232,6 +306,7 @@ class BlockListPager extends TablePager {
                                'ipb_deleted',
                                'ipb_block_email',
                                'ipb_allow_usertalk',
+                               'ipb_sitewide',
                        ] + $commentQuery['fields'] + $actorQuery['fields'],
                        'conds' => $this->conds,
                        'join_conds' => [
@@ -296,6 +371,7 @@ class BlockListPager extends TablePager {
                $lb = new LinkBatch;
                $lb->setCaller( __METHOD__ );
 
+               $partialBlocks = [];
                foreach ( $result as $row ) {
                        $lb->add( NS_USER, $row->ipb_address );
                        $lb->add( NS_USER_TALK, $row->ipb_address );
@@ -304,6 +380,16 @@ class BlockListPager extends TablePager {
                                $lb->add( NS_USER, $row->by_user_name );
                                $lb->add( NS_USER_TALK, $row->by_user_name );
                        }
+
+                       if ( !$row->ipb_sitewide ) {
+                               $partialBlocks[] = $row->ipb_id;
+                       }
+               }
+
+               if ( $partialBlocks ) {
+                       // Mutations to the $row object are not persisted. The restrictions will
+                       // need be stored in a separate store.
+                       $this->restrictions = BlockRestriction::loadByBlockId( $partialBlocks );
                }
 
                $lb->execute();
index 5e5ca1b..48d54ec 100644 (file)
@@ -2297,21 +2297,22 @@ class User implements IDBAccessObject, UserIdentity {
         * Check if user is blocked from editing a particular article
         *
         * @param Title $title Title to check
-        * @param bool $bFromSlave Whether to check the replica DB instead of the master
+        * @param bool $fromSlave Whether to check the replica DB instead of the master
         * @return bool
         */
-       public function isBlockedFrom( $title, $bFromSlave = false ) {
-               global $wgBlockAllowsUTEdit;
+       public function isBlockedFrom( $title, $fromSlave = false ) {
+               $blocked = $this->isHidden();
 
-               $blocked = $this->isBlocked( $bFromSlave );
-               $allowUsertalk = ( $wgBlockAllowsUTEdit ? $this->mAllowUsertalk : false );
-               // If a user's name is suppressed, they cannot make edits anywhere
-               if ( !$this->mHideName && $allowUsertalk && $title->getText() === $this->getName()
-                       && $title->getNamespace() == NS_USER_TALK ) {
-                       $blocked = false;
-                       wfDebug( __METHOD__ . ": self-talk page, ignoring any blocks\n" );
+               if ( !$blocked ) {
+                       $block = $this->getBlock( $fromSlave );
+                       if ( $block ) {
+                               $blocked = $block->preventsEdit( $title );
+                       }
                }
 
+               // only for the purpose of the hook. We really don't need this here.
+               $allowUsertalk = $this->mAllowUsertalk;
+
                Hooks::run( 'UserIsBlockedFrom', [ $this, $title, &$blocked, &$allowUsertalk ] );
 
                return $blocked;
@@ -2418,7 +2419,7 @@ class User implements IDBAccessObject, UserIdentity {
         */
        public function isHidden() {
                if ( $this->mHideName !== null ) {
-                       return $this->mHideName;
+                       return (bool)$this->mHideName;
                }
                $this->getBlockedStatus();
                if ( !$this->mHideName ) {
@@ -2428,7 +2429,7 @@ class User implements IDBAccessObject, UserIdentity {
                        $this->mHideName = $authUser && $authUser->isHidden();
                        Hooks::run( 'UserIsHidden', [ $this, &$this->mHideName ] );
                }
-               return $this->mHideName;
+               return (bool)$this->mHideName;
        }
 
        /**
@@ -4518,6 +4519,16 @@ class User implements IDBAccessObject, UserIdentity {
                return $this->mBlock && $this->mBlock->prevents( 'sendemail' );
        }
 
+       /**
+        * Get whether the user is blocked from using Special:Upload
+        *
+        * @return bool
+        */
+       public function isBlockedFromUpload() {
+               $this->getBlockedStatus();
+               return $this->mBlock && $this->mBlock->prevents( 'upload' );
+       }
+
        /**
         * Get whether the user is allowed to create an account.
         * @return bool
diff --git a/includes/widget/TitlesMultiselectWidget.php b/includes/widget/TitlesMultiselectWidget.php
new file mode 100644 (file)
index 0000000..95304b0
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+
+namespace MediaWiki\Widget;
+
+use OOUI\MultilineTextInputWidget;
+
+/**
+ * Widget to select multiple titles.
+ *
+ * @copyright 2017 MediaWiki Widgets Team and others; see AUTHORS.txt
+ * @license MIT
+ */
+class TitlesMultiselectWidget extends \OOUI\Widget {
+
+       protected $titlesArray = [];
+       protected $inputName = null;
+       protected $inputPlaceholder = null;
+
+       /**
+        * @param array $config Configuration options
+        *   - array $config['titles'] Array of titles to use as preset data
+        *   - array $config['placeholder'] Placeholder message for input
+        *   - array $config['name'] Name attribute (used in forms)
+        */
+       public function __construct( array $config = [] ) {
+               parent::__construct( $config );
+
+               // Properties
+               if ( isset( $config['default'] ) ) {
+                       $this->titlesArray = $config['default'];
+               }
+               if ( isset( $config['name'] ) ) {
+                       $this->inputName = $config['name'];
+               }
+               if ( isset( $config['placeholder'] ) ) {
+                       $this->inputPlaceholder = $config['placeholder'];
+               }
+
+               $textarea = new MultilineTextInputWidget( [
+                       'name' => $this->inputName,
+                       'value' => implode( "\n", $this->titlesArray ),
+                       'rows' => 10,
+               ] );
+               $this->appendContent( $textarea );
+               $this->addClasses( [ 'mw-widgets-titlesMultiselectWidget' ] );
+       }
+
+       protected function getJavaScriptClassName() {
+               return 'mw.widgets.TitlesMultiselectWidget';
+       }
+
+       public function getConfig( &$config ) {
+               if ( $this->titlesArray !== null ) {
+                       $config['selected'] = $this->titlesArray;
+               }
+               if ( $this->inputName !== null ) {
+                       $config['name'] = $this->inputName;
+               }
+               if ( $this->inputPlaceholder !== null ) {
+                       $config['placeholder'] = $this->inputPlaceholder;
+               }
+
+               $config['$overlay'] = true;
+               return parent::getConfig( $config );
+       }
+
+}
index e75ea1a..dad9c6c 100644 (file)
@@ -814,22 +814,6 @@ class Language {
                return self::$dataCache->getItem( $this->mCode, 'datePreferenceMigrationMap' );
        }
 
-       /**
-        * @param string $image
-        * @return array|null
-        */
-       function getImageFile( $image ) {
-               return self::$dataCache->getSubitem( $this->mCode, 'imageFiles', $image );
-       }
-
-       /**
-        * @return array
-        * @since 1.24
-        */
-       public function getImageFiles() {
-               return self::$dataCache->getItem( $this->mCode, 'imageFiles' );
-       }
-
        /**
         * @return array
         */
@@ -4263,14 +4247,17 @@ class Language {
        }
 
        /**
-        * Check if the language has the specific variant
+        * Strict check if the language has the specific variant.
+        *
+        * Compare to LanguageConverter::validateVariant() which does a more
+        * lenient check and attempts to coerce the given code to a valid one.
         *
         * @since 1.19
         * @param string $variant
         * @return bool
         */
        public function hasVariant( $variant ) {
-               return (bool)$this->mConverter->validateVariant( $variant );
+               return $variant && ( $variant === $this->mConverter->validateVariant( $variant ) );
        }
 
        /**
index ea26c64..21902af 100644 (file)
@@ -212,9 +212,13 @@ class LanguageConverter {
        }
 
        /**
-        * Validate the variant
+        * Validate the variant and return an appropriate strict internal
+        * variant code if one exists.  Compare to Language::hasVariant()
+        * which does a strict test.
+        *
         * @param string|null $variant The variant to validate
-        * @return mixed Returns the variant if it is valid, null otherwise
+        * @return mixed Returns an equivalent valid variant code if possible,
+        *   null otherwise
         */
        public function validateVariant( $variant = null ) {
                if ( $variant === null ) {
index df835bd..c7efd21 100644 (file)
        "exception-nologin-text": "Droëneuh suwah [[Special:Userlogin|neutamöng]] mangat jeuët neupeuhah laman nyoë",
        "virus-unknownscanner": "Antivirus hana geuturi:",
        "logouttext": "'''Droeneuh ka neutubiet log.'''\n\nBeuneuteupue meunyoe na padum-padum laman nyang deuh lagèe na neutamöng log, sampoe ka lheuh neupeugléh ''cache''.",
-       "cannotlogoutnow-title": "H`an jeuet teubiet log jinoe",
+       "cannotlogoutnow-title": "H'an jeuet teubiet jinoe",
        "welcomeuser": "Seulamat trôk teuka, $1 !",
-       "welcomecreation-msg": "Nan droëneuh ka geupeugöt. \nBèk tuwo neuatô [[Special:Preferences|geunalak {{SITENAME}}]] droëneuh.",
+       "welcomecreation-msg": "Akun-neuh ka geupeugöt. \nDroeneuh jeuet neugantoe {{SITENAME}} [[Special:Preferences|peuatô]] meunyö neumeuh'eut.",
        "yourname": "Ureuëng ngui:",
        "userlogin-yourname": "Ureuëng ngui",
        "userlogin-yourname-ph": "Peutamöng nan ureuëng ngui droëneuh",
        "createacct-yourpasswordagain-ph": "Pasoë lom lageuëm rahsia",
        "userlogin-remembermypassword": "Pubiyeuë lôn tamöng",
        "userlogin-signwithsecure": "Ngui koneksi aman",
-       "cannotlogin-title": "H`an jeuet tamong log",
+       "cannotlogin-title": "H'an jeuet tamöng",
+       "cannotloginnow-title": "H'an jeuet tamöng jinoe",
+       "cannotcreateaccount-title": "H'an jeuet peugöt akun",
        "yourdomainname": "Domain droeneuh:",
        "password-change-forbidden": "Droëneuh h‘an jeuët neuubah lageuëm rahsia bak wiki nyoë.",
-       "externaldberror": "Na seunalah bak peusahèh basis data luwa atawa droëneuh hana geubri idin keu neupeubarô akun luwa droëneuh",
+       "externaldberror": "Na seunalah bak peusahèh basis data luwa atawa droëneuh hana geubri idin keu neupubarô akun luwa droëneuh",
        "login": "Tamöng",
-       "nav-login-createaccount": "Tamöng / dapeuta",
+       "nav-login-createaccount": "Tamöng / peugöt akun",
        "logout": "Teubiët",
        "userlogout": "Teubiët",
-       "notloggedin": "Hana tamöng lom",
-       "userlogin-noaccount": "Goh lom neudapeuta?",
+       "notloggedin": "Goh lom neutamöng",
+       "userlogin-noaccount": "Goh lom na akun?",
        "userlogin-joinproject": "Neugabông ngön {{SITENAME}}",
        "createaccount": "Peudapeuta nan barô",
        "userlogin-resetpassword-link": "Tuwö lageuëm rahsia?",
        "userlogin-helplink2": "Beunantu tamöng log",
        "userlogin-loggedin": "Droëneuh ka neutamöng seubagoë $1. Neungui blangko di yup keu neutamöng seubagoë ureuëng ngui la’én",
-       "userlogin-createanother": "Peudapeuta nan barô",
+       "userlogin-createanother": "Peugöt akun laén",
        "createacct-emailrequired": "Alamat surat-e",
        "createacct-emailoptional": "Alamat surat-e (hana wajéb)",
        "createacct-email-ph": "Neupasoë alamat surat-e droëneuh",
        "createacct-realname": "Nan aseuli (hana wajéb)",
        "createacct-reason": "Alasan:",
        "createacct-reason-ph": "Pakön droëneuh neupeugöt nan ureuëng ngui la’én",
-       "createacct-submit": "Peudapeuta nan barô",
+       "createacct-submit": "Peugöt akun Droeneuh",
        "createacct-another-submit": "Peugöt nan ureuëng ngui la’én",
+       "createacct-continue-submit": "Lanjut pumeugöt akun",
        "createacct-benefit-heading": "{{SITENAME}} geupeugöt lé ureuëng lagèë droëneuh.",
        "createacct-benefit-body1": "{{PLURAL:$1|peusaneut}}",
        "createacct-benefit-body2": "{{PLURAL:$1|$1 halaman}}",
        "badretype": "Lageuëm rahsia nyang neupasoë salah.",
        "userexists": "Nan ureuëng ngui nyang neupasoë ka na soë ngui.\nNeupiléh nan nyang la'én.",
        "loginerror": "Salah bak tamöng",
-       "createacct-error": "Peudapeuta nan barô hana meuhasé",
-       "createaccounterror": "H‘an jeuët peudapeuta nan: $1",
+       "createacct-error": "Pumeugöt akun hana meuhasé",
+       "createaccounterror": "H'an jeuet peugöt akun: $1",
        "nocookiesnew": "Nan ureueng ngui nyoe ka meupeugöt, tapi goh meutamöng.\n{{SITENAME}} jingui ''cookies'' keu peutamöng ureueng ngui.\n''Cookies'' droeneuh hana meupeuudép.\nNeupeuudép ''cookies'' dilèe, lheuh nyan neutamöng ngön nan ureueng ngui ngön lageuem rahsia droeneuh.",
        "noname": "Nan ureuëng ngui nyang Droënueh peutamöng hana sah.",
        "loginsuccesstitle": "Meuhasé tamöng log",
        "loginsuccess": "'''Droëneuh  jinoë ka neutamöng di {{SITENAME}} sibagoë \"$1\".'''",
-       "nosuchuser": "Hana ureuëng ngui ngön nan \"$1\".\nHaraih rayek ngön haraih ubeut na peungarôh.\nTulông neuparéksa keulayi ijaan-neuh, atawa [[Special:CreateAccount|neudapeuta barô]].",
+       "nosuchuser": "Hana ureuëng ngui ngön nan \"$1\".\nHaraih rayek ngön haraih ubeut na peungarôh.\nNeuparéksa ijaan-neuh, atawa [[Special:CreateAccount|neupeugöt akun]].",
        "nosuchusershort": "Hana ureuëng ngui ngön nan \"$1\".\nPréksa keulayi neu’ija Droëneuh.",
        "nouserspecified": "Neupasoë nan Droëneuh.",
        "login-userblocked": "Ureuëng ngui nyoë ka teublokir, hana idin/hanjeut tamöng.",
        "noemail": "Hana alamat surat-e nyang teucatat keu ureuëng ngui \"$1\".",
        "noemailcreate": "Droeneuh suwah neuseudia alamt surat-e nyang jeut ngui.",
        "passwordsent": "Lageuëm barô ka geupeu'et u surat-e nyang geupeudapeuta keu \"$1\". Neutamöng teuma lheuëh neuteurimöng surat-e nyan.",
-       "eauthentsent": "Saboh surat-e keu peunyö ka geukirém u alamat surat-e Droëneuh. Droëneuh beuneuseutöt préntah lam surat nyan keu neupeunyö meunyö alamat nyan nakeuh beutôi atra Droëneuh. {{SITENAME}} h‘an geupeuudép surat Droëneuh meunyö langkah nyoë hana neupeubuet lom.",
+       "eauthentsent": "Saboh surat-e keu peusahèh ka geupeuét u alamat surat-e neuh. Sigohlom surat-e laén geupeuét u akun, Droëneuh beu neuseutöt préntah lam surat nyan, keu neupeusahèh meunyö akun nyan keubit atra Droeneuh.",
        "cannotchangeemail": "Alamat surat-e han jeut geugantoe bak wiki nyoe.",
        "emaildisabled": "Situs nyoe han jeut geukirém surat-e.",
-       "accountcreated": "Ureuëng ngui ka teupeugöt",
-       "accountcreatedtext": "Ureuëng ngui keu [[{{ns:User}}:$1|$1]]([[{{ns:User talk}}:$1|talk]]) ka teupeugöt.",
+       "accountcreated": "Akun ka geupeugöt",
+       "accountcreatedtext": "Akun ureuëng ngui keu [[{{ns:User}}:$1|$1]] ([[{{ns:User talk}}:$1|marit]]) ka geupeugöt.",
        "createaccount-title": "Peugöt ureuëng ngui keu {{SITENAME}}",
        "login-throttled": "Droeneuh ka lé that neuujoe tamöng.\nNeuprèh $1 sigohlom neuujoe lom.",
        "login-abort-generic": "Log tamöng droëneuh han meuhasé- Ngon ka geupeubateuë.",
        "user-mail-no-body": "Droëneuh ka neucuba kirém e-surat soh ngon that paneuk",
        "changepassword": "Gantoe lageuem rahsia",
        "resetpass_announce": "Keu neutamöng log, droëneuh suwah neupeugöt lageuëm rahsia barô",
-       "resetpass_header": "Gantoë lageuëm rahsia nan ureuëng ngui",
+       "resetpass_header": "Gantoë lageuëm rahsia akun",
        "oldpassword": "Lageuëm rahsia awai:",
        "newpassword": "Lageuëm rahsia barô:",
        "retypenew": "Pasoë lom lageuëm barô:",
        "template-protected": "(geulindông)",
        "template-semiprotected": "(siteungoh-lindông)",
        "hiddencategories": "Laman nyoë nakeuh anggèëta nibak {{PLURAL:$1|1 kawan teusom |$1 kawan teusom}}:",
-       "nocreatetext": "{{SITENAME}} ka jitham bak pumeugöt laman barô. \nDroëneuh jeuët neuriwang ngön neupeusaneut laman nyang ka na, atawa [[Special:UserLogin|neutamong log atawa neupeugöt akun]].",
+       "nocreatetext": "{{SITENAME}} ka jitham bak pumeugöt laman barô. \nDroëneuh jeuët neuriwang ngön neupeusaneut laman nyang ka na, atawa [[Special:UserLogin|neutamöng atawa neudapeuta]].",
        "nocreate-loggedin": "Droeneuh hana khut keu neupeugöt laman-laman barô.",
        "sectioneditnotsupported-title": "Peusaneut bideueng hana geudukông",
        "sectioneditnotsupported-text": "Peusaneut bideueng hana geudukông bak laman nyoe.",
        "preferences": "Galak",
        "mypreferences": "Atô",
        "prefs-edits": "Jumeulah neuandam:",
+       "prefsnologintext2": "Neutamöng mangat jeuet neugantoe peuatô",
        "prefs-skin": "Kulét",
        "skin-preview": "Eu dilèe",
        "datedefault": "Hana geunalak",
index 346135c..4d62f66 100644 (file)
        "passwordpolicies-policy-passwordcannotmatchblacklist": "لا يمكن أن تتطابق كلمة المرور مع كلمات المرور المدرجة على القائمة السوداء تحديدا",
        "passwordpolicies-policy-maximalpasswordlength": "يجب أن يكون طول كلمة المرور أقل من $1 {{PLURAL:$1|حرف|أحرف}}",
        "passwordpolicies-policy-passwordcannotbepopular": "لا يمكن أن تكون كلمة المرور {{PLURAL:$1|كلمة المرور الشائعة|في قائمة كلمات المرور الشائعة الـ$1}}",
-       "easydeflate-invaliddeflate": "المحتوى المقدم لا يتم تفريغه بشكل صحيح"
+       "easydeflate-invaliddeflate": "المحتوى المقدم لا يتم تفريغه بشكل صحيح",
+       "unprotected-js": "لأسباب تتعلق بالأمان; لا يمكن تحميل جافا سكريبت من الصفحات غير المحمية; الرجاء إنشاء جافا سكريبت فقط في نطاق ميدياويكي: أو كصفحة فرعية للمستخدم"
 }
index 29bdcb1..45506cc 100644 (file)
        "passwordpolicies-policy-passwordcannotmatchblacklist": "Пароль ня можа супадаць з паролямі з чорнага сьпісу",
        "passwordpolicies-policy-maximalpasswordlength": "Пароль мусіць быць даўжынёй менш за $1 {{PLURAL:$1|сымбаль|сымбалі|сымбаляў}}",
        "passwordpolicies-policy-passwordcannotbepopular": "Пароль ня можа {{PLURAL:$1|супадаць з самым папулярным паролем|быць зь сьпісу $1 папулярных пароляў}}",
-       "easydeflate-invaliddeflate": "Пададзены зьмест ня сьціснуты адпаведным чынам"
+       "easydeflate-invaliddeflate": "Пададзены зьмест ня сьціснуты адпаведным чынам",
+       "unprotected-js": "З прычынаў бясьпекі JavaScript ня можа быць загружаны зь неабароненых сайтаў. Калі ласка, стварайце javascript выключна ў прасторы назваў MediaWiki: ці як падстаронку ўдзельніка"
 }
index 66849a1..ca956c2 100644 (file)
        "badarticleerror": "এই পাতায় এই কাজটি করা সম্ভব নয়।",
        "cannotdelete": "\"$1\" পাতা বা ফাইলটি মোছা সম্ভব হয়নি।\nসম্ভবত অন্য কেউ আগেই এটিকে মুছে ফেলেছেন।",
        "cannotdelete-title": "\"$1\" পাতাটি মুছে ফেলা যাচ্ছে না",
+       "delete-scheduled": "\"$1\" পাতাটি মুছে ফেলার জন্য তালিকাভুক্ত হয়েছে।\nদয়া করে ধৈর্য ধরুন।",
        "delete-hook-aborted": "হুকের কারণে পাতা মোছার কাজটি পরিত্যক্ত হয়েছে।\nকোন ব্যাখ্যা দেয়া হয়নি।",
        "no-null-revision": "\"$1\" পাতার জন্য ফাঁকা সংস্করণ তৈরী করা যায়নি",
        "badtitle": "ভুল শিরোনাম",
        "stub-threshold-disabled": "নিস্ক্রিয়",
        "recentchangesdays": "সাম্প্রতিক পরিবর্তন পাতায় প্রদর্শিত দিনের সংখ্যা:",
        "recentchangesdays-max": "সর্বোচ্চ $1 {{PLURAL:$1|দিনের}}",
-       "recentchangescount": "সামà§\8dপà§\8dরতিà¦\95 à¦ªà¦°à¦¿à¦¬à¦°à§\8dতনà§\87 à¦ªà§\8dরদরà§\8dশিত à¦¸à¦®à§\8dপাদনার à¦ªà§\82রà§\8dবনিরà§\8dধারিত সংখ্যা:",
+       "recentchangescount": "পà§\82রà§\8dবনিরà§\8dধারিতভাবà§\87, à¦¸à¦¾à¦®à§\8dপà§\8dরতিà¦\95 à¦ªà¦°à¦¿à¦¬à¦°à§\8dতনà§\87, à¦ªà¦¾à¦¤à¦¾à¦° à¦\87তিহাসà§\87, à¦\93 à¦²à¦\97à§\87 à¦ªà§\8dরদরà§\8dশনà§\87র à¦\9cনà§\8dয à¦¸à¦®à§\8dপাদনার সংখ্যা:",
        "prefs-help-recentchangescount": "সর্বোচ্চ সংখ্যা: ১০০০",
        "prefs-help-watchlist-token2": "এটি আপনার নজরতালিকার ওয়েব ফিডের গোপন চাবি।\nকেউ যদি এটি জানতে পারেন, তাহলে তিনি আপনার নজরতালিকা পড়তে সক্ষম হবেন, তাই এটি প্রকাশ করবেন না।\n[[Special:ResetTokens|আপনার এটি পুনঃনির্ধারণ করার প্রয়োজন হলে এখানে ক্লিক করুন]]।",
        "prefs-help-tokenmanagement": "আপনি আপনার অ্যাকাউন্টের জন্য গোপন চাবি দেখতে এবং পুনরায় নির্ধারন করতে পারবেন যা দিয়ে আপনার নজরতালিকার ওয়েব ফিডে প্রবেশাধিকার পাওয়া যাবে। যে কেউ যিনি এই চাবিটি জানেন তিনি আপনার নজর তালিকাটি পড়তে সক্ষম হবেন, তাই এটি অন্যদের সাথে ভাগ করবেন না।",
        "rcfilters-activefilters": "সক্রিয় ছাঁকনিসমূহ",
        "rcfilters-activefilters-hide": "লুকান",
        "rcfilters-activefilters-show": "দেখান",
+       "rcfilters-activefilters-hide-tooltip": "সক্রিয় ছাঁকনির এলাকা লুকান",
+       "rcfilters-activefilters-show-tooltip": "সক্রিয় ছাঁকনির এলাকা দেখান",
        "rcfilters-advancedfilters": "উন্নত ছাঁকনি",
        "rcfilters-limit-title": "যেসব ফলাফল দেখাবে",
        "rcfilters-limit-and-date-label": "$1টি {{PLURAL:$1|পরিবর্তন}}, $2",
        "imagelinks": "ফাইলের ব্যবহার",
        "linkstoimage": "নিম্নলিখিত {{PLURAL:$1|পাতাটি|$1টি পাতা}} এই ফাইল ব্যবহার করে:",
        "linkstoimage-more": "এই ফাইলের সাথে $1টির বেশি {{PLURAL:$1|পাতার লিংক}} রয়েছে।\nনিচের তালিকায় ফাইলের সাথে যুক্ত {{PLURAL:$1|প্রথম পাতাটির লিংক|প্রথম $1টি পাতার লিংক}} দেখানো হচ্চে।\nএছাড়া একটি [[Special:WhatLinksHere/$2|পূর্ণাঙ্গ তালিকাও]] রয়েছে।",
-       "nolinkstoimage": "এই ফাইলে সংযোগ করে এমন কোন পাতা নেই।",
+       "nolinkstoimage": "এই ফাইল ব্যবহার করে এমন কোন পাতা নেই।",
        "morelinkstoimage": "এই ফাইলের [[Special:WhatLinksHere/$1|আরও লিঙ্ক]] দেখাও।",
        "linkstoimage-redirect": "$1 (ফাইল পুনঃর্নিদেশ) $2",
        "duplicatesoffile": "নিচের {{PLURAL:$1|ফাইলটি|$1 ফাইলগুলো}} এই ফাইলের প্রতিলিপি ([[Special:FileDuplicateSearch/$2|বিস্তারিত দেখুন]]):",
        "prefixindex": "উপসর্গ সহ সমস্ত পাতা",
        "prefixindex-namespace": "উপসর্গ সহ সকল পাতা ($1 নামস্থান)",
        "prefixindex-submit": "দেখাও",
-       "prefixindex-strip": "তালিà¦\95া à¦¥à§\87à¦\95ে উপসর্গ লুকান",
+       "prefixindex-strip": "ফলাফলে উপসর্গ লুকান",
        "shortpages": "সংক্ষিপ্ত পাতাসমূহ",
        "longpages": "দীর্ঘ পাতাসমূহ",
        "deadendpages": "যেসব পাতা থেকে কোনো সংযোগ নেই",
        "pageinfo-category-files": "ফাইলের সংখ্যা",
        "pageinfo-user-id": "ব্যবহারকারী আইডি",
        "pageinfo-file-hash": "হ্যাশ মান",
+       "pageinfo-view-protect-log": "এই পাতার জন্য সুরক্ষা লগ দেখুন।",
        "markaspatrolleddiff": "পরীক্ষিত হিসেবে চিহ্নিত করুন",
        "markaspatrolledtext": "এই পাতাটি পরীক্ষিত হিসেবে চিহ্নিত করুন",
        "markaspatrolledtext-file": "এই ফাইলের সংস্করণ পরীক্ষিত হিসেবে চিহ্নিত করুন",
        "previousdiff": "← পুরনো সম্পাদনা",
        "nextdiff": "নতুনতর সম্পাদনা →",
        "mediawarning": "'''সতর্কীকরণ''': এই ফাইলের ধরনে ক্ষতিকর কোড থাকতে পারে। এটি চালালে আপনার সিস্টেমে ক্ষতি হতে পারে।",
-       "imagemaxsize": "à¦\9bবির à¦\86à¦\95ারà§\87র à¦¸à¦°à§\8dবà§\8bà¦\9aà§\8dà¦\9a à¦¸à§\80মা:<br />''(à¦\9bবির à¦¬à¦¿à¦¬à¦°à¦£ à¦ªà¦¾à¦¤à¦¾à¦° à¦\9cনà§\8dয)''",
+       "imagemaxsize": "à¦\9bবির à¦¬à¦¿à¦¬à¦°à¦£à§\87র à¦ªà¦¾à¦¤à¦¾à¦¯à¦¼ à¦\9bবির à¦\86à¦\95ারà§\87র à¦¸à¦°à§\8dবà§\8bà¦\9aà§\8dà¦\9a à¦¸à§\80মা:",
        "thumbsize": "থাম্বনেইল আকার:",
        "widthheightpage": "$1 × $2, $3টি {{PLURAL:$1|পাতা}}",
        "file-info": "ফাইলের আকার: $1, MIME ধরন: $2",
        "confirm-unwatch-top": "এই পাতাটি আপনার নজরতালিকা থেকে সরিয়ে ফেলতে ইচ্ছুক?",
        "confirm-rollback-button": "ঠিক আছে",
        "confirm-rollback-top": "এই পাতায় করা সম্পাদনাগুলি প্রত্যাবর্তন করবেন?",
+       "confirm-mcrrestore-title": "সংশোধনটি পুনরুদ্ধার করুন",
        "mcrundofailed": "পূর্বাবস্থায় ফেরা ব্যর্থ হয়েছে",
        "quotation-marks": "\"$1\"",
        "imgmultipageprev": "← পূর্ববর্তী পাতা",
        "redirect-file": "ফাইলের নাম",
        "redirect-logid": "লগ আইডি",
        "redirect-not-exists": "মান পাওয়া যায়নি",
+       "redirect-not-numeric": "মান সাংখ্যিক নয়",
        "fileduplicatesearch": "সদৃশ ফাইলের জন্য অনুসন্ধান",
        "fileduplicatesearch-summary": "হ্যাশ ভ্যালুর ওর ভিত্তি করে একই ছবিগুলো খুঁজুন।",
        "fileduplicatesearch-filename": "ফাইলনাম:",
        "unlinkaccounts-success": "অ্যাকাউন্টের সংযোগ বিচ্ছিন্ন করা হয়েছে।",
        "authenticationdatachange-ignored": "প্রমাণীকরণ উপাত্তের পরিবর্তন পরিচালনা করা হয়নি। হয়তো কোন প্রদানকারী কনফিগার করা হয়নি?",
        "userjsispublic": "অনুগ্রহ করে লক্ষ্য করুন: জাভাস্ক্রিপ্টের উপপাতাগুলিতে গোপনীয় তথ্য থাকা উচিত নয় যেহেতু অন্যান্য ব্যবহারকারীও এগুলি দেখতে পান।",
+       "userjsonispublic": "অনুগ্রহ করে লক্ষ্য করুন: JSON উপপাতাগুলিতে গোপনীয় তথ্য থাকা উচিত নয় যেহেতু অন্যান্য ব্যবহারকারীও এগুলি দেখতে পান।",
        "usercssispublic": "অনুগ্রহ করে লক্ষ্য করুন: সিএসএসের উপপাতাগুলিতে গোপনীয় তথ্য থাকা উচিত নয় যেহেতু অন্যান্য ব্যবহারকারীও এগুলি দেখতে পান।",
        "restrictionsfield-badip": "আইপি ঠিকানা অথবা পরিসীমা অবৈধ: $1",
        "restrictionsfield-label": "অনুমোদিত আইপি পরিসীমা:",
        "passwordpolicies-policy-minimalpasswordlength": "পাসওয়ার্ড অবশ্যই {{PLURAL:$1|১ অক্ষরের|$1 অক্ষরের}} হতে হবে",
        "passwordpolicies-policy-passwordcannotmatchusername": "পাসওয়ার্ড ব্যবহারকারী নামের মত একই হতে পারে না",
        "passwordpolicies-policy-passwordcannotmatchblacklist": "পাসওয়ার্ড বিশেষত কালো তালিকাভুক্ত পাসওয়ার্ডের সাথে মিলতে পারবে না",
-       "passwordpolicies-policy-maximalpasswordlength": "পাসওয়ার্ড $1 {{PLURAL:$1|অক্ষরের}} চেয়ে কম দীর্ঘ হতে হবে"
+       "passwordpolicies-policy-maximalpasswordlength": "পাসওয়ার্ড $1 {{PLURAL:$1|অক্ষরের}} চেয়ে কম দীর্ঘ হতে হবে",
+       "unprotected-js": "নিরাপত্তার কারণে জাভাস্ক্রিপ্ট অনিরাপদ পৃষ্ঠা থেকে লোড করা যাবে না। শুধুমাত্র মিডিয়াউইকি: নামস্থান বা ব্যবহারকারী উপপাতায় জাভাস্ক্রিপ্ট তৈরি করুন"
 }
index ed33c4b..b5a6665 100644 (file)
        "duration-seconds": "$1 {{PLURAL:$1|Sekunde|Sekunden}}",
        "duration-minutes": "$1 {{PLURAL:$1|Minute|Minuten}}",
        "duration-hours": "$1 {{PLURAL:$1|Stunde|Stunden}}",
-       "duration-days": "$1 {{PLURAL:$1|Tag|Tage}}",
+       "duration-days": "$1 {{PLURAL:$1|Tag|Tagen}}",
        "duration-weeks": "$1 {{PLURAL:$1|Woche|Wochen}}",
        "duration-years": "$1 {{PLURAL:$1|Jahr|Jahre}}",
        "duration-decades": "$1 {{PLURAL:$1|Jahrzehnt|Jahrzehnte}}",
index e35af5a..91f259e 100644 (file)
@@ -11,7 +11,6 @@
        "tog-extendwatchlist": "Expand watchlist to show all changes, not just the most recent",
        "tog-usenewrc": "Group changes by page in recent changes and watchlist",
        "tog-numberheadings": "Auto-number headings",
-       "tog-showtoolbar": "Show edit toolbar",
        "tog-editondblclick": "Edit pages on double click",
        "tog-editsectiononrightclick": "Enable section editing by right clicking on section titles",
        "tog-watchcreations": "Add pages I create and files I upload to my watchlist",
        "subject-preview": "Preview of subject:",
        "previewerrortext": "An error occurred while attempting to preview your changes.",
        "blockedtitle": "User is blocked",
+       "blocked-email-user": "<strong>Your username has been blocked from sending email. You can still edit other pages on this wiki.</strong> You can view the full block details at [[Special:MyContributions|account contributions]].\n\nThe block was made by $1.\n\nThe reason given is <em>$2</em>.\n\n* Start of block: $8\n* Expiration of block: $6\n* Intended blockee: $7\n* Block ID #$5",
+       "blockedtext-partial": "<strong>Your username or IP address has been blocked from making changes to this page. You can still edit other pages on this wiki.</strong> You can view the full block details at [[Special:MyContributions|account contributions]].\n\nThe block was made by $1.\n\nThe reason given is <em>$2</em>.\n\n* Start of block: $8\n* Expiration of block: $6\n* Intended blockee: $7\n* Block ID #$5",
        "blockedtext": "<strong>Your username or IP address has been blocked.</strong>\n\nThe block was made by $1.\nThe reason given is <em>$2</em>.\n\n* Start of block: $8\n* Expiration of block: $6\n* Intended blockee: $7\n\nYou can contact $1 or another [[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the block.\nYou cannot use the \"{{int:emailuser}}\" feature unless a valid email address is specified in your [[Special:Preferences|account preferences]] and you have not been blocked from using it.\nYour current IP address is $3, and the block ID is #$5.\nPlease include all above details in any queries you make.",
        "autoblockedtext": "Your IP address has been automatically blocked because it was used by another user, who was blocked by $1.\nThe reason given is:\n\n:<em>$2</em>\n\n* Start of block: $8\n* Expiration of block: $6\n* Intended blockee: $7\n\nYou may contact $1 or one of the other [[{{MediaWiki:Grouppage-sysop}}|administrators]] to discuss the block.\n\nNote that you may not use the \"{{int:emailuser}}\" feature unless you have a valid email address registered in your [[Special:Preferences|user preferences]] and you have not been blocked from using it.\n\nYour current IP address is $3, and the block ID is #$5.\nPlease include all above details in any queries you make.",
        "systemblockedtext": "Your username or IP address has been automatically blocked by MediaWiki.\nThe reason given is:\n\n:<em>$2</em>\n\n* Start of block: $8\n* Expiration of block: $6\n* Intended blockee: $7\n\nYour current IP address is $3.\nPlease include all above details in any queries you make.",
        "ipb-disableusertalk": "Prevent this user from editing their own talk page while blocked",
        "ipb-change-block": "Re-block the user with these settings",
        "ipb-confirm": "Confirm block",
+       "ipb-sitewide": "Sitewide",
+       "ipb-partial": "Partial",
+       "ipb-type-label": "Type",
+       "ipb-pages-label": "Pages",
        "badipaddress": "Invalid IP address",
        "blockipsuccesssub": "Block succeeded",
        "blockipsuccesstext": "[[Special:Contributions/$1|$1]] has been blocked.<br />\nSee the [[Special:BlockList|block list]] to review blocks.",
        "createaccountblock": "account creation disabled",
        "emailblock": "email disabled",
        "blocklist-nousertalk": "cannot edit own talk page",
+       "blocklist-editing": "editing",
+       "blocklist-editing-sitewide": "editing (sitewide)",
        "ipblocklist-empty": "The block list is empty.",
        "ipblocklist-no-results": "The requested IP address or username is not blocked.",
        "blocklink": "block",
        "logentry-block-block": "$1 {{GENDER:$2|blocked}} {{GENDER:$4|$3}} with an expiration time of $5 $6",
        "logentry-block-unblock": "$1 {{GENDER:$2|unblocked}} {{GENDER:$4|$3}}",
        "logentry-block-reblock": "$1 {{GENDER:$2|changed}} block settings for {{GENDER:$4|$3}} with an expiration time of $5 $6",
+       "logentry-partialblock-block": "$1 {{GENDER:$2|blocked}} {{GENDER:$4|$3}} from editing {{PLURAL:$8||the pages}} $7 with an expiration time of $5 $6",
+       "logentry-partialblock-reblock": "$1 {{GENDER:$2|changed}} block settings for {{GENDER:$4|$3}} preventing edits on {{PLURAL:$8||the pages}} $7 with an expiration time of $5 $6",
+       "logentry-non-editing-block-block": "$1 {{GENDER:$2|blocked}} {{GENDER:$4|$3}} from non-editing actions with an expiration time of $5 $6",
+       "logentry-non-editing-block-reblock": "$1 {{GENDER:$2|changed}} block settings for {{GENDER:$4|$3}} for non-editing actions with an expiration time of $5 $6",
        "logentry-suppress-block": "$1 {{GENDER:$2|blocked}} {{GENDER:$4|$3}} with an expiration time of $5 $6",
        "logentry-suppress-reblock": "$1 {{GENDER:$2|changed}} block settings for {{GENDER:$4|$3}} with an expiration time of $5 $6",
        "logentry-import-upload": "$1 {{GENDER:$2|imported}} $3 by file upload",
        "mw-widgets-titleinput-description-redirect": "redirect to $1",
        "mw-widgets-categoryselector-add-category-placeholder": "Add a category...",
        "mw-widgets-usersmultiselect-placeholder": "Add more...",
+       "mw-widgets-titlesmultiselect-placeholder": "Add more...",
        "date-range-from": "From date:",
        "date-range-to": "To date:",
        "sessionmanager-tie": "Cannot combine multiple request authentication types: $1.",
index fd9d966..707f980 100644 (file)
        "savechanges": "Konservi ŝanĝojn",
        "publishpage": "Eldoni paĝon",
        "publishchanges": "Publikigi ŝanĝojn",
+       "publishchanges-start": "Publikigi ŝanĝojn…",
        "preview": "Antaŭrigardo",
        "showpreview": "Antaŭrigardo",
        "showdiff": "Montri ŝanĝojn",
index cfd0594..b83ddec 100644 (file)
@@ -33,7 +33,8 @@
                        "MarcoAurelio",
                        "Iñaki LL",
                        "Amaia",
-                       "Matěj Suchánek"
+                       "Matěj Suchánek",
+                       "CiaPan"
                ]
        },
        "tog-underline": "Azpimarratu loturak:",
        "userpage-userdoesnotexist": "\"<nowiki>$1</nowiki>\" lankidea ez dago erregistatuta. Mesedez, konprobatu orri hau editatu/sortu nahi duzun.",
        "userpage-userdoesnotexist-view": "\"$1\" erabiltzaile-kontua ez dago erregistraturik.",
        "blocked-notice-logextract": "Erabiltzaile hau blokeatuta dago une honetan.\nAzken blokeoaren erregistroa ageri da behean, erreferentzia gisa:",
-       "clearyourcache": "<strong>Oharra:</strong> Gorde ondoren, zure nabigatzailearen katxea ekidin beharko duzu aldaketak ikusteko.\n* <strong>Firefox / Safari:</strong> <em>Shift</em> tekla sakatu birkargatzeko momentuan, edo <em>Ctrl-Shift-R</em> edo <em>Crtl-F5</em>  sakatu (<em>⌘-R</em> Mac batean)\n* <strong>Google Chrome:</strong> <em>Ctrl-Shift-R </em>  sakatu (<em>⌘-Shift-R</em> Mac batean)\n* <strong>Internet Explorer:</strong> <em>Ctrl</em> tekla sakatu birkargatzeko momentuan, edo <em>Ctrl-F5</em> sakatu\n* <strong>Opera</strong> erabiltzaileek <em>Tresnak → Hobespenak</em> atalera joan eta katxea garbitzeko aukera hautatu",
+       "clearyourcache": "<strong>Oharra:</strong> Gorde ondoren, zure nabigatzailearen katxea ekidin beharko duzu aldaketak ikusteko.\n* <strong>Firefox / Safari:</strong> <em>Shift</em> tekla sakatu birkargatzeko momentuan, edo <em>Ctrl-Shift-R</em> edo <em>Ctrl-F5</em>  sakatu (<em>⌘-R</em> Mac batean)\n* <strong>Google Chrome:</strong> <em>Ctrl-Shift-R </em>  sakatu (<em>⌘-Shift-R</em> Mac batean)\n* <strong>Internet Explorer:</strong> <em>Ctrl</em> tekla sakatu birkargatzeko momentuan, edo <em>Ctrl-F5</em> sakatu\n* <strong>Opera</strong> erabiltzaileek <em>Tresnak → Hobespenak</em> atalera joan eta katxea garbitzeko aukera hautatu",
        "usercssyoucanpreview": "'''Laguntza:''' Zure CSS berria gorde aurretik probatzeko \"{{int:showpreview}}\" botoia erabili.",
        "userjsonyoucanpreview": "<strong>Aholkua:</strong> Gorde aurretik, erabili \"{{int:showpreview}}\" botoia zure JSON berria probatzeko.",
        "userjsyoucanpreview": "'''Laguntza:''' Zure JS berria gorde aurretik probatzeko \"{{int:showpreview}}\" botoia erabili.",
index 672d973..9c88e57 100644 (file)
        "passwordpolicies-policy-passwordcannotmatchblacklist": "Les mots de passe ne peuvent pas être identiques à ceux qui sont dans la liste noire.",
        "passwordpolicies-policy-maximalpasswordlength": "Les mots de passe doivent avoir moins de $1 caractère{{PLURAL:$1||s}} de long",
        "passwordpolicies-policy-passwordcannotbepopular": "Le mot de passe ne peut pas être {{PLURAL:$1|le mot de passe populaire|dans la liste des $1 mots de passe populaires}}",
-       "easydeflate-invaliddeflate": "Le contenu fourni n'est pas correctement développé"
+       "easydeflate-invaliddeflate": "Le contenu fourni n'est pas correctement développé",
+       "unprotected-js": "Pour des raisons de sécurité, JavaScript ne peut pas être chargé depuis des pages non protégées. Veuillez ne créer du javascript que dans l’espace de noms MediaWiki: ou comme sous-page utilisateur"
 }
index 76a9b41..ab93419 100644 (file)
        "collapsible-collapse": "Roupliyé",
        "collapsible-expand": "Dévlopé",
        "confirmable-confirm": "Ès zòt sir{{GENDER:$1||}} ?",
-       "confirmable-yes": "Wi",
+       "confirmable-yes": "Enren",
        "confirmable-no": "Awa",
        "thisisdeleted": "Ès zòt ka déziré afiché oben rèstoré $1 ?",
        "viewdeleted": "Wè $1 ?",
        "badarticleerror": "Sa agsyon pa pouvé fika éfègtchwé asou sa paj.",
        "cannotdelete": "Enposib di siprimen paj-a oben fiché-a « $1 ».\nSiprésyon-an pitèt ja té éfègtchwé pa rounòt moun.",
        "cannotdelete-title": "Enposib di siprimen paj-a « $1 »",
+       "delete-scheduled": "Paj-a « $1 » sa progranmen pou fika siprimen.\nSouplé, pasyanté.",
        "delete-hook-aborted": "Siprésyon annilé pa roun ègstansyon.\nPyès lèsplikasyon té fourni.",
        "no-null-revision": "Enposib di kréyé roun nouvèl révizyon vid pou paj-a « $1 »",
        "badtitle": "Movè tit",
        "customcssprotected": "Zòt pa gen pèrmisyon-an di modifyé sa féy di èstil CSS, pas li ka kontni paranmèt pésonnèl-ya di rounòt itilizatò.",
        "customjsonprotected": "Zòt pa gen drwè di modifyé sa paj JSON pas li ka kontni paranmèt pésonnèl-ya di rounòt itilizatò.",
        "customjsprotected": "Zòt pa gen pèrmisyon-an di modifyé sa paj di JavaScript, pas li ka kontni paranmèt pésonnèl-ya di rounòt itilizatò.",
+       "sitecssprotected": "Zòt pa gen drwè di modifyé sa paj CSS pas sa pouvé afègté tout vizitò-ya.",
+       "sitejsonprotected": "Zòt pa gen drwé di modifyé sa paj JSON pas sa pouvé afègté tout vizitò-ya.",
+       "sitejsprotected": "Zòt pa gen drwè di modifyé sa paj JavaScript pas sa pouvé afègté tout vizitò-ya.",
        "mycustomcssprotected": "Zòt pa gen drwè di modifyé sa paj CSS.",
        "mycustomjsonprotected": "Zòt pa gen drwè di modifyé sa paj JSON.",
        "mycustomjsprotected": "Zòt pa gen drwè di modifyé sa paj JavaScript.",
        "login-migrated-generic": "Zòt kont té migré, é zòt non d'itilizatò pa ka ègzisté òkò asou sa wiki.",
        "loginlanguagelabel": "Lanng : $1",
        "suspicious-userlogout": "Zòt doumann di konnègsyon té roufizé pas i sanblé ki li té voyé pa roun navigatò défègtché oben dipi kach-a di roun sèrvis mandatèr.",
-       "createacct-another-realname-tip": "Véritab non sa òpsyonèl.\nSi zòt désidé di fourni li, i ké fika itilizé pou krédité lotò di so travay.",
+       "createacct-another-realname-tip": "Véritab non-an sa òpsyonnèl.\nSi zòt désidé di fourni li, i ké fika itilizé pou krédité lotò-a di so travay-ya.",
        "pt-login": "Konnègté so kò",
        "pt-login-button": "Konnègté so kò",
        "pt-login-continue-button": "Kontinwé konnègsyon-an",
        "botpasswords-restriction-failed": "Rèstrigsyon-yan di modipas di robo ka anpéché sa konnègsyon.",
        "botpasswords-invalid-name": "Non-an d'itilizatò spésifyé pa ka kontni di séparatò di mo di pas di robo (« $1 »).",
        "botpasswords-not-exist": "{{GENDER:$1|Itilizatò|Itilizatris}}-a « $1 » pa gen di mo di pas di robo nonmen « $2 ».",
+       "botpasswords-needs-reset": "Modipas-a di robo di non « $2 » di itilizatò-a « $1 » divèt fika réynisyalizé.",
        "resetpass_forbidden": "Mo di pas pa pouvé fika chanjé.",
        "resetpass_forbidden-reason": "Mo di pas pa pouvé fika modifyé : $1",
        "resetpass-no-info": "Zòt divèt fika konnègté pou agsédé dirèkman à sa paj.",
        "editing": "Modifikasyon di $1",
        "creating": "Kréyasyon di $1",
        "editingsection": "Modifikasyon di $1 (sèksyon)",
+       "yourtext": "Zòt tègs",
+       "yourdiff": "Diférans",
        "templatesused": "{{PLURAL:$1|Modèl itilizé}} pa sa paj :",
        "templatesusedpreview": "{{PLURAL:$1|Modèl itilizé}} annan sa prévizwalizasyon :",
        "template-protected": "(protéjé)",
        "permissionserrorstext-withaction": "Zòt pa pouvé $2, pou {{PLURAL:$1|rézon swivant}} :",
        "recreate-moveddeleted-warn": "<strong>Panga : zòt ka roukréyé roun paj ki té présédanman siprimen.</strong>\n\nAsouré-zòt ki i sa pèrtinan di pourswiv modifikasyon-yan asou sa paj.\nJournal-ya dé siprésyon é dé déplasman pou sa paj sa fourni isi pou lenfòrmasyon :",
        "moveddeleted-notice": "Sa paj té siprimen. \nJournal-ya dé siprésyon, dé protègsyon é dé déplasman pou paj-a sa afiché anba pou référans.",
+       "edit-conflict": "Trafalga di modifikasyon.",
+       "postedit-confirmation-created": "Paj-a té fika kréyé.",
+       "invalid-content-data": "Data di kontni pa valid",
        "content-model-wikitext": "wikitèks",
+       "content-model-text": "tègs groso",
+       "content-model-javascript": "JavaScript",
+       "content-json-empty-object": "Lòbjè vid",
+       "content-json-empty-array": "Tablo vid",
        "undo-failure": "Sa modifikasyon pa pouvé fika défè : sa-a té ké rantré an konfli ké modifikasyon entèrmédjèr-ya.",
        "viewpagelogs": "Wè opérasyon-yan asou sa paj",
+       "nohistory": "I pa ka ègzisté di listorik dé modifikasyon pou sa paj.",
+       "currentrev": "Vèrsyon atchwèl",
        "currentrev-asof": "Vèrsyon atchwèl daté di $1",
        "revisionasof": "Vèrsyon di $1",
        "revision-info": "Révizyon daté di $1 pa {{GENDER:$6|$2}}$7",
        "nextrevision": "Vèrsyon swivant →",
        "currentrevisionlink": "Wè vèrsyon atchwèl-a",
        "cur": "atch",
+       "next": "swivan",
        "last": "dif",
+       "page_first": "pronmyé",
+       "page_last": "dannyé",
        "histlegend": "Sélègsyon di diff : koché bouton radjo-ya dé vèrsyon ki à konparé é apiyé asou rantré oben asou bouton-an ki anba.<br />\nLéjann : <strong>({{int:cur}})</strong> = diférans ké dannyé vèrsyon-an, <strong>({{int:last}})</strong> = diférans ké vèrsyon présédan-an, <strong>{{int:minoreditletter}}</strong> = modifikasyon minò.",
        "history-fieldset-title": "Sasé dé révizyon",
        "histfirst": "Pli ansyenn",
        "histlast": "Pli résan-yan",
+       "historyempty": "(vid)",
        "history-feed-title": "Listorik dé vèrsyon",
        "history-feed-description": "Listorik dé vèrsyon pou sa paj asou wiki-a",
        "history-feed-item-nocomment": "$1 à $2",
        "rev-delundel": "afiché/maské",
+       "rev-showdeleted": "afiché",
+       "revdelete-show-file-submit": "Enren",
+       "revdelete-hide-comment": "Rézimen di modifikasyon",
+       "revdelete-log": "Motif",
+       "pagehist": "Listorik di paj-a",
+       "revdelete-reasonotherlist": "Ròt rézon",
        "mergelog": "Journal dé fizyon",
        "history-title": "$1 : Listorik dé vèrsyon",
        "difference-title": "$1 : Diférans ant vèrsyon",
        "searchprofile-articles-tooltip": "Sasé annan $1",
        "searchprofile-images-tooltip": "Sasé dé fiché miltimédja",
        "searchprofile-everything-tooltip": "Sasé annan tout sit-a (osi annan paj di diskisyon-yan)",
-       "searchprofile-advanced-tooltip": "Sasé annan lèspas di non pèrsonalizé",
+       "searchprofile-advanced-tooltip": "Sasé annan lèspas di non-yan ki pésonnalizé",
        "search-result-size": "$1 ({{PLURAL:$2|1 mo|$2}})",
        "search-result-category-size": "$1 manm{{PLURAL:$1|}} ($2 soukatégori{{PLURAL:$2|}}, $3 fiché{{PLURAL:$3|}})",
        "search-redirect": "(Roudirègsyon dipi $1)",
        "speciallogtitlelabel": "Sib (tit oben {{ns:user}}:non di itilizatò) :",
        "log": "Journal d’opérasyon",
        "all-logs-page": "Tout journal piblik",
-       "alllogstext": "Lafichaj konbinen di tout journal-ya ki disponnib asou {{SITENAME}}.\nZòt pouvé pèrsonalizé lafichaj an sélègsyonnan tip di journal-a, non di itilizatò-a oben paj-a ki konsèrnen (sa Dé dannyé sa sansib Ã  lakas).",
+       "alllogstext": "Lafichaj konbinen di tout journal-ya ki disponnib asou {{SITENAME}}.\nZòt pouvé pésonnalizé lafichaj-a an sélègsyonnan tip di journal-a, non di itilizatò-a oben paj-a ki konsèrnen (sa Dé dannyé sa sansib Ã  lakas-a).",
        "logempty": "Pyès lopérasyon ki ka korèsponn annan journal-ya.",
        "allpages": "Tout paj-ya",
        "allarticles": "Tout paj-ya",
        "pageinfo-templates": "{{PLURAL:$1|Modèl enkli}} ($1)",
        "pageinfo-toolboxlink": "Lenfòrmasyon asou paj-a",
        "pageinfo-contentpage": "Konté kou paj di kontni",
-       "pageinfo-contentpage-yes": "Wi",
+       "pageinfo-contentpage-yes": "Enren",
        "patrol-log-page": "Journal dé roulèktir",
        "previousdiff": "← Modifikasyon présédant",
        "nextdiff": "Modifikasyon swivant →",
        "specialpages": "Paj èspésyal",
        "tag-filter": "Filtré [[Special:Tags|baliz]] :",
        "tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1|Baliz}}]] : $2)",
-       "tags-active-yes": "Wi",
+       "tags-active-yes": "Enren",
        "tags-active-no": "Awa",
        "tags-hitcount": "$1 modifikasyon{{PLURAL:$1|}}",
        "logentry-delete-delete": "$1 siprimen paj-a $3",
index b74ff7f..700f98e 100644 (file)
        "sig_tip": "Vaš potpis s datumom",
        "hr_tip": "Vodoravna crta (koristiti rijetko)",
        "summary": "Sažetak:",
-       "subject": "Tema:",
+       "subject": "Predmet:",
        "minoredit": "Ovo je manja promjena",
        "watchthis": "Prati ovu stranicu",
        "savearticle": "Sačuvaj stranicu",
index 04c3105..69e3573 100644 (file)
        "passwordpolicies-policy-passwordcannotmatchblacklist": "Le contrasigno non pote corresponder a contrasignos in le lista nigre",
        "passwordpolicies-policy-maximalpasswordlength": "Le contrasigno debe continer minus de $1 {{PLURAL:$1|character|characteres}}",
        "passwordpolicies-policy-passwordcannotbepopular": "Le contrasigno non pote esser {{PLURAL:$1|le contrasigno le plus popular|in le lista de $1 contrasignos popular}}",
-       "easydeflate-invaliddeflate": "Le contento fornite non es correctemente comprimite"
+       "easydeflate-invaliddeflate": "Le contento fornite non es correctemente comprimite",
+       "unprotected-js": "Pro motivos de securitate, non es possibile cargar codice JavaScript de paginas non protegite. Crea JavaScript solmente in le spatio de nomines \"MediaWiki:\" o como un subpagina de usator."
 }
index dc70102..fd95f5e 100644 (file)
        "previewnote": "<strong>Atencez ke ico esas nur prevido.</strong> Ol ne registragesis ankore!",
        "continue-editing": "Irez a la redakto-areo",
        "session_fail_preview": "'''Pardonez! Ni ne povis traktar vua redakto pro perdo di sesiono donaji.'''\nVoluntez probar itere.\nSe ol ankore nefuncionas, probez [[Special:UserLogout|ekirar]] e pose enirar.",
+       "session_fail_preview_html": "Pardonez! Ni ne povis recevar vua redakto pro perdajo di dati.\n\n<em>Pro ke la wiki {{SITENAME}} permisas uzar bruta HTML, la previdado celesas por preventar ataki uzante JavaScript.</em>\n\n<strong>Se la probo di redakto esas legitima, voluntez itere sendar ol.</strong>\nSe duros ne funcionar, facez [[Special:UserLogout|logout]] ed itere facez login. Videz se vua retonavigilo (browser) permisas uzar 'cookies' de ica retosituo.",
        "editing": "Vu redaktas $1",
        "creating": "Vu kreas $1",
        "editingsection": "Vu redaktas $1 (seciono)",
        "tooltip-ca-nstab-category": "Videz la pagino dil kategorio",
        "tooltip-minoredit": "Markizar ica redaktajo kom mikra",
        "tooltip-save": "Registrigez chanji",
+       "tooltip-publish": "Publikigar vua modifikuri",
        "tooltip-preview": "Previdar vua chanji. Voluntez uzor ico ante registragar!",
        "tooltip-diff": "Montrez la chanji a la texto quin vu facis",
        "tooltip-compareselectedversions": "Vidar la diferaji inter la du selektita versioni di ca pagino.",
        "logentry-delete-delete": "$1 {{GENDER:$2|efacis}} la pagino $3",
        "logentry-delete-delete_redir": "$1 {{GENDER:$2|efacis}} la ridirektilo $3, riskribante ol",
        "logentry-delete-restore": "$1 {{GENDER:$2|restauris}} la pagino $3 ($4)",
+       "restore-count-revisions": "{{PLURAL:$1|1 revizuro|$1 revizuri}}",
        "logentry-delete-revision": "$1 {{GENDER:$2|modifikis}} videbleso di {{PLURAL:$5|la revizo|$5 revizi}} di la pagino $3: $4",
        "revdelete-content-hid": "celita kontenajo",
        "logentry-block-block": "$1 {{GENDER:$2|blokusis}} {{GENDER:$4|$3}} dum $5 $6",
index be08d90..0954efa 100644 (file)
        "passwordpolicies-policy-passwordcannotmatchusername": "La password non può essere uguale al nome utente",
        "passwordpolicies-policy-passwordcannotmatchblacklist": "La password non può corrispondere a password specificate nell'elenco delle password proibite",
        "passwordpolicies-policy-maximalpasswordlength": "La password deve essere lunga meno di $1 {{PLURAL:$1|carattere|caratteri}}",
-       "passwordpolicies-policy-passwordcannotbepopular": "La password non può essere {{PLURAL:$1|la password più popolare|nell'elenco delle $1 password più popolari}}"
+       "passwordpolicies-policy-passwordcannotbepopular": "La password non può essere {{PLURAL:$1|la password più popolare|nell'elenco delle $1 password più popolari}}",
+       "unprotected-js": "Per motivi di sicurezza, non è possibile caricare JavaScript da pagine non protette. Crea javascript solo nel namespace MediaWiki o come sottopagina Utente"
 }
index fde7ecf..26e7969 100644 (file)
@@ -6,6 +6,7 @@
                        "Sawmw"
                ]
        },
+       "tog-showtoolbar": "ၮဲဖှ်ေ ဆ်ုအင်းတါင်ခြီခြာ့တိုင်",
        "underline-always": "ကိုဲၜၠင်",
        "underline-never": "ၮင်းဖိုင့်အေႋ",
        "editfont-serif": "ခေါဟ်ထိင်ႋပါ့ဖောင့်",
@@ -86,6 +87,7 @@
        "noindex-category": "ဝီႋဖၠုံးသံင့်လေဝ်လိက်ဖၠုံးခၞါလ်ုအ်ှ လိက်မေံၜၠါ်လ်ုဖး",
        "broken-file-category": "ခါၯာၯံင် ဖိုင်ႋလင့်အှ်သယ်လ်ုဖး လိက်မေံၜၠါ်",
        "about": "အ်ုကျံင်",
+       "article": "ပ်ုယုံ့ခေါဟ်တင်လိက်မေံၜၠာ်",
        "newwindow": "(ဝင်းဒိုးသင့်လ်ုၮါင်းဝယ် မ်ုပုဂ်ထုင်း)",
        "cancel": "မာလှ်ေအေး",
        "moredotdotdot": "ၰိုဲမေံၜၠာ်...",
        "jumpto": "မ်ုၯယ့်ထါင်ယိုဝ်",
        "jumptonavigation": "ပ်ုယုံ့",
        "jumptosearch": "အင်းၯူ့",
+       "pool-errorunknown": "လ်ုသီးယာ့ ဆ်ုမးၜး",
+       "poolcounter-usage-error": "ဆ်ုသုံႋဆာႋအ်ုမး: $1",
        "aboutsite": "အ်ုကျံင် {{SITENAME}}",
        "aboutpage": "Project:အ်ုၯံင်အ်ုကျံင်",
        "copyrightpage": "{{ns:project}}: ပ္တုံဆာပၞံင့်",
        "showtoc": "ဍုဂ်ၮဲ",
        "hidetoc": "အ်ှသူး",
        "collapsible-collapse": "မ်ုပေဝ်ႋက္ဍာ",
+       "collapsible-expand": "လဝ်လဲာ",
        "confirmable-confirm": "{{GENDER:$1|ၮ်ု}} ထီ့ဆာႋဝး?",
        "confirmable-yes": "မွာဲ",
        "confirmable-no": "လ်ုမာၜး",
        "nosuchspecialpage": "ဗေ့ယိုဝ်သိုဝ် လိက်မေံၜၠါ်ခေါဟ် လ်ုအှ်ၜး",
        "nospecialpagetext": "<strong>ၮ်ုယိုဝ် လ်ုထီ့ဆာ့ၜး လိက်မေံခေါဟ်လ်ုၮါင်းအိုဝ် အင်းကိင်ဖှ်ေထဆေဝ်ႋလှ်။</strong>\n\nထီ့ဆာ့ လိက်မေံခေါဟ် စ်ုရင့်သယ် [[Special:SpecialPages|{{int:specialpages}}]] ခဝ့် ၮ်ုဍးၮေဝ်လှ်။",
        "error": "ဆ်ုမး",
+       "databaseerror-error": "အ်ုမး: $1",
        "badtitle": "လိက်မေံဆ်ုနာႋ",
        "badtitletext": "အင်းကိင်ႋလင်ထ လိက်မေံၜၠါ် ခေါဟ်တင်ၮ်ှ လ်ုဖံင်ပၞံင့် (လ်ု) လ်ုအှ်မိင်ၜး (လ်ု) ၰာၰံင်ဘာႋသာ့လ်ုဖး(inter-language or inter-wiki title)အိုဝ် ထိုဝ်ၜုဂ်လင့်မးဝေ့လှ်။",
        "viewsource": "မ်ုယောဝ်ႋအ်ုဝီခၞာ",
index fbbe1db..22ed516 100644 (file)
        "passwordpolicies-policy-passwordcannotmatchblacklist": "비밀번호는 블랙리스트에 있는 비밀번호와 일치할 수 없습니다",
        "passwordpolicies-policy-maximalpasswordlength": "비밀번호는 적어도 $1 {{PLURAL:$1|자}} 미만이어야 합니다",
        "passwordpolicies-policy-passwordcannotbepopular": "비밀번호는 {{PLURAL:$1|저명한 비밀번호가 될|$1개의 저명한 비밀번호에 속할}} 수 없습니다",
-       "easydeflate-invaliddeflate": "주어진 컨텐츠가 적절히 압축되지 않았습니다"
+       "easydeflate-invaliddeflate": "주어진 컨텐츠가 적절히 압축되지 않았습니다",
+       "unprotected-js": "보안 상의 이유로 자바스크립트는 보호되지 않은 문서로부터 불러올 수 없습니다. 미디어위키: 이름공간이나 사용자의 하위 문서에서만 자바스크립트를 만들어 주십시오."
 }
index f7db609..6d46166 100644 (file)
        "imagetypemismatch": "De nuje bestandjsextensie is neet gliek aan 't bestandjstype.",
        "imageinvalidfilename": "De nuje bestandsnaam is ongeldig",
        "fix-double-redirects": "Alle doorverwiezinge biewerke die verwieze nao de originele paginanaam",
-       "move-leave-redirect": "'n Doorverwiezing achterlaote",
+       "move-leave-redirect": "Laot 'ne redirek staon",
        "protectedpagemovewarning": "'''Waorsjoewing: Dees pazjena is besjermp zoedat ze allein doer gebroekers mit administratorrechte kint weure verplaats.'''\nDe lèste logbookregel steit hierónger:",
        "semiprotectedpagemovewarning": "<strong>Let op:</strong> Dees pazjena is beveilig en kin allein door geregistreerde gebroekers verplaats waere.\nDe lèste logbookregel steit hiejónger:",
        "move-over-sharedrepo": "[[:$1]] besteit al in 'ne gedeildje mediadatabank.\nE bestandj hiehaer verplaatse euversjrief 't gedeildj bestandj.",
index 1676128..a25a938 100644 (file)
        "passwordpolicies-policy-passwordcannotmatchblacklist": "Лозинката не смее да биде од оние на црниот список",
        "passwordpolicies-policy-maximalpasswordlength": "Лозинката не треба да има повеќе од $1 {{PLURAL:$1|знак|знаци}}",
        "passwordpolicies-policy-passwordcannotbepopular": "Лозинката не треба да биде {{PLURAL:$1|најзастапената|од списокот на $1 најзастапени лозинки}}",
-       "easydeflate-invaliddeflate": "Содржината не е соодветно прочистена"
+       "easydeflate-invaliddeflate": "Содржината не е соодветно прочистена",
+       "unprotected-js": "JavaScript не може да се вчита од незаштитени страници од безбедносни причини. Создавајте JavaScript само во именскиот простор МедијаВики: или како корисничка потстраница"
 }
index e1623d9..0973b53 100644 (file)
        "badarticleerror": "Handlingen kan ikke utføres på denne siden.",
        "cannotdelete": "Siden eller fila «$1» kunne ikke slettes.\nDen kan ha blitt slettet av noen andre.",
        "cannotdelete-title": "Kan ikke slette siden «$1»",
+       "delete-scheduled": "Siden «$1» står i kø for å bli slettet.\nHa tålmodighet.",
        "delete-hook-aborted": "Sletting avbrutt av en funksjon.\nDen ga ingen forklaring.",
        "no-null-revision": "Det ble ikke laget en null-endring av side \"$1\"",
        "badtitle": "Ugyldig tittel",
        "prefixindex": "Alle sider med prefiks",
        "prefixindex-namespace": "All sider med prefiks ($1 navnerom)",
        "prefixindex-submit": "Vis",
-       "prefixindex-strip": "Fjern prefiks fra listen",
+       "prefixindex-strip": "Skjul prefikset i resultatene",
        "shortpages": "Korte sider",
        "longpages": "Lange sider",
        "deadendpages": "Blindveisider",
        "movepage-moved": "'''«$1» ble flyttet til «$2»'''",
        "movepage-moved-redirect": "En omdirigering har blitt opprettet.",
        "movepage-moved-noredirect": "Det ble ikke opprettet en omdirigering.",
+       "movepage-delete-first": "Målsiden har for mange revisjoner til å slettes som del av en sideflytting. Slett siden manuelt først og prøv så igjen.",
        "articleexists": "En side med det navnet finnes allerede eller det valgte navn er ugyldig.\nVelg et annet navn.",
        "cantmove-titleprotected": "Du kan ikke flytte en side til dette navnet, fordi den nye tittelen er beskyttet fra opprettelse.",
        "movetalk": "Flytt tilhørende diskusjonsside.",
        "pageinfo-category-files": "Antall filer",
        "pageinfo-user-id": "Bruker-ID",
        "pageinfo-file-hash": "Hash-verdi",
+       "pageinfo-view-protect-log": "Vis beskyttelsesloggen for denne siden.",
        "markaspatrolleddiff": "Merk som patruljert",
        "markaspatrolledtext": "Merk denne siden som patruljert",
        "markaspatrolledtext-file": "Merk denne filversjonen som patruljert",
        "passwordpolicies-policy-passwordcannotmatchblacklist": "Passordet kan ikke matche spesifikt svartelistede passord",
        "passwordpolicies-policy-maximalpasswordlength": "Passordet kan maksimalt være på $1 {{PLURAL:$1|tegn}}",
        "passwordpolicies-policy-passwordcannotbepopular": "Passordet kan ikke være {{PLURAL:$1|det populære passordet|i lista over $1 populære passord}}",
-       "easydeflate-invaliddeflate": "Det gitte innholdet er ikke riktig komprimert"
+       "easydeflate-invaliddeflate": "Det gitte innholdet er ikke riktig komprimert",
+       "unprotected-js": "Av sikkerhetsårsaker kan ikke JavaScript lastes fra ubeskyttede sider. Bare skap JavaScript i MediaWiki-navnerommet eller som en brukerunderside"
 }
index f5f54da..0d60284 100644 (file)
        "badarticleerror": "Deze handeling kan niet op deze pagina worden uitgevoerd.",
        "cannotdelete": "De pagina of het bestand \"$1\" kon niet verwijderd worden.\nMogelijk is deze al door iemand anders verwijderd.",
        "cannotdelete-title": "Pagina \"$1\" kan niet verwijderd worden",
+       "delete-scheduled": "De pagina \"$1\" staat voor verwijdering ingepland.\nEen ogenblik geduld alstublieft.",
        "delete-hook-aborted": "Het verwijderen is afgebroken door een hook.\nEr is geen toelichting beschikbaar.",
        "no-null-revision": "Het was niet mogelijk een lege nieuwe versie te maken voor de pagina \"$1\"",
        "badtitle": "Ongeldige paginanaam",
        "passwordpolicies-policy-passwordcannotmatchusername": "Wachtwoord mag niet hetzelfde zijn als de gebruikersnaam",
        "passwordpolicies-policy-passwordcannotmatchblacklist": "Wachtwoord mag niet overeenkomen met wachtwoorden op de zwarte lijst",
        "passwordpolicies-policy-maximalpasswordlength": "Wachtwoord moet minder dan $1 {{PLURAL:$1|teken|tekens}} bevatten",
-       "passwordpolicies-policy-passwordcannotbepopular": "Watchwoord mag niet {{PLURAL:$1|overeenkomen met het bekende wachtwoord|voorkomen in de lijst met $1 bekende wachtwoorden}}"
+       "passwordpolicies-policy-passwordcannotbepopular": "Watchwoord mag niet {{PLURAL:$1|overeenkomen met het bekende wachtwoord|voorkomen in de lijst met $1 bekende wachtwoorden}}",
+       "unprotected-js": "Vanwege veiligheidsredenen kan er geen JavaScript geladen worden vanaf onbeveiligde pagina's. Gelieve alleen JavaScript pagina's aan te maken in de MediaWiki: naamruimte of als een subpagina van een gebruikerspagina."
 }
index 91a00b2..1429f6c 100644 (file)
        "passwordpolicies-policy-passwordcannotmatchblacklist": "A senha não pode corresponder senhas especificamente na lista negra",
        "passwordpolicies-policy-maximalpasswordlength": "A senha deve ser menor que $1 {{PLURAL:$1|caráter|caracteres}}",
        "passwordpolicies-policy-passwordcannotbepopular": "A senha não pode {{PLURAL:$1|ser a mais popular|estar na lista das $1 palavras-passe mais populares}}",
-       "easydeflate-invaliddeflate": "O conteúdo fornecido não está devidamente comprimido"
+       "easydeflate-invaliddeflate": "O conteúdo fornecido não está devidamente comprimido",
+       "unprotected-js": "Por razões de segurança o JavaScript não pode ser carregado de páginas desprotegidas. Por favor, crie apenas javascript no MediaWiki: namespace ou como uma subpágina do usuário"
 }
index f3ee41d..477a85a 100644 (file)
        "and": "&#32;e",
        "faq": "Perguntas frequentes",
        "actions": "Ações",
-       "namespaces": "Domínios",
+       "namespaces": "Espaços nominais",
        "variants": "Variantes",
        "navigation-heading": "Menu de navegação",
        "errorpagetitle": "Erro",
        "email-allow-new-users-label": "Permitir mensagens de correio de utilizadores novos",
        "email-blacklist-label": "Proibir estes utilizadores de me enviarem correio eletrónico:",
        "prefs-searchoptions": "Pesquisa",
-       "prefs-namespaces": "Domínios",
+       "prefs-namespaces": "Espaços nominais",
        "default": "padrão",
        "prefs-files": "Ficheiros",
        "prefs-custom-css": "CSS personalizado",
        "prefixindex": "Todas as páginas iniciadas por",
        "prefixindex-namespace": "Todas as páginas com prefixo (espaço nominal $1)",
        "prefixindex-submit": "Mostrar",
-       "prefixindex-strip": "Remover prefixo",
+       "prefixindex-strip": "Esconder o prefixo nos resultados",
        "shortpages": "Páginas curtas",
        "longpages": "Páginas longas",
        "deadendpages": "Páginas sem saída",
        "specialpages-group-pagetools": "Ferramentas de página",
        "specialpages-group-wiki": "Dados e ferramentas",
        "specialpages-group-redirects": "Páginas especiais de redirecionamento",
-       "specialpages-group-spam": "Ferramentas anti-spam",
+       "specialpages-group-spam": "Ferramentas antispam",
        "specialpages-group-developer": "Ferramentas de desenvolvimento",
        "blankpage": "Página em branco",
        "intentionallyblankpage": "Esta página foi intencionalmente deixada em branco",
        "passwordpolicies-policy-passwordcannotmatchblacklist": "A palavra-passe não pode corresponder às especificamente bloqueadas pela lista negra",
        "passwordpolicies-policy-maximalpasswordlength": "A palavra-passe tem de ter menos de $1 {{PLURAL:$1|carácter|caracteres}}",
        "passwordpolicies-policy-passwordcannotbepopular": "A palavra-passe não pode {{PLURAL:$1|ser a mais popular|estar na lista das $1 palavras-passe mais populares}}",
-       "easydeflate-invaliddeflate": "O conteúdo fornecido não está devidamente comprimido"
+       "easydeflate-invaliddeflate": "O conteúdo fornecido não está devidamente comprimido",
+       "unprotected-js": "Por motivos de segurança o JavaScript de páginas desprotegidas não pode ser carregado. Crie javascript só no espaço nominal/domínio MediaWiki: ou numa subpágina do utilizador"
 }
index cbee32b..b6764e3 100644 (file)
        "tog-extendwatchlist": "[[Special:Preferences]], tab 'Watchlist'. Offers user to show all applicable changes in watchlist (by default only the last change to a page on the watchlist is shown). {{Gender}}",
        "tog-usenewrc": "{{Gender}}\nUsed as label for the checkbox in [[Special:Preferences]], tab \"Recent changes\".\n\nOffers user to use alternative representation of [[Special:RecentChanges]] and watchlist.",
        "tog-numberheadings": "[[Special:Preferences]], tab 'Misc'. Offers numbered headings on content pages to user. {{Gender}}",
-       "tog-showtoolbar": "{{Gender}}\n[[Special:Preferences]], tab 'Edit'. Offers user to show edit toolbar in page edit screen.\n\nThis is the toolbar: [[Image:Toolbar.png]]",
        "tog-editondblclick": "{{Gender}}\n[[Special:Preferences]], tab 'Edit'. Offers user to open edit page on double click.",
        "tog-editsectiononrightclick": "{{Gender}}\n[[Special:Preferences]], tab 'Edit'. Offers user to edit a section by clicking on a section title.",
        "tog-watchcreations": "[[Special:Preferences]], tab 'Watchlist'. Offers user to add created pages to watchlist. {{Gender}}",
        "subject-preview": "Used as label for preview of the section title when adding a new section on a talk page.\n\nShould match {{msg-mw|subject}}.\n\nSee also:\n* {{msg-mw|Summary-preview}}\n\n{{Identical|Subject}}",
        "previewerrortext": "When a user has the editing preference LivePreview enabled, clicked the Preview or Show Changes button in the edit page and the action did not succeed.",
        "blockedtitle": "Used as title displayed for blocked users. The corresponding message body is one of the following messages:\n* {{msg-mw|Blockedtext|notext=1}}\n* {{msg-mw|Autoblockedtext|notext=1}}\n* {{msg-mw|Systemblockedtext}}",
+       "blocked-email-user": "Text displayed to partially blocked users that are blocked from sending email.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - the blocking sysop (with a link to his/her userpage)\n* $2 - the reason for the block\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the blocking sysop's username (plain text, without the link)\n* $5 - the unique numeric identifier of the applied autoblock\n* $6 - the expiry of the block\n* $7 - the intended target of the block (what the blocking user specified in the blocking form)\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Autoblockedtext}}\n* {{msg-mw|Systemblockedtext}}",
+       "blockedtext-partial": "Text displayed to partially blocked users.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - the blocking sysop (with a link to his/her userpage)\n* $2 - the reason for the block\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the blocking sysop's username (plain text, without the link)\n* $5 - the unique numeric identifier of the applied autoblock\n* $6 - the expiry of the block\n* $7 - the intended target of the block (what the blocking user specified in the blocking form)\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Autoblockedtext}}\n* {{msg-mw|Systemblockedtext}}",
        "blockedtext": "Text displayed to blocked users.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - the blocking sysop (with a link to his/her userpage)\n* $2 - the reason for the block\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the blocking sysop's username (plain text, without the link)\n* $5 - the unique numeric identifier of the applied autoblock\n* $6 - the expiry of the block\n* $7 - the intended target of the block (what the blocking user specified in the blocking form)\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Autoblockedtext}}\n* {{msg-mw|Systemblockedtext}}",
        "autoblockedtext": "Text displayed to automatically blocked users.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - the blocking sysop (with a link to his/her userpage)\n* $2 - the reason for the block (in case of autoblocks: {{msg-mw|autoblocker}})\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the blocking sysop's username (plain text, without the link). Use it for GENDER.\n* $5 - the unique numeric identifier of the applied autoblock\n* $6 - the expiry of the block\n* $7 - the intended target of the block (what the blocking user specified in the blocking form)\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Blockedtext}}\n* {{msg-mw|Systemblockedtext}}",
        "systemblockedtext": "Text displayed to requests blocked by MediaWiki configuration.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - (Unused) A dummy user attributed as the blocker, possibly as a link to a user page.\n* $2 - the reason for the block\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the dummy blocking user's username (plain text, without the link).\n* $5 - A short string indicating the type of system block.\n* $6 - the expiry of the block\n* $7 - the intended target of the block\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Blockedtext}}\n* {{msg-mw|Autoblockedtext}}",
        "ipb-disableusertalk": "{{doc-singularthey}}\nUsed as label for checkbox in [[Special:Block]].\n\nSee also:\n* {{msg-mw|ipbemailban}}\n* {{msg-mw|ipbenableautoblock}}\n* {{msg-mw|ipbhidename}}\n* {{msg-mw|ipbwatchuser}}\n* {{msg-mw|ipb-hardblock}}",
        "ipb-change-block": "Confirmation checkbox required for blocks that would override an earlier block. Appears together with {{msg-mw|ipb-needreblock}}.",
        "ipb-confirm": "Used as hidden field in the form on [[Special:Block]].",
+       "ipb-sitewide": "A type of block the user can select from on [[Special:Block]].",
+       "ipb-partial": "A type of block the user can select from on [[Special:Block]].",
+       "ipb-type-label": "The label of the type of editing restriction the admin would like to impose on [[Special:Block]].",
+       "ipb-pages-label": "The label for a autocomplete text field to specify pages to block a user from editing on [[Special:Block]].",
        "badipaddress": "An error message shown when one entered an invalid IP address in blocking page.",
        "blockipsuccesssub": "Used as page title in [[Special:Block]].\n\nThis message is the subject for the following message:\n* {{msg-mw|Blockipsuccesstext}}",
        "blockipsuccesstext": "Used in [[Special:Block]].\nThe title (subject) for this message is {{msg-mw|Blockipsuccesssub}}.\n\nParameters:\n* $1 - username, can be used for GENDER",
        "createaccountblock": "Part of the log entry of user block in [[Special:BlockList]].\n\nSee also:\n* {{msg-mw|Block-log-flags-nocreate}}\n{{Related|Blocklist}}",
        "emailblock": "Part of the log entry of user block in [[Special:BlockList]].\n{{Related|Blocklist}}\n{{Identical|E-mail blocked}}",
        "blocklist-nousertalk": "Used in [[Special:IPBlockList]] when \"Allow this user to edit own talk page while blocked\" option hasn't been flagged.\n\nSee also {{msg-mw|Block-log-flags-nousertalk}}.\n\nPart of the log entry of user block in [[Special:BlockList]].\n\n{{Related|Blocklist}}",
+       "blocklist-editing-sitewide": "Used in [[Special:IPBlockList]] when a block is a sitewide block.",
+       "blocklist-editing": "Used in [[Special:IPBlockList]] when a block is not a sitewide block.",
        "ipblocklist-empty": "Used in [[Special:BlockList]], if the target is not specified.\n\nSee also:\n* {{msg-mw|Ipblocklist-no-results}}",
        "ipblocklist-no-results": "Used in [[Special:BlockList]], if the target is specified.\n\nSee also:\n* {{msg-mw|Ipblocklist-empty}}",
        "blocklink": "Display name for a link that, when selected, leads to a form where a user can be blocked. Used in page history and recent changes pages. Example: \"''UserName (Talk | contribs | '''block''')''\".\n\nUsed as link title in [[Special:Contributions]] and in [[Special:DeletedContributions]].\n\nSee also:\n* {{msg-mw|Sp-contributions-talk}}\n* {{msg-mw|Change-blocklink}}\n* {{msg-mw|Unblocklink}}\n* {{msg-mw|Sp-contributions-blocklog}}\n* {{msg-mw|Sp-contributions-uploads}}\n* {{msg-mw|Sp-contributions-logs}}\n* {{msg-mw|Sp-contributions-deleted}}\n* {{msg-mw|Sp-contributions-userrights}}\n{{Identical|Block}}",
        "logentry-block-block": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n\nCf. {{msg-mw|Blocklogentry}}",
        "logentry-block-unblock": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n\nCf. {{msg-mw|Unblocklogentry}}",
        "logentry-block-reblock": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n\nCf. {{msg-mw|Reblock-logentry}}",
+       "logentry-partialblock-block": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n* $7 - list of pages separated by a comma\n* $8 - total number of pages\n\nCf. {{msg-mw|Blocklogentry}}",
+       "logentry-partialblock-reblock": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n* $7 - list of pages separated by a comma\n* $8 - total number of pages\n\nCf. {{msg-mw|Reblock-logentry}}",
+       "logentry-non-editing-block-block": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n\nCf. {{msg-mw|Blocklogentry}}",
+       "logentry-non-editing-block-reblock": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n\nCf. {{msg-mw|Reblock-logentry}}",
        "logentry-suppress-block": "{{Logentry}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string",
        "logentry-suppress-reblock": "{{Logentry}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string",
        "logentry-import-upload": "{{Logentry|[[Special:Log/import]]}}",
        "mw-widgets-titleinput-description-redirect": "Description label for a redirect in the title input widget.",
        "mw-widgets-categoryselector-add-category-placeholder": "Placeholder displayed in the category selector widget after the capsules of already added categories.",
        "mw-widgets-usersmultiselect-placeholder": "Placeholder displayed in the input field, where new usernames are entered",
+       "mw-widgets-titlesmultiselect-placeholder": "Placeholder displayed in the input field, where new titles are entered",
        "date-range-from": "Label for an input field that specifies the start date of a date range filter.",
        "date-range-to": "Label for an input field that specifies the end date of a date range filter.",
        "sessionmanager-tie": "Used as an error message when multiple session sources are tied in priority.\n\nParameters:\n* $1 - List of dession type descriptions, from messages like {{msg-mw|sessionprovider-mediawiki-session-cookiesessionprovider}}.",
index 0155b22..5543e0d 100644 (file)
        "prefixindex": "Указатель по началу названий страниц",
        "prefixindex-namespace": "Указатель по началу страниц (пространство имён «{{ns:$1}}»)",
        "prefixindex-submit": "Показать",
-       "prefixindex-strip": "СкÑ\80Ñ\8bÑ\82Ñ\8c Ð¿Ñ\80еÑ\84икÑ\81 Ð² Ñ\81пиÑ\81ке Ñ\80езÑ\83лÑ\8cÑ\82аÑ\82ов",
+       "prefixindex-strip": "СкÑ\80Ñ\8bÑ\82Ñ\8c Ð¿Ñ\80еÑ\84икÑ\81 Ð² Ñ\80езÑ\83лÑ\8cÑ\82аÑ\82аÑ\85",
        "shortpages": "Короткие страницы",
        "longpages": "Длинные страницы",
        "deadendpages": "Тупиковые страницы",
        "passwordpolicies-policy-passwordcannotmatchblacklist": "Пароль не может совпадать ни с одним паролем, внесённым в чёрный список",
        "passwordpolicies-policy-maximalpasswordlength": "Пароль должен быть короче $1 {{PLURAL:$1|символа|символов}}",
        "passwordpolicies-policy-passwordcannotbepopular": "Пароль не может соответствовать {{PLURAL:$1|самому часто используемому паролю|какому-либо из $1 самых часто используемых паролей}}",
-       "easydeflate-invaliddeflate": "Предоставленное содержимое не спущено надлежащим образом"
+       "easydeflate-invaliddeflate": "Предоставленное содержимое не спущено надлежащим образом",
+       "unprotected-js": "По соображениям безопасности JavaScript нельзя загружать с незащищенных страниц. Пожалуйста, создавайте скрипты только в пространстве имён MediaWiki: или как подстраницы участника."
 }
index 4e32140..51b5464 100644 (file)
        "passwordpolicies-policy-passwordcannotmatchblacklist": "Geslo se ne sme ujemati s posebej prepovedanimi gesli",
        "passwordpolicies-policy-maximalpasswordlength": "Geslo ne sme biti daljše od $1 {{PLURAL:$1|znak|znaka|znake|znakov}}",
        "passwordpolicies-policy-passwordcannotbepopular": "Geslo ne sme biti {{PLURAL:$1|1=popularno geslo|na seznamu $1 popularnih gesel}}",
-       "easydeflate-invaliddeflate": "Dana vsebina ni pravilno stisnjena"
+       "easydeflate-invaliddeflate": "Dana vsebina ni pravilno stisnjena",
+       "unprotected-js": "Iz varnostnih razlogov JavaScripta ni možno naložiti z nezaščitenih strani. Prosimo, da JavaScript ustvarite samo v imenskem prostoru MediaWiki ali kot uporabniško podstran."
 }
index f1c8230..0f654c5 100644 (file)
        "createacct-another-username-ph": "Унесите корисничко име",
        "yourpassword": "Лозинка:",
        "userlogin-yourpassword": "Лозинка",
-       "userlogin-yourpassword-ph": "Унесите своју лозинку",
+       "userlogin-yourpassword-ph": "Унесите лозинку",
        "createacct-yourpassword-ph": "Унесите лозинку",
        "yourpasswordagain": "Поново унеси лозинку:",
        "createacct-yourpasswordagain": "Потврдите лозинку",
        "resetpass-validity-soft": "Ваша лозинка није важећа: $1\n\nИзаберите нову одмах или кликните на „{{int:authprovider-resetpass-skip-label}}“ да је промените касније.",
        "passwordreset": "Ресетовање лозинке",
        "passwordreset-text-one": "Попуните овај образац да бисте добили привремену лозинку на имејл.",
-       "passwordreset-text-many": "{{PLURAL:$1|Ð\98Ñ\81пÑ\83ниÑ\82е Ñ\98едно Ð¾Ð´ Ð¿Ð¾Ñ\99а ÐºÐ°ÐºÐ¾ Ð±Ð¸Ñ\81Ñ\82е Ð´Ð¾Ð±Ð¸Ð»Ð¸ Ð¿Ñ\80ивÑ\80еменÑ\83 Ð»Ð¾Ð·Ð¸Ð½ÐºÑ\83 Ð½Ð° Ð¸Ð¼ÐµÑ\98л.}}",
+       "passwordreset-text-many": "{{PLURAL:$1|Ð\98Ñ\81пÑ\83ниÑ\82е Ñ\98едно Ð¾Ð´ Ð¿Ð¾Ñ\99а ÐºÐ°ÐºÐ¾ Ð±Ð¸Ñ\81Ñ\82е Ð´Ð¾Ð±Ð¸Ð»Ð¸ Ð¿Ñ\80ивÑ\80еменÑ\83 Ð»Ð¾Ð·Ð¸Ð½ÐºÑ\83 Ð¿Ñ\83Ñ\82ем Ð¸Ð¼ÐµÑ\98ла.}}",
        "passwordreset-disabled": "Ресетовање лозинке је онемогућено на овом викију.",
        "passwordreset-emaildisabled": "Имејл је онемогућен на овом викију.",
        "passwordreset-username": "Корисничко име:",
index ed82a7f..111364c 100644 (file)
        "badarticleerror": "Den åtgärden kan inte utföras på den här sidan.",
        "cannotdelete": "Sidan eller filen \"$1\" kunde inte raderas.\nDen kanske redan har raderats av någon annan.",
        "cannotdelete-title": "Sidan \"$1\" kan inte raderas",
+       "delete-scheduled": "Sidan \"$1\" är schemalagd för radering.\nHa tålamod.",
        "delete-hook-aborted": "Borttagning avbruten av hook.\nDen gav ingen förklaring.",
        "no-null-revision": "Kunde inte skapa ny tom version för sidan \"$1\"",
        "badtitle": "Felaktig titel",
        "prefixindex": "Alla sidor med prefix",
        "prefixindex-namespace": "Alla sidor med prefix ($1 namnrymder)",
        "prefixindex-submit": "Visa",
-       "prefixindex-strip": "Avlägsna prefix i lista",
+       "prefixindex-strip": "Dölj prefixet i resultaten",
        "shortpages": "Korta sidor",
        "longpages": "Långa sidor",
        "deadendpages": "Sidor utan länkar",
        "movepage-moved": "'''\"$1\" har flyttats till \"$2\"'''",
        "movepage-moved-redirect": "En omdirigering har skapats.",
        "movepage-moved-noredirect": "Skapandet av en omdirigering avbröts.",
+       "movepage-delete-first": "Målsidan har för många revisioner att radera som del av sidflyttningen. Radera först sidan manuellt och försök sedan igen.",
        "articleexists": "Antingen existerar redan en sida med det namnet, eller så har du valt ett namn som inte är tillåtet.\nVälj något annat namn istället.",
        "cantmove-titleprotected": "Du kan inte flytta sidan till den titeln, eftersom den nya titeln har skyddats från att skapas.",
        "movetalk": "Flytta tillhörande diskussionssida",
        "passwordpolicies-policy-passwordcannotmatchblacklist": "Lösenordet kan inte matcha specifikt svartlistade lösenord",
        "passwordpolicies-policy-maximalpasswordlength": "Lösenordet måste vara högst $1 {{PLURAL:$1|tecken}} långt",
        "passwordpolicies-policy-passwordcannotbepopular": "Lösenordet kan inte vara {{PLURAL:$1|det populäraste lösenordet|i listan över de $1 populäraste lösenorden}}",
-       "easydeflate-invaliddeflate": "Innehåll som tillhandahålls är inte helt komprimerat"
+       "easydeflate-invaliddeflate": "Innehåll som tillhandahålls är inte helt komprimerat",
+       "unprotected-js": "Av säkerhetsskäl kan inte JavaScript läsas in från oskyddade sidor. Skapa endast JavaScript i namnrymden MediaWiki: eller som en användarundersida."
 }
index 17e1956..8b85f95 100644 (file)
@@ -65,7 +65,7 @@
        "tog-watchlisthideminor": "ซ่อนการแก้ไขเล็กน้อยจากรายการเฝ้าดู",
        "tog-watchlisthideliu": "ซ่อนการแก้ไขโดยผู้ใช้ล็อกอินจากรายการเฝ้าดู",
        "tog-watchlistreloadautomatically": "โหลดรายการเฝ้าดูใหม่อัตโนมัติเมื่อใดที่มีการเปลี่ยนตัวกรอง (ต้องการจาวาสคริปต์)",
-       "tog-watchlistunwatchlinks": "à¹\80à¸\9eิà¹\88มลิà¸\87à¸\81à¹\8cà¹\80ลิà¸\81à¹\80à¸\9dà¹\89าà¸\94ู/à¹\80à¸\9dà¹\89าà¸\94ูà¹\82à¸\94ยà¸\95รà¸\87à¹\80à¸\82à¹\89าหà¸\99à¹\88วยรายà¸\81ารà¹\80à¸\9dà¹\89าà¸\94ู (ต้องการจาวาสคริปต์เพื่อเปิดปิดการใช้งาน)",
+       "tog-watchlistunwatchlinks": "à¹\80à¸\9eิà¹\88มà¹\80à¸\84รืà¹\88อà¸\87หมายà¹\80ลิà¸\81à¹\80à¸\9dà¹\89าà¸\94ู/à¹\80à¸\9dà¹\89าà¸\94ูà¹\82à¸\94ยà¸\95รà¸\87 ({{int:Watchlist-unwatch}}/{{int:Watchlist-unwatch-undo}}) à¸¥à¸\87à¹\83à¸\99หà¸\99à¹\89าà¸\97ีà¹\88à¹\80à¸\9dà¹\89าà¸\94ูà¸\97ีà¹\88มีà¸\81ารà¹\80à¸\9bลีà¹\88ยà¸\99à¹\81à¸\9bลà¸\87 (ต้องการจาวาสคริปต์เพื่อเปิดปิดการใช้งาน)",
        "tog-watchlisthideanons": "ซ่อนการแก้ไขโดยผู้ใช้นิรนามจากรายการเฝ้าดู",
        "tog-watchlisthidepatrolled": "ซ่อนการแก้ไขที่ตรวจสอบแล้วจากรายการเฝ้าดู",
        "tog-watchlisthidecategorization": "ซ่อนการจัดหมวดหมู่หน้า",
        "badarticleerror": "ไม่สามารถดำเนินปฏิบัติการนี้ในหน้านี้",
        "cannotdelete": "ไม่สามารถลบหน้าหรือไฟล์ \"$1\" \nผู้อื่นอาจลบไปแล้ว",
        "cannotdelete-title": "ไม่สามารถลบหน้า ''$1''",
+       "delete-scheduled": "มีการกำหนดเวลาลบหน้า \"$1\" แล้ว\nโปรดรอสักครู่",
        "delete-hook-aborted": "การลบถูกฮุกยกเลิก\nโดยไม่มีคำชี้แจง",
        "no-null-revision": "ไม่สามารถสร้างรุ่นแก้ไขว่างใหม่ของหน้า \"$1\"",
        "badtitle": "ใช้ชื่อเรื่องนี้ไม่ได้",
index 7f82f70..f55765d 100644 (file)
@@ -53,7 +53,7 @@
        "tog-watchdefault": "將我修改嘅頁同檔案加入監視清單",
        "tog-watchmoves": "將我移動嘅頁同檔案加入監視清單",
        "tog-watchdeletion": "將我刪除嘅頁同檔案加入監視清單",
-       "tog-watchuploads": "加入我監視清單入面上載嘅檔案",
+       "tog-watchuploads": "加我上載嘅檔去監視清單度",
        "tog-watchrollback": "將我反轉過嘅頁加落監視清單",
        "tog-minordefault": "預設全部編輯做細修改",
        "tog-previewontop": "喺修改欄上邊顯示預覽",
        "listingcontinuesabbrev": "續",
        "index-category": "做咗索引嘅版",
        "noindex-category": "未做索引嘅版",
-       "broken-file-category": "æ\9c\89失æ\95\88æ\96\87件é\8f\88æ\8e¥嘅版",
+       "broken-file-category": "æ\96\87件é\8f\88æ\8e¥å£\9eå\92\97嘅版",
        "about": "關於",
        "article": "內容頁",
        "newwindow": "(響新視窗度打開)",
        "trackingcategories-name": "訊息名",
        "trackingcategories-desc": "分類收錄標準",
        "post-expand-template-inclusion-category-desc": "由於呢篇頁面嘥士喺擴展之前,已經超出咗<code>$wgMaxArticleSize</code>限制,所以好多模都擴展唔到。",
+       "broken-file-category-desc": "呢版有文件鏈接壞咗(即係連去一個唔存在嘅文件)。",
        "trackingcategories-nodesc": "冇解說資料",
        "trackingcategories-disabled": "類停用咗",
        "mailnologin": "冇傳送地址",
index 2145a3b..4c44bdd 100644 (file)
        "confirmdeletetext": "您正要刪除一個頁面或圖片以及其所有歷史。請確定您要進行此操作,並了解其後果,同時您的行為符合[[{{MediaWiki:Policy-url}}|方針]]。",
        "actioncomplete": "操作完成",
        "actionfailed": "操作失敗",
-       "deletedtext": "已刪除 \"$1\"。\n請參考 $2 檢視最近的刪除記錄。",
+       "deletedtext": "已刪除「$1」。請參考$2檢視最近的刪除記錄。",
        "dellogpage": "刪除日誌",
        "dellogpagetext": "以下為最近刪除記錄的清單。",
        "deletionlog": "刪除日誌",
        "passwordpolicies-policy-passwordcannotmatchblacklist": "密碼不可以同於被列入黑名單的特定密碼",
        "passwordpolicies-policy-maximalpasswordlength": "密碼必須小於 $1 個{{PLURAL:$1|字元|字元}}長度",
        "passwordpolicies-policy-passwordcannotbepopular": "密碼不可以是{{PLURAL:$1|常用密碼內容|在清單中的編號 $1 常用密碼}}",
-       "easydeflate-invaliddeflate": "提供的內容未被正常的壓縮"
+       "easydeflate-invaliddeflate": "提供的內容未被正常的壓縮",
+       "unprotected-js": "基於安全因素,JavaScript 不能從未保護的頁面來載入。建立 JavaScript 請僅在 MediaWiki 的:命名空間或使用者子頁面"
 }
index 60be21c..3a3529a 100644 (file)
@@ -439,11 +439,3 @@ $specialPageAliases = [
  * Arabic trails too.
  */
 $linkTrail = '/^([a-zء-ي]+)(.*)$/sDu';
-
-$imageFiles = [
-       'button-bold'     => 'ar/button_bold.png',
-       'button-italic'   => 'ar/button_italic.png',
-       'button-link'     => 'ar/button_link.png',
-       'button-headline' => 'ar/button_headline.png',
-       'button-nowiki'   => 'ar/button_nowiki.png',
-];
index 00295fe..21bd60c 100644 (file)
@@ -239,9 +239,3 @@ $separatorTransformTable = [
 $minimumGroupingDigits = 2;
 
 $linkTrail = '/^([абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]+)(.*)$/sDu';
-
-$imageFiles = [
-       'button-bold'     => 'be-tarask/button_bold.png',
-       'button-italic'   => 'be-tarask/button_italic.png',
-       'button-link'     => 'be-tarask/button_link.png',
-];
index 5227eba..d3167cc 100644 (file)
@@ -352,8 +352,3 @@ $bookstoreList = [
 
 $separatorTransformTable = [ ',' => '.', '.' => ',' ];
 $linkTrail = '/^([äöüßa-z]+)(.*)$/sDu';
-
-$imageFiles = [
-       'button-bold'     => 'de/button_bold.png',
-       'button-italic'   => 'de/button_italic.png',
-];
index 7a7370f..4c078a6 100644 (file)
@@ -531,23 +531,6 @@ $linkTrail = '/^([a-z]+)(.*)$/sD';
  */
 $linkPrefixCharset = 'a-zA-Z\\x{80}-\\x{10ffff}';
 
-/**
- * List of filenames for some ui images that can be overridden per language
- * basis if needed.
- */
-$imageFiles = [
-       'button-bold'     => 'en/button_bold.png',
-       'button-italic'   => 'en/button_italic.png',
-       'button-link'     => 'en/button_link.png',
-       'button-extlink'  => 'en/button_extlink.png',
-       'button-headline' => 'en/button_headline.png',
-       'button-image'    => 'en/button_image.png',
-       'button-media'    => 'en/button_media.png',
-       'button-nowiki'   => 'en/button_nowiki.png',
-       'button-sig'      => 'en/button_sig.png',
-       'button-hr'       => 'en/button_hr.png',
-];
-
 /**
  * A list of messages to preload for each request.
  * Here we add messages that are needed for a typical anonymous parser cache hit.
index bda468c..a78233f 100644 (file)
@@ -412,11 +412,3 @@ $dateFormats = [
 # Harakat are intentionally not included in the linkTrail. Their addition should
 # take place after enough tests.
 $linkTrail = "/^([ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]+)(.*)$/sDu";
-
-$imageFiles = [
-       'button-bold'     => 'fa/button_bold.png',
-       'button-italic'   => 'fa/button_italic.png',
-       'button-link'     => 'fa/button_link.png',
-       'button-headline' => 'fa/button_headline.png',
-       'button-nowiki'   => 'fa/button_nowiki.png',
-];
index c96c94d..0687a42 100644 (file)
@@ -201,7 +201,3 @@ $magicWords = [
        'language'                  => [ '0', '#SHPROOCH:', '#SPROCH:', '#SPRACHE:', '#LANGUAGE:' ],
        'hiddencat'                 => [ '1', '__VERSHTOCHE_SAACHJRUPP__', '__VERSTECKTE_KATEGORIE__', '__WARTUNGSKATEGORIE__', '__HIDDENCAT__' ],
 ];
-
-$imageFiles = [
-       'button-italic'   => 'ksh/button_italic.png',
-];
index b513648..fbd8096 100644 (file)
@@ -425,10 +425,4 @@ $minimumGroupingDigits = 2;
 $fallback8bitEncoding = 'windows-1251';
 $linkPrefixExtension = false;
 
-$imageFiles = [
-       'button-bold'   => 'ru/button_bold.png',
-       'button-italic' => 'ru/button_italic.png',
-       'button-link'   => 'ru/button_link.png',
-];
-
 $linkTrail = '/^([a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]+)(.*)$/sDu';
index a0177b1..0345ad6 100644 (file)
@@ -3697,7 +3697,6 @@ showredirs
 showreviewed
 showsizediff
 showtoc
-showtoolbar
 showunreviewed
 shtml
 si
index 7ff972e..54c1d38 100644 (file)
                                        "mw.visibleTimeout"
                                ]
                        },
-                       {
-                               "name": "Actions",
-                               "classes": ["mw.toolbar"]
-                       },
                        {
                                "name": "API",
                                "classes": ["mw.Api*", "mw.ForeignApi*"]
index 9603830..86315fc 100644 (file)
@@ -1394,12 +1394,6 @@ return [
                'dependencies' => 'jquery.cookie',
                'targets' => [ 'desktop', 'mobile' ],
        ],
-       'mediawiki.toolbar' => [
-               'class' => ResourceLoaderEditToolbarModule::class,
-               'scripts' => 'resources/src/mediawiki.toolbar/toolbar.js',
-               'styles' => 'resources/src/mediawiki.toolbar/toolbar.less',
-               'dependencies' => 'jquery.textSelection',
-       ],
        'mediawiki.experiments' => [
                'scripts' => 'resources/src/mediawiki.experiments.js',
                'targets' => [ 'desktop', 'mobile' ],
@@ -2067,6 +2061,7 @@ return [
        ],
        'mediawiki.special.block' => [
                'scripts' => 'resources/src/mediawiki.special.block.js',
+               'styles' => 'resources/src/mediawiki.special.block.less',
                'dependencies' => [
                        'oojs-ui-core',
                        'oojs-ui.styles.icons-editing-core',
@@ -2077,6 +2072,7 @@ return [
                        'mediawiki.htmlform',
                        'moment',
                ],
+               'targets' => [ 'desktop', 'mobile' ],
        ],
        'mediawiki.special.changecredentials.js' => [
                'scripts' => 'resources/src/mediawiki.special.changecredentials.js',
@@ -2706,6 +2702,18 @@ return [
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
+       'mediawiki.widgets.TitlesMultiselectWidget' => [
+               'scripts' => [
+                       'resources/src/mediawiki.widgets/mw.widgets.TitlesMultiselectWidget.js',
+               ],
+               'dependencies' => [
+                       'mediawiki.api',
+                       'oojs-ui-widgets',
+                       // FIXME: Needs TitleInputWidget only
+                       'mediawiki.widgets',
+               ],
+               'targets' => [ 'desktop', 'mobile' ],
+       ],
        'mediawiki.widgets.SearchInputWidget' => [
                'scripts' => [
                        'resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js',
index cb54e71..1852231 100644 (file)
@@ -19,7 +19,9 @@
                        enableAutoblockField = infuseOrNull( $( '#mw-input-wpAutoBlock' ).closest( '.oo-ui-fieldLayout' ) ),
                        hideUserField = infuseOrNull( $( '#mw-input-wpHideUser' ).closest( '.oo-ui-fieldLayout' ) ),
                        watchUserField = infuseOrNull( $( '#mw-input-wpWatch' ).closest( '.oo-ui-fieldLayout' ) ),
-                       expiryWidget = infuseOrNull( 'mw-input-wpExpiry' );
+                       expiryWidget = infuseOrNull( 'mw-input-wpExpiry' ),
+                       editingRestrictionWidget = infuseOrNull( 'mw-input-wpEditingRestriction' ),
+                       pageRestrictionsWidget = infuseOrNull( 'mw-input-wpPageRestrictions' );
 
                function updateBlockOptions() {
                        var blocktarget = blockTargetWidget.getValue().trim(),
@@ -30,7 +32,8 @@
                                expiryValue = expiryWidget.getValue(),
                                // infinityValues  are the values the SpecialBlock class accepts as infinity (sf. wfIsInfinity)
                                infinityValues = [ 'infinite', 'indefinite', 'infinity', 'never' ],
-                               isIndefinite = infinityValues.indexOf( expiryValue ) !== -1;
+                               isIndefinite = infinityValues.indexOf( expiryValue ) !== -1,
+                               editingRestrictionValue = editingRestrictionWidget ? editingRestrictionWidget.getValue() : undefined;
 
                        if ( enableAutoblockField ) {
                                enableAutoblockField.toggle( !( isNonEmptyIp ) );
                        if ( watchUserField ) {
                                watchUserField.toggle( !( isIpRange && !isEmpty ) );
                        }
+                       if ( pageRestrictionsWidget ) {
+                               pageRestrictionsWidget.setDisabled( editingRestrictionValue === 'sitewide' );
+                       }
                }
 
                if ( blockTargetWidget ) {
                        // Bind functions so they're checked whenever stuff changes
                        blockTargetWidget.on( 'change', updateBlockOptions );
                        expiryWidget.on( 'change', updateBlockOptions );
+                       editingRestrictionWidget.on( 'change', updateBlockOptions );
 
                        // Call them now to set initial state (ie. Special:Block/Foobar?wpBlockExpiry=2+hours)
                        updateBlockOptions();
diff --git a/resources/src/mediawiki.special.block.less b/resources/src/mediawiki.special.block.less
new file mode 100644 (file)
index 0000000..c013994
--- /dev/null
@@ -0,0 +1,6 @@
+.mw-block-page-restrictions {
+       margin-left: 2em;
+       .oo-ui-widget {
+               max-width: 48em;
+       }
+}
diff --git a/resources/src/mediawiki.toolbar/images/ar/button_bold.png b/resources/src/mediawiki.toolbar/images/ar/button_bold.png
deleted file mode 100644 (file)
index 50e2ff0..0000000
Binary files a/resources/src/mediawiki.toolbar/images/ar/button_bold.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/ar/button_headline.png b/resources/src/mediawiki.toolbar/images/ar/button_headline.png
deleted file mode 100644 (file)
index 2e3e781..0000000
Binary files a/resources/src/mediawiki.toolbar/images/ar/button_headline.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/ar/button_italic.png b/resources/src/mediawiki.toolbar/images/ar/button_italic.png
deleted file mode 100644 (file)
index 6b54fb6..0000000
Binary files a/resources/src/mediawiki.toolbar/images/ar/button_italic.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/ar/button_link.png b/resources/src/mediawiki.toolbar/images/ar/button_link.png
deleted file mode 100644 (file)
index 4434e7f..0000000
Binary files a/resources/src/mediawiki.toolbar/images/ar/button_link.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/ar/button_nowiki.png b/resources/src/mediawiki.toolbar/images/ar/button_nowiki.png
deleted file mode 100644 (file)
index c9378de..0000000
Binary files a/resources/src/mediawiki.toolbar/images/ar/button_nowiki.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/be-tarask/button_bold.png b/resources/src/mediawiki.toolbar/images/be-tarask/button_bold.png
deleted file mode 100644 (file)
index df6700d..0000000
Binary files a/resources/src/mediawiki.toolbar/images/be-tarask/button_bold.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/be-tarask/button_italic.png b/resources/src/mediawiki.toolbar/images/be-tarask/button_italic.png
deleted file mode 100644 (file)
index 872c00f..0000000
Binary files a/resources/src/mediawiki.toolbar/images/be-tarask/button_italic.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/be-tarask/button_link.png b/resources/src/mediawiki.toolbar/images/be-tarask/button_link.png
deleted file mode 100644 (file)
index d3dd88e..0000000
Binary files a/resources/src/mediawiki.toolbar/images/be-tarask/button_link.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/de/button_bold.png b/resources/src/mediawiki.toolbar/images/de/button_bold.png
deleted file mode 100644 (file)
index 8e6b389..0000000
Binary files a/resources/src/mediawiki.toolbar/images/de/button_bold.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/de/button_italic.png b/resources/src/mediawiki.toolbar/images/de/button_italic.png
deleted file mode 100644 (file)
index 5e3cd11..0000000
Binary files a/resources/src/mediawiki.toolbar/images/de/button_italic.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_bold.png b/resources/src/mediawiki.toolbar/images/en/button_bold.png
deleted file mode 100644 (file)
index e582fb1..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_bold.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_extlink.png b/resources/src/mediawiki.toolbar/images/en/button_extlink.png
deleted file mode 100644 (file)
index 458943c..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_extlink.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_headline.png b/resources/src/mediawiki.toolbar/images/en/button_headline.png
deleted file mode 100644 (file)
index 7d64a16..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_headline.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_hr.png b/resources/src/mediawiki.toolbar/images/en/button_hr.png
deleted file mode 100644 (file)
index 47e1ca4..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_hr.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_image.png b/resources/src/mediawiki.toolbar/images/en/button_image.png
deleted file mode 100644 (file)
index 6919296..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_image.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_italic.png b/resources/src/mediawiki.toolbar/images/en/button_italic.png
deleted file mode 100644 (file)
index 820efe2..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_italic.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_link.png b/resources/src/mediawiki.toolbar/images/en/button_link.png
deleted file mode 100644 (file)
index 5dd362c..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_link.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_media.png b/resources/src/mediawiki.toolbar/images/en/button_media.png
deleted file mode 100644 (file)
index 80c3156..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_media.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_nowiki.png b/resources/src/mediawiki.toolbar/images/en/button_nowiki.png
deleted file mode 100644 (file)
index 05a977a..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_nowiki.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/en/button_sig.png b/resources/src/mediawiki.toolbar/images/en/button_sig.png
deleted file mode 100644 (file)
index 2cbcc0b..0000000
Binary files a/resources/src/mediawiki.toolbar/images/en/button_sig.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/fa/button_bold.png b/resources/src/mediawiki.toolbar/images/fa/button_bold.png
deleted file mode 100644 (file)
index 5489343..0000000
Binary files a/resources/src/mediawiki.toolbar/images/fa/button_bold.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/fa/button_headline.png b/resources/src/mediawiki.toolbar/images/fa/button_headline.png
deleted file mode 100644 (file)
index 4d48a5d..0000000
Binary files a/resources/src/mediawiki.toolbar/images/fa/button_headline.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/fa/button_italic.png b/resources/src/mediawiki.toolbar/images/fa/button_italic.png
deleted file mode 100644 (file)
index 41098c7..0000000
Binary files a/resources/src/mediawiki.toolbar/images/fa/button_italic.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/fa/button_link.png b/resources/src/mediawiki.toolbar/images/fa/button_link.png
deleted file mode 100644 (file)
index 8c2d85a..0000000
Binary files a/resources/src/mediawiki.toolbar/images/fa/button_link.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/fa/button_nowiki.png b/resources/src/mediawiki.toolbar/images/fa/button_nowiki.png
deleted file mode 100644 (file)
index c9378de..0000000
Binary files a/resources/src/mediawiki.toolbar/images/fa/button_nowiki.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/ksh/LICENSE b/resources/src/mediawiki.toolbar/images/ksh/LICENSE
deleted file mode 100644 (file)
index 640bbff..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-button_italic.png
--------------------
-Source : https://commons.wikimedia.org/wiki/Image:Button_S_italic.png
-License: Public domain
-Author : Purodha Blissenbach, https://ksh.wikipedia.org/wiki/User:Purodha
-
diff --git a/resources/src/mediawiki.toolbar/images/ksh/button_italic.png b/resources/src/mediawiki.toolbar/images/ksh/button_italic.png
deleted file mode 100644 (file)
index 34268d9..0000000
Binary files a/resources/src/mediawiki.toolbar/images/ksh/button_italic.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/ru/LICENSE b/resources/src/mediawiki.toolbar/images/ru/LICENSE
deleted file mode 100644 (file)
index 572864b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-button_bold.png
----------------
-Source : https://commons.wikimedia.org/wiki/File:Button_bold_ukr.png
-License: Public domain
-Author : Alexey Belomoev
-
-button_italic.png
-------------------------
-Source : https://commons.wikimedia.org/wiki/File:Button_italic_ukr.png
-License: Public domain
-Author : Alexey Belomoev
-
-button_link.png
------------------
-Source : https://commons.wikimedia.org/wiki/File:Button_internal_link_ukr.png
-License: GPL
-Author : Saproj, Erik Möller
diff --git a/resources/src/mediawiki.toolbar/images/ru/button_bold.png b/resources/src/mediawiki.toolbar/images/ru/button_bold.png
deleted file mode 100644 (file)
index a7dceb1..0000000
Binary files a/resources/src/mediawiki.toolbar/images/ru/button_bold.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/ru/button_italic.png b/resources/src/mediawiki.toolbar/images/ru/button_italic.png
deleted file mode 100644 (file)
index 44a0a74..0000000
Binary files a/resources/src/mediawiki.toolbar/images/ru/button_italic.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/images/ru/button_link.png b/resources/src/mediawiki.toolbar/images/ru/button_link.png
deleted file mode 100644 (file)
index 36b9059..0000000
Binary files a/resources/src/mediawiki.toolbar/images/ru/button_link.png and /dev/null differ
diff --git a/resources/src/mediawiki.toolbar/toolbar.js b/resources/src/mediawiki.toolbar/toolbar.js
deleted file mode 100644 (file)
index be49d26..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- * Interface for the classic edit toolbar.
- *
- * @class mw.toolbar
- * @singleton
- */
-( function () {
-       var toolbar, isReady, $toolbar, queue, slice, $currentFocused;
-
-       /**
-        * Internal helper that does the actual insertion of the button into the toolbar.
-        *
-        * For backwards-compatibility, passing `imageFile`, `speedTip`, `tagOpen`, `tagClose`,
-        * `sampleText` and `imageId` as separate arguments (in this order) is also supported.
-        *
-        * @private
-        *
-        * @param {Object} button Object with the following properties.
-        *  You are required to provide *either* the `onClick` parameter, or the three parameters
-        *  `tagOpen`, `tagClose` and `sampleText`, but not both (they're mutually exclusive).
-        * @param {string} [button.imageFile] Image to use for the button.
-        * @param {string} button.speedTip Tooltip displayed when user mouses over the button.
-        * @param {Function} [button.onClick] Function to be executed when the button is clicked.
-        * @param {string} [button.tagOpen]
-        * @param {string} [button.tagClose]
-        * @param {string} [button.sampleText] Alternative to `onClick`. `tagOpen`, `tagClose` and
-        *  `sampleText` together provide the markup that should be inserted into page text at
-        *  current cursor position.
-        * @param {string} [button.imageId] `id` attribute of the button HTML element. Can be
-        *  used to define the image with CSS if it's not provided as `imageFile`.
-        * @param {string} [speedTip]
-        * @param {string} [tagOpen]
-        * @param {string} [tagClose]
-        * @param {string} [sampleText]
-        * @param {string} [imageId]
-        */
-       function insertButton( button, speedTip, tagOpen, tagClose, sampleText, imageId ) {
-               var $button;
-
-               // Backwards compatibility
-               if ( typeof button !== 'object' ) {
-                       button = {
-                               imageFile: button,
-                               speedTip: speedTip,
-                               tagOpen: tagOpen,
-                               tagClose: tagClose,
-                               sampleText: sampleText,
-                               imageId: imageId
-                       };
-               }
-
-               if ( button.imageFile ) {
-                       $button = $( '<img>' ).attr( {
-                               src: button.imageFile,
-                               alt: button.speedTip,
-                               title: button.speedTip,
-                               id: button.imageId || undefined,
-                               'class': 'mw-toolbar-editbutton'
-                       } );
-               } else {
-                       $button = $( '<div>' ).attr( {
-                               title: button.speedTip,
-                               id: button.imageId || undefined,
-                               'class': 'mw-toolbar-editbutton'
-                       } );
-               }
-
-               $button.click( function ( e ) {
-                       if ( button.onClick !== undefined ) {
-                               button.onClick( e );
-                       } else {
-                               toolbar.insertTags( button.tagOpen, button.tagClose, button.sampleText );
-                       }
-
-                       return false;
-               } );
-
-               $toolbar.append( $button );
-       }
-
-       isReady = false;
-       $toolbar = false;
-
-       /**
-        * @private
-        * @property {Array}
-        * Contains button objects (and for backwards compatibility, it can
-        * also contains an arguments array for insertButton).
-        */
-       queue = [];
-       slice = queue.slice;
-
-       toolbar = {
-
-               /**
-                * Add buttons to the toolbar.
-                *
-                * Takes care of race conditions and time-based dependencies by placing buttons in a queue if
-                * this method is called before the toolbar is created.
-                *
-                * For backwards-compatibility, passing `imageFile`, `speedTip`, `tagOpen`, `tagClose`,
-                * `sampleText` and `imageId` as separate arguments (in this order) is also supported.
-                *
-                * @inheritdoc #insertButton
-                */
-               addButton: function () {
-                       if ( isReady ) {
-                               insertButton.apply( toolbar, arguments );
-                       } else {
-                               // Convert arguments list to array
-                               queue.push( slice.call( arguments ) );
-                       }
-               },
-
-               /**
-                * Add multiple buttons to the toolbar (see also #addButton).
-                *
-                * Example usage:
-                *
-                *     addButtons( [ { .. }, { .. }, { .. } ] );
-                *     addButtons( { .. }, { .. } );
-                *
-                * @param {...Object|Array} [buttons] An array of button objects or the first
-                *  button object in a list of variadic arguments.
-                */
-               addButtons: function ( buttons ) {
-                       if ( !Array.isArray( buttons ) ) {
-                               buttons = slice.call( arguments );
-                       }
-                       if ( isReady ) {
-                               buttons.forEach( function ( button ) {
-                                       insertButton( button );
-                               } );
-                       } else {
-                               // Push each button into the queue
-                               queue.push.apply( queue, buttons );
-                       }
-               },
-
-               /**
-                * Apply tagOpen/tagClose to selection in currently focused textarea.
-                *
-                * Uses `sampleText` if selection is empty.
-                *
-                * @param {string} tagOpen
-                * @param {string} tagClose
-                * @param {string} sampleText
-                */
-               insertTags: function ( tagOpen, tagClose, sampleText ) {
-                       if ( $currentFocused && $currentFocused.length ) {
-                               $currentFocused.textSelection(
-                                       'encapsulateSelection', {
-                                               pre: tagOpen,
-                                               peri: sampleText,
-                                               post: tagClose
-                                       }
-                               );
-                       }
-               }
-       };
-
-       // Legacy (for compatibility with the code previously in skins/common.edit.js)
-       mw.log.deprecate( window, 'addButton', toolbar.addButton, 'Use mw.toolbar.addButton instead.' );
-       mw.log.deprecate( window, 'insertTags', toolbar.insertTags, 'Use mw.toolbar.insertTags instead.' );
-
-       // For backwards compatibility. Used to be called from EditPage.php, maybe other places as well.
-       toolbar.init = $.noop;
-
-       // Expose API publicly
-       // @deprecated since MW 1.29
-       mw.log.deprecate( mw, 'toolbar', toolbar, null, 'mw.toolbar' );
-
-       $( function () {
-               var i, button;
-
-               // Used to determine where to insert tags
-               $currentFocused = $( '#wpTextbox1' );
-
-               // Populate the selector cache for $toolbar
-               $toolbar = $( '#toolbar' );
-
-               for ( i = 0; i < queue.length; i++ ) {
-                       button = queue[ i ];
-                       if ( Array.isArray( button ) ) {
-                               // Forwarded arguments array from mw.toolbar.addButton
-                               insertButton.apply( toolbar, button );
-                       } else {
-                               // Raw object from mw.toolbar.addButtons
-                               insertButton( button );
-                       }
-               }
-
-               // Clear queue
-               queue.length = 0;
-
-               // This causes further calls to addButton to go to insertion directly
-               // instead of to the queue.
-               // It is important that this is after the one and only loop through
-               // the queue
-               isReady = true;
-
-               // Apply to dynamically created textboxes as well as normal ones
-               $( document ).on( 'focus', 'textarea, input:text', function () {
-                       $currentFocused = $( this );
-               } );
-       } );
-
-}() );
diff --git a/resources/src/mediawiki.toolbar/toolbar.less b/resources/src/mediawiki.toolbar/toolbar.less
deleted file mode 100644 (file)
index 93ea294..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-@import 'mediawiki.mixins';
-
-#mw-editbutton-bold {
-       .background-image('images/@{button-bold}');
-}
-
-#mw-editbutton-italic {
-       .background-image('images/@{button-italic}');
-}
-
-#mw-editbutton-link {
-       .background-image('images/@{button-link}');
-}
-
-#mw-editbutton-extlink {
-       .background-image('images/@{button-extlink}');
-}
-
-#mw-editbutton-headline {
-       .background-image('images/@{button-headline}');
-}
-
-#mw-editbutton-image {
-       .background-image('images/@{button-image}');
-}
-
-#mw-editbutton-media {
-       .background-image('images/@{button-media}');
-}
-
-#mw-editbutton-nowiki {
-       .background-image('images/@{button-nowiki}');
-}
-
-// Who decided to make only this single one different than the name of the data item?
-#mw-editbutton-signature {
-       .background-image('images/@{button-sig}');
-}
-
-#mw-editbutton-hr {
-       .background-image('images/@{button-hr}');
-}
index c256f1f..cb1281d 100644 (file)
@@ -28,6 +28,7 @@
         * @cfg {boolean} [excludeCurrentPage] Exclude the current page from suggestions
         * @cfg {boolean} [validateTitle=true] Whether the input must be a valid title
         * @cfg {boolean} [required=false] Whether the input must not be empty
+        * @cfg {boolean} [highlightSearchQuery=true] Highlight the partial query the user used for this title
         * @cfg {Object} [cache] Result cache which implements a 'set' method, taking keyed values as an argument
         * @cfg {mw.Api} [api] API object to use, creates a default mw.Api instance if not specified
         */
@@ -51,6 +52,7 @@
                this.addQueryInput = config.addQueryInput !== false;
                this.excludeCurrentPage = !!config.excludeCurrentPage;
                this.validateTitle = config.validateTitle !== undefined ? config.validateTitle : true;
+               this.highlightSearchQuery = config.highlightSearchQuery === undefined ? true : !!config.highlightSearchQuery;
                this.cache = config.cache;
                this.api = config.api || new mw.Api();
                // Supports: IE10, FF28, Chrome23
                        missing: data.missing,
                        redirect: data.redirect,
                        disambiguation: data.disambiguation,
-                       query: this.getQueryValue(),
+                       query: this.highlightSearchQuery ? this.getQueryValue() : null,
                        compare: this.compare
                };
        };
diff --git a/resources/src/mediawiki.widgets/mw.widgets.TitlesMultiselectWidget.js b/resources/src/mediawiki.widgets/mw.widgets.TitlesMultiselectWidget.js
new file mode 100644 (file)
index 0000000..71ba33f
--- /dev/null
@@ -0,0 +1,145 @@
+/*!
+ * MediaWiki Widgets - TitlesMultiselectWidget class.
+ *
+ * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+( function () {
+
+       /**
+        * Creates an mw.widgets.TitlesMultiselectWidget object
+        *
+        * @class
+        * @extends OO.ui.MenuTagMultiselectWidget
+        * @mixins OO.ui.mixin.RequestManager
+        * @mixins OO.ui.mixin.PendingElement
+        * @mixins mw.widgets.TitleWidget
+        *
+        * @constructor
+        * @param {Object} [config] Configuration options
+        */
+       mw.widgets.TitlesMultiselectWidget = function MwWidgetsTitlesMultiselectWidget( config ) {
+               config = $.extend( true, {
+                       // Shouldn't this be handled by MenuTagMultiselectWidget?
+                       options: config.selected ? config.selected.map( function ( title ) {
+                               return {
+                                       data: title,
+                                       label: title
+                               };
+                       } ) : []
+               }, config );
+
+               // Parent constructor
+               mw.widgets.TitlesMultiselectWidget.parent.call( this, $.extend( true,
+                       {
+                               clearInputOnChoose: true,
+                               inputPosition: 'inline',
+                               allowEditTags: false
+                       },
+                       config
+               ) );
+
+               // Mixin constructors
+               mw.widgets.TitleWidget.call( this, $.extend( true, {
+                       addQueryInput: true,
+                       highlightSearchQuery: false
+               }, config ) );
+               OO.ui.mixin.RequestManager.call( this, config );
+               OO.ui.mixin.PendingElement.call( this, $.extend( true, {}, config, {
+                       $pending: this.$handle
+               } ) );
+
+               // Validate from mw.widgets.TitleWidget
+               this.input.setValidation( this.isQueryValid.bind( this ) );
+
+               if ( this.maxLength !== undefined ) {
+                       // maxLength is defined through TitleWidget parent
+                       this.input.$input.attr( 'maxlength', this.maxLength );
+               }
+
+               // Initialization
+               this.$element
+                       .addClass( 'mw-widgets-titlesMultiselectWidget' );
+
+               this.menu.$element
+                       // For consistency, use the same classes as TitleWidget
+                       // expects for menu results
+                       .addClass( 'mw-widget-titleWidget-menu' )
+                       .toggleClass( 'mw-widget-titleWidget-menu-withImages', this.showImages )
+                       .toggleClass( 'mw-widget-titleWidget-menu-withDescriptions', this.showDescriptions );
+
+               if ( 'name' in config ) {
+                       // Use this instead of <input type="hidden">, because hidden inputs do not have separate
+                       // 'value' and 'defaultValue' properties. The script on Special:Preferences
+                       // (mw.special.preferences.confirmClose) checks this property to see if a field was changed.
+                       this.hiddenInput = $( '<textarea>' )
+                               .addClass( 'oo-ui-element-hidden' )
+                               .attr( 'name', config.name )
+                               .appendTo( this.$element );
+                       // Update with preset values
+                       // Set the default value (it might be different from just being empty)
+                       this.hiddenInput.prop( 'defaultValue', this.getItems().map( function ( item ) {
+                               return item.getData();
+                       } ).join( '\n' ) );
+                       this.on( 'change', function ( items ) {
+                               this.hiddenInput.val( items.map( function ( item ) {
+                                       return item.getData();
+                               } ).join( '\n' ) );
+                               // Trigger a 'change' event as if a user edited the text
+                               // (it is not triggered when changing the value from JS code).
+                               this.hiddenInput.trigger( 'change' );
+                       }.bind( this ) );
+               }
+
+       };
+
+       /* Setup */
+
+       OO.inheritClass( mw.widgets.TitlesMultiselectWidget, OO.ui.MenuTagMultiselectWidget );
+       OO.mixinClass( mw.widgets.TitlesMultiselectWidget, OO.ui.mixin.RequestManager );
+       OO.mixinClass( mw.widgets.TitlesMultiselectWidget, OO.ui.mixin.PendingElement );
+       OO.mixinClass( mw.widgets.TitlesMultiselectWidget, mw.widgets.TitleWidget );
+
+       /* Methods */
+
+       mw.widgets.TitlesMultiselectWidget.prototype.getQueryValue = function () {
+               return this.input.getValue();
+       };
+
+       /**
+        * @inheritdoc OO.ui.MenuTagMultiselectWidget
+        */
+       mw.widgets.TitlesMultiselectWidget.prototype.onInputChange = function () {
+               var widget = this;
+
+               this.getRequestData()
+                       .then( function ( data ) {
+                               // Reset
+                               widget.menu.clearItems();
+                               widget.menu.addItems( widget.getOptionsFromData( data ) );
+                       } );
+
+               mw.widgets.TitlesMultiselectWidget.parent.prototype.onInputChange.call( this );
+       };
+
+       /**
+        * @inheritdoc OO.ui.mixin.RequestManager
+        */
+       mw.widgets.TitlesMultiselectWidget.prototype.getRequestQuery = function () {
+               return this.getQueryValue();
+       };
+
+       /**
+        * @inheritdoc OO.ui.mixin.RequestManager
+        */
+       mw.widgets.TitlesMultiselectWidget.prototype.getRequest = function () {
+               return this.getSuggestionsPromise();
+       };
+
+       /**
+        * @inheritdoc OO.ui.mixin.RequestManager
+        */
+       mw.widgets.TitlesMultiselectWidget.prototype.getRequestCacheDataFromResponse = function ( response ) {
+               return response.query || {};
+       };
+}() );
index 41f3192..f843123 100644 (file)
@@ -93,6 +93,9 @@ $wgAutoloadClasses += [
        'MediaWiki\\Auth\\AuthenticationRequestTestCase' =>
                "$testDir/phpunit/includes/auth/AuthenticationRequestTestCase.php",
 
+       # tests/phpunit/includes/block
+       'MediaWiki\\Tests\\Block\\Restriction\\RestrictionTestCase' => "$testDir/phpunit/includes/block/Restriction/RestrictionTestCase.php",
+
        # tests/phpunit/includes/changes
        'TestRecentChangesHelper' => "$testDir/phpunit/includes/changes/TestRecentChangesHelper.php",
 
index a921ee0..9954425 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+use MediaWiki\Block\BlockRestriction;
+use MediaWiki\Block\Restriction\PageRestriction;
+
 /**
  * @group Database
  * @group Blocking
@@ -460,4 +463,263 @@ class BlockTest extends MediaWikiLangTestCase {
                }
        }
 
+       /**
+        * @covers Block::newFromRow
+        */
+       public function testNewFromRow() {
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+
+               $block = new Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'expiry' => 'infinity',
+               ] );
+               $block->insert();
+
+               $blockQuery = Block::getQueryInfo();
+               $row = $this->db->select(
+                       $blockQuery['tables'],
+                       $blockQuery['fields'],
+                       [
+                               'ipb_id' => $block->getId(),
+                       ],
+                       __METHOD__,
+                       [],
+                       $blockQuery['joins']
+               )->fetchObject();
+
+               $block = Block::newFromRow( $row );
+               $this->assertInstanceOf( Block::class, $block );
+               $this->assertEquals( $block->getBy(), $sysop->getId() );
+               $this->assertEquals( $block->getTarget()->getName(), $badActor->getName() );
+               $block->delete();
+       }
+
+       /**
+        * @covers Block::equals
+        */
+       public function testEquals() {
+               $block = new Block();
+
+               $this->assertTrue( $block->equals( $block ) );
+
+               $partial = new Block( [
+                       'sitewide' => false,
+               ] );
+               $this->assertFalse( $block->equals( $partial ) );
+       }
+
+       /**
+        * @covers Block::isSitewide
+        */
+       public function testIsSitewide() {
+               $block = new Block();
+               $this->assertTrue( $block->isSitewide() );
+
+               $block = new Block( [
+                       'sitewide' => true,
+               ] );
+               $this->assertTrue( $block->isSitewide() );
+
+               $block = new Block( [
+                       'sitewide' => false,
+               ] );
+               $this->assertFalse( $block->isSitewide() );
+
+               $block = new Block( [
+                       'sitewide' => false,
+               ] );
+               $block->isSitewide( true );
+               $this->assertTrue( $block->isSitewide() );
+       }
+
+       /**
+        * @covers Block::getRestrictions
+        * @covers Block::setRestrictions
+        */
+       public function testRestrictions() {
+               $block = new Block();
+               $restrictions = [
+                       new PageRestriction( 0, 1 )
+               ];
+               $block->setRestrictions( $restrictions );
+
+               $this->assertSame( $restrictions, $block->getRestrictions() );
+       }
+
+       /**
+        * @covers Block::getRestrictions
+        * @covers Block::insert
+        */
+       public function testRestrictionsFromDatabase() {
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+
+               $block = new Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'expiry' => 'infinity',
+               ] );
+               $page = $this->getExistingTestPage( 'Foo' );
+               $restriction = new PageRestriction( 0, $page->getId() );
+               $block->setRestrictions( [ $restriction ] );
+               $block->insert();
+
+               // Refresh the block from the database.
+               $block = Block::newFromID( $block->getId() );
+               $restrictions = $block->getRestrictions();
+               $this->assertCount( 1, $restrictions );
+               $this->assertTrue( $restriction->equals( $restrictions[0] ) );
+               $block->delete();
+       }
+
+       /**
+        * @covers Block::insert
+        */
+       public function testInsertExistingBlock() {
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+
+               $block = new Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'expiry' => 'infinity',
+               ] );
+               $page = $this->getExistingTestPage( 'Foo' );
+               $restriction = new PageRestriction( 0, $page->getId() );
+               $block->setRestrictions( [ $restriction ] );
+               $block->insert();
+
+               // Insert the block again, which should result in a failur
+               $result = $block->insert();
+
+               $this->assertFalse( $result );
+
+               // Ensure that there are no restrictions where the blockId is 0.
+               $count = $this->db->selectRowCount(
+                       'ipblocks_restrictions',
+                       '*',
+                       [ 'ir_ipb_id' => 0 ],
+                       __METHOD__
+               );
+               $this->assertSame( 0, $count );
+
+               $block->delete();
+       }
+
+       /**
+        * @covers Block::preventsEdit
+        */
+       public function testPreventsEditReturnsTrueOnSitewideBlock() {
+               $user = $this->getTestUser()->getUser();
+               $block = new Block( [
+                       'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
+                       'allowUsertalk' => true,
+                       'sitewide' => true
+               ] );
+
+               $block->setTarget( $user );
+               $block->setBlocker( $this->getTestSysop()->getUser() );
+               $block->insert();
+
+               $title = $this->getExistingTestPage( 'Foo' )->getTitle();
+
+               $this->assertTrue( $block->preventsEdit( $title ) );
+
+               $block->delete();
+       }
+
+       /**
+        * @covers Block::preventsEdit
+        */
+       public function testPreventsEditOnPartialBlock() {
+               $user = $this->getTestUser()->getUser();
+               $block = new Block( [
+                       'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
+                       'allowUsertalk' => true,
+                       'sitewide' => false
+               ] );
+
+               $block->setTarget( $user );
+               $block->setBlocker( $this->getTestSysop()->getUser() );
+               $block->insert();
+
+               $pageFoo = $this->getExistingTestPage( 'Foo' );
+               $pageBar = $this->getExistingTestPage( 'Bar' );
+
+               $pageRestriction = new PageRestriction( $block->getId(), $pageFoo->getId() );
+               BlockRestriction::insert( [ $pageRestriction ] );
+
+               $this->assertTrue( $block->preventsEdit( $pageFoo->getTitle() ) );
+               $this->assertFalse( $block->preventsEdit( $pageBar->getTitle() ) );
+
+               $block->delete();
+       }
+
+       /**
+        * @covers Block::preventsEdit
+        * @dataProvider preventsEditOnUserTalkProvider
+        */
+       public function testPreventsEditOnUserTalkPage(
+               $allowUsertalk, $sitewide, $result, $blockAllowsUTEdit = true
+       ) {
+               $this->setMwGlobals( [
+                       'wgBlockAllowsUTEdit' => $blockAllowsUTEdit,
+               ] );
+
+               $user = $this->getTestUser()->getUser();
+               $block = new Block( [
+                       'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
+                       'allowUsertalk' => $allowUsertalk,
+                       'sitewide' => $sitewide
+               ] );
+
+               $block->setTarget( $user );
+               $block->setBlocker( $this->getTestSysop()->getUser() );
+               $block->insert();
+
+               $this->assertEquals( $result, $block->preventsEdit( $user->getTalkPage() ) );
+               $block->delete();
+       }
+
+       public function preventsEditOnUserTalkProvider() {
+               return [
+                       [
+                               'allowUsertalk' => false,
+                               'sitewide' => true,
+                               'result' => true,
+                       ],
+                       [
+                               'allowUsertalk' => true,
+                               'sitewide' => true,
+                               'result' => false,
+                       ],
+                       [
+                               'allowUsertalk' => true,
+                               'sitewide' => false,
+                               'result' => false,
+                       ],
+                       [
+                               'allowUsertalk' => false,
+                               'sitewide' => false,
+                               'result' => true,
+                       ],
+                       [
+                               'allowUsertalk' => true,
+                               'sitewide' => true,
+                               'result' => true,
+                               'blockAllowsUTEdit' => false
+                       ],
+                       [
+                               'allowUsertalk' => true,
+                               'sitewide' => false,
+                               'result' => true,
+                               'blockAllowsUTEdit' => false
+                       ],
+               ];
+       }
 }
index 5aa24e5..11b9c01 100644 (file)
@@ -969,5 +969,22 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                                'Useruser', 'test', '23:00, 31 December 1969', '127.0.8.1',
                                $wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ] ],
                        $this->title->getUserPermissionsErrors( 'move-target', $this->user ) );
+
+               // partial block message test
+               $this->user->mBlockedby = $this->user->getName();
+               $this->user->mBlock = new Block( [
+                       'address' => '127.0.8.1',
+                       'by' => $this->user->getId(),
+                       'reason' => 'no reason given',
+                       'timestamp' => $now,
+                       'sitewide' => false,
+                       'expiry' => 10,
+               ] );
+
+               $this->assertEquals( [ [ 'blockedtext-partial',
+                               '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1',
+                               'Useruser', null, '23:00, 31 December 1969', '127.0.8.1',
+                               $wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ] ],
+                       $this->title->getUserPermissionsErrors( 'move-target', $this->user ) );
        }
 }
index 07e861f..563d5e3 100644 (file)
@@ -233,6 +233,26 @@ class ApiBlockTest extends ApiTestCase {
                $this->doBlock( [ 'expiry' => '' ] );
        }
 
+       public function testBlockWithRestrictions() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => true,
+               ] );
+
+               $title = 'Foo';
+               $page = $this->getExistingTestPage( $title );
+
+               $this->doBlock( [
+                       'partial' => true,
+                       'pagerestrictions' => $title,
+               ] );
+
+               $block = Block::newFromTarget( $this->mUser->getName() );
+
+               $this->assertFalse( $block->isSitewide() );
+               $this->assertCount( 1, $block->getRestrictions() );
+               $this->assertEquals( $title, $block->getRestrictions()[0]->getTitle()->getText() );
+       }
+
        /**
         * @expectedException ApiUsageException
         * @expectedExceptionMessage The "token" parameter must be set
@@ -249,4 +269,50 @@ class ApiBlockTest extends ApiTestCase {
                        self::$users['sysop']->getUser()
                );
        }
+
+       /**
+        * @expectedException ApiUsageException
+        * @expectedExceptionMessage Invalid value "127.0.0.1/64" for user parameter "user".
+        */
+       public function testBlockWithLargeRange() {
+               $tokens = $this->getTokens();
+
+               $this->doApiRequest(
+                       [
+                               'action' => 'block',
+                               'user' => '127.0.0.1/64',
+                               'reason' => 'Some reason',
+                               'token' => $tokens['blocktoken'],
+                       ],
+                       null,
+                       false,
+                       self::$users['sysop']->getUser()
+               );
+       }
+
+       /**
+        * @expectedException ApiUsageException
+        * @expectedExceptionMessage "pagerestrictions" may not be over 10 (set to 11) for bots or sysops.
+        */
+       public function testBlockingToManyRestrictions() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => true,
+               ] );
+
+               $tokens = $this->getTokens();
+
+               $this->doApiRequest(
+                       [
+                               'action' => 'block',
+                               'user' => $this->mUser->getName(),
+                               'reason' => 'Some reason',
+                               'partial' => true,
+                               'pagerestrictions' => 'One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten|Eleven',
+                               'token' => $tokens['blocktoken'],
+                       ],
+                       null,
+                       false,
+                       self::$users['sysop']->getUser()
+               );
+       }
 }
diff --git a/tests/phpunit/includes/api/ApiQueryBlocksTest.php b/tests/phpunit/includes/api/ApiQueryBlocksTest.php
new file mode 100644 (file)
index 0000000..dc7d450
--- /dev/null
@@ -0,0 +1,157 @@
+<?php
+
+use MediaWiki\Block\Restriction\PageRestriction;
+
+/**
+ * @group API
+ * @group Database
+ * @group medium
+ *
+ * @covers ApiQueryBlocks
+ */
+class ApiQueryBlocksTest extends ApiTestCase {
+
+       protected $tablesUsed = [
+               'ipblocks',
+               'ipblocks_restrictions',
+       ];
+
+       public function testExecute() {
+               list( $data ) = $this->doApiRequest( [
+                       'action' => 'query',
+                       'list' => 'blocks',
+               ] );
+               $this->assertEquals( [ 'batchcomplete' => true, 'query' => [ 'blocks' => [] ] ], $data );
+       }
+
+       public function testExecuteBlock() {
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+
+               $block = new Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'expiry' => 'infinity',
+               ] );
+
+               $block->insert();
+
+               list( $data ) = $this->doApiRequest( [
+                       'action' => 'query',
+                       'list' => 'blocks',
+               ] );
+               $this->arrayHasKey( 'query', $data );
+               $this->arrayHasKey( 'blocks', $data['query'] );
+               $this->assertCount( 1, $data['query']['blocks'] );
+               $subset = [
+                       'id' => $block->getId(),
+                       'user' => $badActor->getName(),
+                       'expiry' => $block->getExpiry(),
+               ];
+               $this->assertArraySubset( $subset, $data['query']['blocks'][0] );
+       }
+
+       public function testExecuteSitewide() {
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+
+               $block = new Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'ipb_expiry' => 'infinity',
+                       'ipb_sitewide' => 1,
+               ] );
+
+               $block->insert();
+
+               list( $data ) = $this->doApiRequest( [
+                       'action' => 'query',
+                       'list' => 'blocks',
+               ] );
+               $this->arrayHasKey( 'query', $data );
+               $this->arrayHasKey( 'blocks', $data['query'] );
+               $this->assertCount( 1, $data['query']['blocks'] );
+               $subset = [
+                       'id' => $block->getId(),
+                       'user' => $badActor->getName(),
+                       'expiry' => $block->getExpiry(),
+                       'partial' => !$block->isSitewide(),
+               ];
+               $this->assertArraySubset( $subset, $data['query']['blocks'][0] );
+       }
+
+       public function testExecuteRestrictions() {
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+
+               $block = new Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'expiry' => 'infinity',
+                       'sitewide' => 0,
+               ] );
+
+               $block->insert();
+
+               $subset = [
+                       'id' => $block->getId(),
+                       'user' => $badActor->getName(),
+                       'expiry' => $block->getExpiry(),
+               ];
+
+               $title = 'Lady Macbeth';
+               $pageData = $this->insertPage( $title );
+               $pageId = $pageData['id'];
+
+               $this->db->insert( 'ipblocks_restrictions', [
+                       'ir_ipb_id' => $block->getId(),
+                       'ir_type' => PageRestriction::TYPE_ID,
+                       'ir_value' => $pageId,
+               ] );
+               $this->db->insert( 'ipblocks_restrictions', [
+                       'ir_ipb_id' => $block->getId(),
+                       'ir_type' => 2,
+                       'ir_value' => 3,
+               ] );
+
+               // Test without requesting restrictions.
+               list( $data ) = $this->doApiRequest( [
+                       'action' => 'query',
+                       'list' => 'blocks',
+               ] );
+               $this->arrayHasKey( 'query', $data );
+               $this->arrayHasKey( 'blocks', $data['query'] );
+               $this->assertCount( 1, $data['query']['blocks'] );
+               $flagSubset = array_merge( $subset, [
+                       'partial' => !$block->isSitewide(),
+               ] );
+               $this->assertArraySubset( $flagSubset, $data['query']['blocks'][0] );
+               $this->assertArrayNotHasKey( 'restrictions', $data['query']['blocks'][0] );
+
+               // Test requesting the restrictions.
+               list( $data ) = $this->doApiRequest( [
+                       'action' => 'query',
+                       'list' => 'blocks',
+                       'bkprop' => 'id|user|expiry|restrictions'
+               ] );
+               $this->arrayHasKey( 'query', $data );
+               $this->arrayHasKey( 'blocks', $data['query'] );
+               $this->assertCount( 1, $data['query']['blocks'] );
+               $restrictionsSubset = array_merge( $subset, [
+                       'restrictions' => [
+                               'pages' => [
+                                       [
+                                               'id' => $pageId,
+                                               'ns' => 0,
+                                               'title' => $title,
+                                       ],
+                               ],
+                       ],
+               ] );
+               $this->assertArraySubset( $restrictionsSubset, $data['query']['blocks'][0] );
+               $this->assertArrayNotHasKey( 'partial', $data['query']['blocks'][0] );
+       }
+}
index 80043da..3aaad48 100644 (file)
@@ -107,7 +107,7 @@ class ApiQueryInfoTest extends ApiTestCase {
                        'user' => $badActor->getId(),
                        'by' => $sysop->getId(),
                        'expiry' => 'infinity',
-                       'sitewide' => 0,
+                       'sitewide' => 1,
                        'enableAutoblock' => true,
                ] );
 
diff --git a/tests/phpunit/includes/api/ApiQueryUserInfoTest.php b/tests/phpunit/includes/api/ApiQueryUserInfoTest.php
new file mode 100644 (file)
index 0000000..7dcb75c
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @group medium
+ * @covers ApiQueryUserInfo
+ */
+class ApiQueryUserInfoTest extends ApiTestCase {
+       public function testGetBlockInfo() {
+               $apiQueryUserInfo = new ApiQueryUserInfo(
+                       new ApiQuery( new ApiMain( $this->apiContext ), 'userinfo' ),
+                       'userinfo'
+               );
+
+               $block = new Block();
+               $info = $apiQueryUserInfo->getBlockInfo( $block );
+               $subset = [
+                       'blockid' => null,
+                       'blockedby' => '',
+                       'blockedbyid' => 0,
+                       'blockreason' => '',
+                       'blockexpiry' => 'infinite',
+                       'blockpartial' => false,
+               ];
+               $this->assertArraySubset( $subset, $info );
+       }
+
+       public function testGetBlockInfoPartial() {
+               $apiQueryUserInfo = new ApiQueryUserInfo(
+                       new ApiQuery( new ApiMain( $this->apiContext ), 'userinfo' ),
+                       'userinfo'
+               );
+
+               $block = new Block( [
+                       'sitewide' => false,
+               ] );
+               $info = $apiQueryUserInfo->getBlockInfo( $block );
+               $subset = [
+                       'blockid' => null,
+                       'blockedby' => '',
+                       'blockedbyid' => 0,
+                       'blockreason' => '',
+                       'blockexpiry' => 'infinite',
+                       'blockpartial' => true,
+               ];
+               $this->assertArraySubset( $subset, $info );
+       }
+}
diff --git a/tests/phpunit/includes/block/BlockRestrictionTest.php b/tests/phpunit/includes/block/BlockRestrictionTest.php
new file mode 100644 (file)
index 0000000..7889f36
--- /dev/null
@@ -0,0 +1,556 @@
+<?php
+
+namespace MediaWiki\Tests\Block;
+
+use MediaWiki\Block\BlockRestriction;
+use MediaWiki\Block\Restriction\PageRestriction;
+use MediaWiki\Block\Restriction\Restriction;
+
+/**
+ * @group Database
+ * @group Blocking
+ * @coversDefaultClass \MediaWiki\Block\BlockRestriction
+ */
+class BlockRestrictionTest extends \MediaWikiLangTestCase {
+
+       public function tearDown() {
+               parent::tearDown();
+               $this->resetTables();
+       }
+
+       /**
+        * @covers ::loadByBlockId
+        * @covers ::resultToRestrictions
+        * @covers ::rowToRestriction
+        */
+       public function testLoadMultipleRestrictions() {
+               $block = $this->insertBlock();
+
+               $pageFoo = $this->getExistingTestPage( 'Foo' );
+               $pageBar = $this->getExistingTestPage( 'Bar' );
+
+               BlockRestriction::insert( [
+                               new PageRestriction( $block->getId(), $pageFoo->getId() ),
+                               new PageRestriction( $block->getId(), $pageBar->getId() ),
+               ] );
+
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+
+               $this->assertCount( 2, $restrictions );
+       }
+
+       /**
+        * @covers ::loadByBlockId
+        * @covers ::resultToRestrictions
+        * @covers ::rowToRestriction
+        */
+       public function testWithNoRestrictions() {
+               $block = $this->insertBlock();
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertEmpty( $restrictions );
+       }
+
+       /**
+        * @covers ::loadByBlockId
+        * @covers ::resultToRestrictions
+        * @covers ::rowToRestriction
+        */
+       public function testWithEmptyParam() {
+               $restrictions = BlockRestriction::loadByBlockId( [] );
+
+               $this->assertEmpty( $restrictions );
+       }
+
+       /**
+        * @covers ::loadByBlockId
+        * @covers ::resultToRestrictions
+        * @covers ::rowToRestriction
+        */
+       public function testIgnoreNotSupportedTypes() {
+               $block = $this->insertBlock();
+
+               $pageFoo = $this->getExistingTestPage( 'Foo' );
+               $pageBar = $this->getExistingTestPage( 'Bar' );
+
+               // valid type
+               $this->insertRestriction( $block->getId(), PageRestriction::TYPE_ID, $pageFoo->getId() );
+
+               // invalid type
+               $this->insertRestriction( $block->getId(), 9, $pageBar->getId() );
+
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+       }
+
+       /**
+        * @covers ::loadByBlockId
+        * @covers ::resultToRestrictions
+        * @covers ::rowToRestriction
+        */
+       public function testMappingRestrictionObject() {
+               $block = $this->insertBlock();
+               $title = 'Lady Macbeth';
+               $page = $this->getExistingTestPage( $title );
+
+               BlockRestriction::insert( [
+                               new PageRestriction( $block->getId(), $page->getId() ),
+               ] );
+
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+
+               list( $pageRestriction ) = $restrictions;
+               $this->assertInstanceOf( PageRestriction::class, $pageRestriction );
+               $this->assertEquals( $block->getId(), $pageRestriction->getBlockId() );
+               $this->assertEquals( $page->getId(), $pageRestriction->getValue() );
+               $this->assertEquals( $pageRestriction->getType(), PageRestriction::TYPE );
+               $this->assertEquals( $pageRestriction->getTitle()->getText(), $title );
+       }
+
+       /**
+        * @covers ::insert
+        */
+       public function testInsert() {
+               $block = $this->insertBlock();
+
+               $pageFoo = $this->getExistingTestPage( 'Foo' );
+               $pageBar = $this->getExistingTestPage( 'Bar' );
+
+               $restrictions = [
+                       new \stdClass(),
+                       new PageRestriction( $block->getId(), $pageFoo->getId() ),
+                       new PageRestriction( $block->getId(), $pageBar->getId() ),
+               ];
+
+               $result = BlockRestriction::insert( $restrictions );
+               $this->assertTrue( $result );
+
+               $restrictions = [
+                       new \stdClass(),
+               ];
+
+               $result = BlockRestriction::insert( $restrictions );
+               $this->assertFalse( $result );
+
+               $result = BlockRestriction::insert( [] );
+               $this->assertFalse( $result );
+       }
+
+       /**
+        * @covers ::insert
+        */
+       public function testInsertTypes() {
+               $block = $this->insertBlock();
+
+               $pageFoo = $this->getExistingTestPage( 'Foo' );
+               $pageBar = $this->getExistingTestPage( 'Bar' );
+
+               $namespace = $this->createMock( Restriction::class );
+               $namespace->method( 'toRow' )
+                       ->willReturn( [
+                               'ir_ipb_id' => $block->getId(),
+                               'ir_type' => 2,
+                               'ir_value' => 0,
+                       ] );
+
+               $invalid = $this->createMock( Restriction::class );
+               $invalid->method( 'toRow' )
+                       ->willReturn( [
+                               'ir_ipb_id' => $block->getId(),
+                               'ir_type' => 9,
+                               'ir_value' => 42,
+                       ] );
+
+               $restrictions = [
+                       new \stdClass(),
+                       new PageRestriction( $block->getId(), $pageFoo->getId() ),
+                       new PageRestriction( $block->getId(), $pageBar->getId() ),
+                       $namespace,
+                       $invalid,
+               ];
+
+               $result = BlockRestriction::insert( $restrictions );
+               $this->assertTrue( $result );
+
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 2, $restrictions );
+       }
+
+       /**
+        * @covers ::update
+        * @covers ::restrictionsByBlockId
+        * @covers ::restrictionsToRemove
+        */
+       public function testUpdateInsert() {
+               $block = $this->insertBlock();
+               $pageFoo = $this->getExistingTestPage( 'Foo' );
+               $pageBar = $this->getExistingTestPage( 'Bar' );
+               BlockRestriction::insert( [
+                               new PageRestriction( $block->getId(), $pageFoo->getId() ),
+               ] );
+
+               BlockRestriction::update( [
+                       new \stdClass(),
+                       new PageRestriction( $block->getId(), $pageBar->getId() ),
+               ] );
+
+               $db = wfGetDb( DB_REPLICA );
+               $result = $db->select(
+                       [ 'ipblocks_restrictions' ],
+                       [ '*' ],
+                       [ 'ir_ipb_id' => $block->getId() ]
+               );
+
+               $this->assertEquals( 1, $result->numRows() );
+               $row = $result->fetchObject();
+               $this->assertEquals( $block->getId(), $row->ir_ipb_id );
+               $this->assertEquals( $pageBar->getId(), $row->ir_value );
+       }
+
+       /**
+        * @covers ::update
+        * @covers ::restrictionsByBlockId
+        * @covers ::restrictionsToRemove
+        */
+       public function testUpdateChange() {
+               $block = $this->insertBlock();
+               $page = $this->getExistingTestPage( 'Foo' );
+
+               BlockRestriction::update( [
+                       new PageRestriction( $block->getId(), $page->getId() ),
+               ] );
+
+               $db = wfGetDb( DB_REPLICA );
+               $result = $db->select(
+                       [ 'ipblocks_restrictions' ],
+                       [ '*' ],
+                       [ 'ir_ipb_id' => $block->getId() ]
+               );
+
+               $this->assertEquals( 1, $result->numRows() );
+               $row = $result->fetchObject();
+               $this->assertEquals( $block->getId(), $row->ir_ipb_id );
+               $this->assertEquals( $page->getId(), $row->ir_value );
+       }
+
+       /**
+        * @covers ::update
+        * @covers ::restrictionsByBlockId
+        * @covers ::restrictionsToRemove
+        */
+       public function testUpdateNoRestrictions() {
+               $block = $this->insertBlock();
+
+               BlockRestriction::update( [] );
+
+               $db = wfGetDb( DB_REPLICA );
+               $result = $db->select(
+                       [ 'ipblocks_restrictions' ],
+                       [ '*' ],
+                       [ 'ir_ipb_id' => $block->getId() ]
+               );
+
+               $this->assertEquals( 0, $result->numRows() );
+       }
+
+       /**
+        * @covers ::update
+        * @covers ::restrictionsByBlockId
+        * @covers ::restrictionsToRemove
+        */
+       public function testUpdateSame() {
+               $block = $this->insertBlock();
+               $page = $this->getExistingTestPage( 'Foo' );
+               BlockRestriction::insert( [
+                               new PageRestriction( $block->getId(), $page->getId() ),
+               ] );
+
+               BlockRestriction::update( [
+                       new PageRestriction( $block->getId(), $page->getId() ),
+               ] );
+
+               $db = wfGetDb( DB_REPLICA );
+               $result = $db->select(
+                       [ 'ipblocks_restrictions' ],
+                       [ '*' ],
+                       [ 'ir_ipb_id' => $block->getId() ]
+               );
+
+               $this->assertEquals( 1, $result->numRows() );
+               $row = $result->fetchObject();
+               $this->assertEquals( $block->getId(), $row->ir_ipb_id );
+               $this->assertEquals( $page->getId(), $row->ir_value );
+       }
+
+       /**
+        * @covers ::updateByParentBlockId
+        */
+       public function testDeleteAllUpdateByParentBlockId() {
+               // Create a block and an autoblock (a child block)
+               $block = $this->insertBlock();
+               $pageFoo = $this->getExistingTestPage( 'Foo' );
+               $pageBar = $this->getExistingTestPage( 'Bar' );
+               BlockRestriction::insert( [
+                       new PageRestriction( $block->getId(), $pageFoo->getId() ),
+               ] );
+               $autoblockId = $block->doAutoblock( '127.0.0.1' );
+
+               // Ensure that the restrictions on the block have not changed.
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+               $this->assertEquals( $pageFoo->getId(), $restrictions[0]->getValue() );
+
+               // Ensure that the restrictions on the autoblock are the same as the block.
+               $restrictions = BlockRestriction::loadByBlockId( $autoblockId );
+               $this->assertCount( 1, $restrictions );
+               $this->assertEquals( $pageFoo->getId(), $restrictions[0]->getValue() );
+
+               // Update the restrictions on the autoblock (but leave the block unchanged)
+               BlockRestriction::updateByParentBlockId( $block->getId(), [
+                       new PageRestriction( $block->getId(), $pageBar->getId() ),
+               ] );
+
+               // Ensure that the restrictions on the block have not changed.
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+               $this->assertEquals( $pageFoo->getId(), $restrictions[0]->getValue() );
+
+               // Ensure that the restrictions on the autoblock have been updated.
+               $restrictions = BlockRestriction::loadByBlockId( $autoblockId );
+               $this->assertCount( 1, $restrictions );
+               $this->assertEquals( $pageBar->getId(), $restrictions[0]->getValue() );
+       }
+
+       /**
+        * @covers ::updateByParentBlockId
+        */
+       public function testUpdateByParentBlockId() {
+               // Create a block and an autoblock (a child block)
+               $block = $this->insertBlock();
+               $page = $this->getExistingTestPage( 'Foo' );
+               BlockRestriction::insert( [
+                       new PageRestriction( $block->getId(), $page->getId() ),
+               ] );
+               $autoblockId = $block->doAutoblock( '127.0.0.1' );
+
+               // Ensure that the restrictions on the block have not changed.
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+
+               // Ensure that the restrictions on the autoblock have not changed.
+               $restrictions = BlockRestriction::loadByBlockId( $autoblockId );
+               $this->assertCount( 1, $restrictions );
+
+               // Remove the restrictions on the autoblock (but leave the block unchanged)
+               BlockRestriction::updateByParentBlockId( $block->getId(), [] );
+
+               // Ensure that the restrictions on the block have not changed.
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+
+               // Ensure that the restrictions on the autoblock have been updated.
+               $restrictions = BlockRestriction::loadByBlockId( $autoblockId );
+               $this->assertCount( 0, $restrictions );
+       }
+
+       /**
+        * @covers ::updateByParentBlockId
+        */
+       public function testNoAutoblocksUpdateByParentBlockId() {
+               // Create a block with no autoblock.
+               $block = $this->insertBlock();
+               $page = $this->getExistingTestPage( 'Foo' );
+               BlockRestriction::insert( [
+                       new PageRestriction( $block->getId(), $page->getId() ),
+               ] );
+
+               // Ensure that the restrictions on the block have not changed.
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+
+               // Update the restrictions on any autoblocks (there are none).
+               BlockRestriction::updateByParentBlockId( $block->getId(), $restrictions );
+
+               // Ensure that the restrictions on the block have not changed.
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+       }
+
+       /**
+        * @covers ::delete
+        */
+       public function testDelete() {
+               $block = $this->insertBlock();
+               $page = $this->getExistingTestPage( 'Foo' );
+               BlockRestriction::insert( [
+                       new PageRestriction( $block->getId(), $page->getId() ),
+               ] );
+
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+
+               $result = BlockRestriction::delete( array_merge( $restrictions, [ new \stdClass() ] ) );
+               $this->assertTrue( $result );
+
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 0, $restrictions );
+       }
+
+       /**
+        * @covers ::deleteByBlockId
+        */
+       public function testDeleteByBlockId() {
+               $block = $this->insertBlock();
+               $page = $this->getExistingTestPage( 'Foo' );
+               BlockRestriction::insert( [
+                       new PageRestriction( $block->getId(), $page->getId() ),
+               ] );
+
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+
+               $result = BlockRestriction::deleteByBlockId( $block->getId() );
+               $this->assertNotFalse( $result );
+
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 0, $restrictions );
+       }
+
+       /**
+        * @covers ::deleteByParentBlockId
+        */
+       public function testDeleteByParentBlockId() {
+               // Create a block with no autoblock.
+               $block = $this->insertBlock();
+               $page = $this->getExistingTestPage( 'Foo' );
+               BlockRestriction::insert( [
+                       new PageRestriction( $block->getId(), $page->getId() ),
+               ] );
+               $autoblockId = $block->doAutoblock( '127.0.0.1' );
+
+               // Ensure that the restrictions on the block have not changed.
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+
+               // Ensure that the restrictions on the autoblock are the same as the block.
+               $restrictions = BlockRestriction::loadByBlockId( $autoblockId );
+               $this->assertCount( 1, $restrictions );
+
+               // Remove all of the restrictions on the autoblock (but leave the block unchanged).
+               $result = BlockRestriction::deleteByParentBlockId( $block->getId() );
+               // NOTE: commented out until https://gerrit.wikimedia.org/r/c/mediawiki/core/+/469324 is merged
+               //$this->assertTrue( $result );
+
+               // Ensure that the restrictions on the block have not changed.
+               $restrictions = BlockRestriction::loadByBlockId( $block->getId() );
+               $this->assertCount( 1, $restrictions );
+
+               // Ensure that the restrictions on the autoblock have been removed.
+               $restrictions = BlockRestriction::loadByBlockId( $autoblockId );
+               $this->assertCount( 0, $restrictions );
+       }
+
+       /**
+        * @covers ::equals
+        * @dataProvider equalsDataProvider
+        *
+        * @param array $a
+        * @param array $b
+        * @param bool $expected
+        */
+       public function testEquals( array $a, array $b, $expected ) {
+               $this->assertSame( $expected, BlockRestriction::equals( $a, $b ) );
+       }
+
+       public function equalsDataProvider() {
+               return [
+                       [
+                               [
+                                       new \stdClass(),
+                                       new PageRestriction( 1, 1 ),
+                               ],
+                               [
+                                       new \stdClass(),
+                                       new PageRestriction( 1, 2 )
+                               ],
+                               false,
+                       ],
+                       [
+                               [
+                                       new PageRestriction( 1, 1 ),
+                               ],
+                               [
+                                       new PageRestriction( 1, 1 ),
+                                       new PageRestriction( 1, 2 )
+                               ],
+                               false,
+                       ],
+                       [
+                               [],
+                               [],
+                               true,
+                       ],
+                       [
+                               [
+                                       new PageRestriction( 1, 1 ),
+                                       new PageRestriction( 1, 2 ),
+                                       new PageRestriction( 2, 3 ),
+                               ],
+                               [
+                                       new PageRestriction( 2, 3 ),
+                                       new PageRestriction( 1, 2 ),
+                                       new PageRestriction( 1, 1 ),
+                               ],
+                               true
+                       ],
+               ];
+       }
+
+       /**
+        * @covers ::setBlockId
+        */
+       public function testSetBlockId() {
+               $restrictions = [
+                       new \stdClass(),
+                       new PageRestriction( 1, 1 ),
+                       new PageRestriction( 1, 2 ),
+               ];
+
+               $result = BlockRestriction::setBlockId( 2, $restrictions );
+
+               $this->assertSame( 1, $restrictions[1]->getBlockId() );
+               $this->assertSame( 1, $restrictions[2]->getBlockId() );
+               $this->assertSame( 2, $result[0]->getBlockId() );
+               $this->assertSame( 2, $result[1]->getBlockId() );
+       }
+
+       protected function insertBlock() {
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+
+               $block = new \Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'expiry' => 'infinity',
+                       'sitewide' => 0,
+                       'enableAutoblock' => true,
+               ] );
+
+               $block->insert();
+
+               return $block;
+       }
+
+       protected function insertRestriction( $blockId, $type, $value ) {
+               $this->db->insert( 'ipblocks_restrictions', [
+                       'ir_ipb_id' => $blockId,
+                       'ir_type' => $type,
+                       'ir_value' => $value,
+               ] );
+       }
+
+       protected function resetTables() {
+               $this->db->delete( 'ipblocks', '*', __METHOD__ );
+               $this->db->delete( 'ipblocks_restrictions', '*', __METHOD__ );
+       }
+}
diff --git a/tests/phpunit/includes/block/Restriction/PageRestrictionTest.php b/tests/phpunit/includes/block/Restriction/PageRestrictionTest.php
new file mode 100644 (file)
index 0000000..95cb3b7
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+namespace MediaWiki\Tests\Block\Restriction;
+
+use MediaWiki\Block\Restriction\PageRestriction;
+
+/**
+ * @group Database
+ * @group Blocking
+ * @covers \MediaWiki\Block\Restriction\AbstractRestriction
+ * @covers \MediaWiki\Block\Restriction\PageRestriction
+ */
+class PageRestrictionTest extends RestrictionTestCase {
+
+       public function testMatches() {
+               $class = $this->getClass();
+               $page = $this->getExistingTestPage( 'Saturn' );
+               $restriction = new $class( 1, $page->getId() );
+               $this->assertTrue( $restriction->matches( $page->getTitle() ) );
+
+               $page = $this->getExistingTestPage( 'Mars' );
+               $this->assertFalse( $restriction->matches( $page->getTitle() ) );
+       }
+
+       public function testGetType() {
+               $class = $this->getClass();
+               $restriction = new $class( 1, 2 );
+               $this->assertEquals( 'page', $restriction->getType() );
+       }
+
+       public function testGetTitle() {
+               $class = $this->getClass();
+               $restriction = new $class( 1, 2 );
+               $title = \Title::newFromText( 'Pluto' );
+               $title->mArticleID = 2;
+               $restriction->setTitle( $title );
+               $this->assertSame( $title, $restriction->getTitle() );
+
+               $restriction = new $class( 1, 1 );
+               $title = \Title::newFromId( 1 );
+               $this->assertEquals( $title->getArticleId(), $restriction->getTitle()->getArticleId() );
+       }
+
+       public function testNewFromRow() {
+               $class = $this->getClass();
+               $restriction = $class::newFromRow( (object)[
+                       'ir_ipb_id' => 1,
+                       'ir_value' => 2,
+                       'page_namespace' => 0,
+                       'page_title' => 'Saturn',
+               ] );
+
+               $this->assertSame( 1, $restriction->getBlockId() );
+               $this->assertSame( 2, $restriction->getValue() );
+               $this->assertSame( 'Saturn', $restriction->getTitle()->getText() );
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       protected function getClass() {
+               return PageRestriction::class;
+       }
+}
diff --git a/tests/phpunit/includes/block/Restriction/RestrictionTestCase.php b/tests/phpunit/includes/block/Restriction/RestrictionTestCase.php
new file mode 100644 (file)
index 0000000..51e004c
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+
+namespace MediaWiki\Tests\Block\Restriction;
+
+/**
+ * @group Blocking
+ */
+abstract class RestrictionTestCase extends \MediaWikiTestCase {
+       public function testConstruct() {
+               $class = $this->getClass();
+               $restriction = new $class( 1, 2 );
+
+               $this->assertSame( $restriction->getBlockId(), 1 );
+               $this->assertSame( $restriction->getValue(), 2 );
+       }
+
+       public function testSetBlockId() {
+               $class = $this->getClass();
+               $restriction = new $class( 1, 2 );
+
+               $restriction->setBlockId( 10 );
+               $this->assertSame( $restriction->getBlockId(), 10 );
+       }
+
+       public function testEquals() {
+               $class = $this->getClass();
+
+               // Test two restrictions with the same data.
+               $restriction = new $class( 1, 2 );
+               $second = new $class( 1, 2 );
+               $this->assertTrue( $restriction->equals( $second ) );
+
+               // Test two restrictions that implement different classes.
+               $second = $this->createMock( $this->getClass() );
+               $this->assertFalse( $restriction->equals( $second ) );
+
+               // Not the same block id.
+               $second = new $class( 2, 2 );
+               $this->assertTrue( $restriction->equals( $second ) );
+
+               // Not the same value.
+               $second = new $class( 1, 3 );
+               $this->assertFalse( $restriction->equals( $second ) );
+       }
+
+       public function testNewFromRow() {
+               $class = $this->getClass();
+
+               $restriction = $class::newFromRow( (object)[
+                       'ir_ipb_id' => 1,
+                       'ir_value' => 2,
+               ] );
+
+               $this->assertSame( 1, $restriction->getBlockId() );
+               $this->assertSame( 2, $restriction->getValue() );
+       }
+
+       public function testToRow() {
+               $class = $this->getClass();
+
+               $restriction = new $class( 1, 2 );
+               $row = $restriction->toRow();
+
+               $this->assertSame( 1, $row['ir_ipb_id'] );
+               $this->assertSame( 2, $row['ir_value'] );
+       }
+
+       /**
+        * Get the class name of the class that is being tested.
+        *
+        * @return string
+        */
+       abstract protected function getClass();
+}
index 03671ac..85ccebc 100644 (file)
@@ -376,4 +376,77 @@ class BlockLogFormatterTest extends LogFormatterTestCase {
        public function testSuppressReblockLogDatabaseRows( $row, $extra ) {
                $this->doTestLogFormatter( $row, $extra );
        }
+
+       public function providePartialBlockLogDatabaseRows() {
+               return [
+                       [
+                               [
+                                       'type' => 'block',
+                                       'action' => 'block',
+                                       'comment' => 'Block comment',
+                                       'user' => 0,
+                                       'user_text' => 'Sysop',
+                                       'namespace' => NS_USER,
+                                       'title' => 'Logtestuser',
+                                       'params' => [
+                                               '5::duration' => 'infinite',
+                                               '6::flags' => 'anononly',
+                                               '7::restrictions' => [ 'pages' => [ 'User:Test1', 'Main Page' ] ],
+                                               'sitewide' => false,
+                                       ],
+                               ],
+                               [
+                                       'text' => 'Sysop blocked Logtestuser from editing the pages User:Test1 and Main Page'
+                                               . ' with an expiration time of indefinite (anonymous users only)',
+                                       'api' => [
+                                               'duration' => 'infinite',
+                                               'flags' => [ 'anononly' ],
+                                               'restrictions' => [ 'pages' => [
+                                                               [
+                                                                       'page_ns' => 2,
+                                                                       'page_title' => 'User:Test1',
+                                                               ], [
+                                                                       'page_ns' => 0,
+                                                                       'page_title' => 'Main Page',
+                                                               ],
+                                                       ],
+                                               ],
+                                               'sitewide' => false,
+                                       ],
+                               ],
+                       ],
+                       [
+                               [
+                                       'type' => 'block',
+                                       'action' => 'block',
+                                       'comment' => 'Block comment',
+                                       'user' => 0,
+                                       'user_text' => 'Sysop',
+                                       'namespace' => NS_USER,
+                                       'title' => 'Logtestuser',
+                                       'params' => [
+                                               '5::duration' => 'infinite',
+                                               '6::flags' => 'anononly',
+                                               'sitewide' => false,
+                                       ],
+                               ],
+                               [
+                                       'text' => 'Sysop blocked Logtestuser from non-editing actions'
+                                               . ' with an expiration time of indefinite (anonymous users only)',
+                                       'api' => [
+                                               'duration' => 'infinite',
+                                               'flags' => [ 'anononly' ],
+                                               'sitewide' => false,
+                                       ],
+                               ],
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider providePartialBlockLogDatabaseRows
+        */
+       public function testPartialBlockLogDatabaseRows( $row, $extra ) {
+               $this->doTestLogFormatter( $row, $extra );
+       }
 }
diff --git a/tests/phpunit/includes/specials/SpecialBlockTest.php b/tests/phpunit/includes/specials/SpecialBlockTest.php
new file mode 100644 (file)
index 0000000..080c6e4
--- /dev/null
@@ -0,0 +1,405 @@
+<?php
+
+use MediaWiki\Block\BlockRestriction;
+use MediaWiki\Block\Restriction\PageRestriction;
+use Wikimedia\TestingAccessWrapper;
+
+/**
+ * @group Blocking
+ * @group Database
+ * @coversDefaultClass SpecialBlock
+ */
+class SpecialBlockTest extends SpecialPageTestBase {
+       /**
+        * {@inheritdoc}
+        */
+       protected function newSpecialPage() {
+               return new SpecialBlock();
+       }
+
+       public function tearDown() {
+               parent::tearDown();
+               $this->resetTables();
+       }
+
+       /**
+        * @covers ::getFormFields()
+        */
+       public function testGetFormFields() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => false,
+               ] );
+               $page = $this->newSpecialPage();
+               $wrappedPage = TestingAccessWrapper::newFromObject( $page );
+               $fields = $wrappedPage->getFormFields();
+               $this->assertInternalType( 'array', $fields );
+               $this->assertArrayHasKey( 'Target', $fields );
+               $this->assertArrayHasKey( 'Expiry', $fields );
+               $this->assertArrayHasKey( 'Reason', $fields );
+               $this->assertArrayHasKey( 'CreateAccount', $fields );
+               $this->assertArrayHasKey( 'DisableUTEdit', $fields );
+               $this->assertArrayHasKey( 'DisableUTEdit', $fields );
+               $this->assertArrayHasKey( 'AutoBlock', $fields );
+               $this->assertArrayHasKey( 'HardBlock', $fields );
+               $this->assertArrayHasKey( 'PreviousTarget', $fields );
+               $this->assertArrayHasKey( 'Confirm', $fields );
+
+               $this->assertArrayNotHasKey( 'EditingRestriction', $fields );
+               $this->assertArrayNotHasKey( 'PageRestrictions', $fields );
+       }
+
+       /**
+        * @covers ::getFormFields()
+        */
+       public function testGetFormFieldsPartialBlocks() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => true,
+               ] );
+               $page = $this->newSpecialPage();
+               $wrappedPage = TestingAccessWrapper::newFromObject( $page );
+               $fields = $wrappedPage->getFormFields();
+
+               $this->assertArrayHasKey( 'EditingRestriction', $fields );
+               $this->assertArrayHasKey( 'PageRestrictions', $fields );
+       }
+
+       /**
+        * @covers ::maybeAlterFormDefaults()
+        */
+       public function testMaybeAlterFormDefaults() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => false,
+               ] );
+
+               $block = $this->insertBlock();
+
+               // Refresh the block from the database.
+               $block = Block::newFromTarget( $block->getTarget() );
+
+               $page = $this->newSpecialPage();
+
+               $wrappedPage = TestingAccessWrapper::newFromObject( $page );
+               $wrappedPage->target = $block->getTarget();
+               $fields = $wrappedPage->getFormFields();
+
+               $this->assertSame( (string)$block->getTarget(), $fields['Target']['default'] );
+               $this->assertSame( $block->isHardblock(), $fields['HardBlock']['default'] );
+               $this->assertSame( $block->prevents( 'createaccount' ), $fields['CreateAccount']['default'] );
+               $this->assertSame( $block->isAutoblocking(), $fields['AutoBlock']['default'] );
+               $this->assertSame( $block->prevents( 'editownusertalk' ), $fields['DisableUTEdit']['default'] );
+               $this->assertSame( $block->mReason, $fields['Reason']['default'] );
+               $this->assertSame( 'infinite', $fields['Expiry']['default'] );
+       }
+
+       /**
+        * @covers ::maybeAlterFormDefaults()
+        */
+       public function testMaybeAlterFormDefaultsPartial() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => true,
+               ] );
+
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+               $pageSaturn = $this->getExistingTestPage( 'Saturn' );
+               $pageMars = $this->getExistingTestPage( 'Mars' );
+
+               $block = new \Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'expiry' => 'infinity',
+                       'sitewide' => 0,
+                       'enableAutoblock' => true,
+               ] );
+
+               $block->setRestrictions( [
+                       new PageRestriction( 0, $pageSaturn->getId() ),
+                       new PageRestriction( 0, $pageMars->getId() ),
+               ] );
+
+               $block->insert();
+
+               // Refresh the block from the database.
+               $block = Block::newFromTarget( $block->getTarget() );
+
+               $page = $this->newSpecialPage();
+
+               $wrappedPage = TestingAccessWrapper::newFromObject( $page );
+               $wrappedPage->target = $block->getTarget();
+               $fields = $wrappedPage->getFormFields();
+
+               $titles = [
+                       $pageMars->getTitle()->getPrefixedText(),
+                       $pageSaturn->getTitle()->getPrefixedText(),
+               ];
+
+               $this->assertSame( (string)$block->getTarget(), $fields['Target']['default'] );
+               $this->assertSame( 'partial', $fields['EditingRestriction']['default'] );
+               $this->assertSame( implode( "\n", $titles ), $fields['PageRestrictions']['default'] );
+       }
+
+       /**
+        * @covers ::processForm()
+        */
+       public function testProcessForm() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => false,
+               ] );
+               $badActor = $this->getTestUser()->getUser();
+               $context = RequestContext::getMain();
+
+               $page = $this->newSpecialPage();
+               $reason = 'test';
+               $expiry = 'infinity';
+               $data = [
+                       'Target' => (string)$badActor,
+                       'Expiry' => 'infinity',
+                       'Reason' => [
+                               $reason,
+                       ],
+                       'Confirm' => '1',
+                       'CreateAccount' => '0',
+                       'DisableUTEdit' => '0',
+                       'DisableEmail' => '0',
+                       'HardBlock' => '0',
+                       'AutoBlock' => '1',
+                       'HideUser' => '0',
+                       'Watch' => '0',
+               ];
+               $result = $page->processForm( $data, $context );
+
+               $this->assertTrue( $result );
+
+               $block = Block::newFromTarget( $badActor );
+               $this->assertSame( $reason, $block->mReason );
+               $this->assertSame( $expiry, $block->getExpiry() );
+       }
+
+       /**
+        * @covers ::processForm()
+        */
+       public function testProcessFormExisting() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => false,
+               ] );
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+               $context = RequestContext::getMain();
+
+               // Create a block that will be updated.
+               $block = new \Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'expiry' => 'infinity',
+                       'sitewide' => 0,
+                       'enableAutoblock' => false,
+               ] );
+               $block->insert();
+
+               $page = $this->newSpecialPage();
+               $reason = 'test';
+               $expiry = 'infinity';
+               $data = [
+                       'Target' => (string)$badActor,
+                       'Expiry' => 'infinity',
+                       'Reason' => [
+                               $reason,
+                       ],
+                       'Confirm' => '1',
+                       'CreateAccount' => '0',
+                       'DisableUTEdit' => '0',
+                       'DisableEmail' => '0',
+                       'HardBlock' => '0',
+                       'AutoBlock' => '1',
+                       'HideUser' => '0',
+                       'Watch' => '0',
+               ];
+               $result = $page->processForm( $data, $context );
+
+               $this->assertTrue( $result );
+
+               $block = Block::newFromTarget( $badActor );
+               $this->assertSame( $reason, $block->mReason );
+               $this->assertSame( $expiry, $block->getExpiry() );
+               $this->assertSame( '1', $block->isAutoblocking() );
+       }
+
+       /**
+        * @covers ::processForm()
+        */
+       public function testProcessFormRestictions() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => true,
+               ] );
+               $badActor = $this->getTestUser()->getUser();
+               $context = RequestContext::getMain();
+
+               $pageSaturn = $this->getExistingTestPage( 'Saturn' );
+               $pageMars = $this->getExistingTestPage( 'Mars' );
+
+               $titles = [
+                       $pageSaturn->getTitle()->getText(),
+                       $pageMars->getTitle()->getText(),
+               ];
+
+               $page = $this->newSpecialPage();
+               $reason = 'test';
+               $expiry = 'infinity';
+               $data = [
+                       'Target' => (string)$badActor,
+                       'Expiry' => 'infinity',
+                       'Reason' => [
+                               $reason,
+                       ],
+                       'Confirm' => '1',
+                       'CreateAccount' => '0',
+                       'DisableUTEdit' => '0',
+                       'DisableEmail' => '0',
+                       'HardBlock' => '0',
+                       'AutoBlock' => '1',
+                       'HideUser' => '0',
+                       'Watch' => '0',
+                       'EditingRestriction' => 'partial',
+                       'PageRestrictions' => implode( "\n", $titles ),
+               ];
+               $result = $page->processForm( $data, $context );
+
+               $this->assertTrue( $result );
+
+               $block = Block::newFromTarget( $badActor );
+               $this->assertSame( $reason, $block->mReason );
+               $this->assertSame( $expiry, $block->getExpiry() );
+               $this->assertCount( 2, $block->getRestrictions() );
+               $this->assertTrue( BlockRestriction::equals( $block->getRestrictions(), [
+                       new PageRestriction( $block->getId(), $pageMars->getId() ),
+                       new PageRestriction( $block->getId(), $pageSaturn->getId() ),
+               ] ) );
+       }
+
+       /**
+        * @covers ::processForm()
+        */
+       public function testProcessFormRestrictionsChange() {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => true,
+               ] );
+               $badActor = $this->getTestUser()->getUser();
+               $context = RequestContext::getMain();
+
+               $pageSaturn = $this->getExistingTestPage( 'Saturn' );
+               $pageMars = $this->getExistingTestPage( 'Mars' );
+
+               $titles = [
+                       $pageSaturn->getTitle()->getText(),
+                       $pageMars->getTitle()->getText(),
+               ];
+
+               // Create a partial block.
+               $page = $this->newSpecialPage();
+               $reason = 'test';
+               $expiry = 'infinity';
+               $data = [
+                       'Target' => (string)$badActor,
+                       'Expiry' => 'infinity',
+                       'Reason' => [
+                               $reason,
+                       ],
+                       'Confirm' => '1',
+                       'CreateAccount' => '0',
+                       'DisableUTEdit' => '0',
+                       'DisableEmail' => '0',
+                       'HardBlock' => '0',
+                       'AutoBlock' => '1',
+                       'HideUser' => '0',
+                       'Watch' => '0',
+                       'EditingRestriction' => 'partial',
+                       'PageRestrictions' => implode( "\n", $titles ),
+               ];
+               $result = $page->processForm( $data, $context );
+
+               $this->assertTrue( $result );
+
+               $block = Block::newFromTarget( $badActor );
+               $this->assertSame( $reason, $block->mReason );
+               $this->assertSame( $expiry, $block->getExpiry() );
+               $this->assertFalse( $block->isSitewide() );
+               $this->assertCount( 2, $block->getRestrictions() );
+               $this->assertTrue( BlockRestriction::equals( $block->getRestrictions(), [
+                       new PageRestriction( $block->getId(), $pageMars->getId() ),
+                       new PageRestriction( $block->getId(), $pageSaturn->getId() ),
+               ] ) );
+
+               // Remove a page from the partial block.
+               $data['PageRestrictions'] = $pageMars->getTitle()->getText();
+               $result = $page->processForm( $data, $context );
+
+               $this->assertTrue( $result );
+
+               $block = Block::newFromTarget( $badActor );
+               $this->assertSame( $reason, $block->mReason );
+               $this->assertSame( $expiry, $block->getExpiry() );
+               $this->assertFalse( $block->isSitewide() );
+               $this->assertCount( 1, $block->getRestrictions() );
+               $this->assertTrue( BlockRestriction::equals( $block->getRestrictions(), [
+                       new PageRestriction( $block->getId(), $pageMars->getId() ),
+               ] ) );
+
+               // Remove the last page from the block.
+               $data['PageRestrictions'] = '';
+               $result = $page->processForm( $data, $context );
+
+               $this->assertTrue( $result );
+
+               $block = Block::newFromTarget( $badActor );
+               $this->assertSame( $reason, $block->mReason );
+               $this->assertSame( $expiry, $block->getExpiry() );
+               $this->assertFalse( $block->isSitewide() );
+               $this->assertCount( 0, $block->getRestrictions() );
+
+               // Change to sitewide.
+               $data['EditingRestriction'] = 'sitewide';
+               $result = $page->processForm( $data, $context );
+
+               $this->assertTrue( $result );
+
+               $block = Block::newFromTarget( $badActor );
+               $this->assertSame( $reason, $block->mReason );
+               $this->assertSame( $expiry, $block->getExpiry() );
+               $this->assertTrue( $block->isSitewide() );
+               $this->assertCount( 0, $block->getRestrictions() );
+
+               // Ensure that there are no restrictions where the blockId is 0.
+               $count = $this->db->selectRowCount(
+                       'ipblocks_restrictions',
+                       '*',
+                       [ 'ir_ipb_id' => 0 ],
+                       __METHOD__
+               );
+               $this->assertSame( 0, $count );
+       }
+
+       protected function insertBlock() {
+               $badActor = $this->getTestUser()->getUser();
+               $sysop = $this->getTestSysop()->getUser();
+
+               $block = new \Block( [
+                       'address' => $badActor->getName(),
+                       'user' => $badActor->getId(),
+                       'by' => $sysop->getId(),
+                       'expiry' => 'infinity',
+                       'sitewide' => 1,
+                       'enableAutoblock' => true,
+               ] );
+
+               $block->insert();
+
+               return $block;
+       }
+
+       protected function resetTables() {
+               $this->db->delete( 'ipblocks', '*', __METHOD__ );
+               $this->db->delete( 'ipblocks_restrictions', '*', __METHOD__ );
+       }
+}
diff --git a/tests/phpunit/includes/specials/pagers/BlockListPagerTest.php b/tests/phpunit/includes/specials/pagers/BlockListPagerTest.php
new file mode 100644 (file)
index 0000000..a05cbbd
--- /dev/null
@@ -0,0 +1,236 @@
+<?php
+
+use MediaWiki\Block\Restriction\PageRestriction;
+use MediaWiki\MediaWikiServices;
+use Wikimedia\TestingAccessWrapper;
+
+/**
+ * @group Database
+ * @coversDefaultClass BlockListPager
+ */
+class BlockListPagerTest extends MediaWikiTestCase {
+
+       /**
+        * @covers ::formatValue
+        * @dataProvider formatValueEmptyProvider
+        * @dataProvider formatValueDefaultProvider
+        * @param string $name
+        * @param string $value
+        * @param string $expected
+        */
+       public function testFormatValue( $name, $value, $expected, $row = null ) {
+               $this->setMwGlobals( [
+                       'wgEnablePartialBlocks' => false,
+               ] );
+               $row = $row ?: new stdClass;
+               $pager = new BlockListPager( new SpecialPage(),  [] );
+               $wrappedPager = TestingAccessWrapper::newFromObject( $pager );
+               $wrappedPager->mCurrentRow = $row;
+
+               $formatted = $pager->formatValue( $name, $value );
+               $this->assertEquals( $expected, $formatted );
+       }
+
+       /**
+        * Test empty values.
+        */
+       public function formatValueEmptyProvider() {
+               return [
+                       [
+                               'test',
+                               '',
+                               'Unable to format test',
+                       ],
+                       [
+                               'ipb_timestamp',
+                               wfTimestamp( TS_UNIX ),
+                               date( 'H:i, j F Y' ),
+                       ],
+                       [
+                               'ipb_expiry',
+                               '',
+                               'infinite<br />0 minutes left',
+                       ],
+               ];
+       }
+
+       /**
+        * Test the default row values.
+        */
+       public function formatValueDefaultProvider() {
+               $row = (object)[
+                       'ipb_user' => 0,
+                       'ipb_address' => '127.0.0.1',
+                       'ipb_by_text' => 'Admin',
+                       'ipb_create_account' => 1,
+                       'ipb_auto' => 0,
+                       'ipb_anon_only' => 0,
+                       'ipb_create_account' => 1,
+                       'ipb_enable_autoblock' => 1,
+                       'ipb_deleted' => 0,
+                       'ipb_block_email' => 0,
+                       'ipb_allow_usertalk' => 0,
+                       'ipb_sitewide' => 1,
+               ];
+
+               return [
+                       [
+                               'test',
+                               '',
+                               'Unable to format test',
+                               $row,
+                       ],
+                       [
+                               'ipb_timestamp',
+                               wfTimestamp( TS_UNIX ),
+                               date( 'H:i, j F Y' ),
+                               $row,
+                       ],
+                       [
+                               'ipb_expiry',
+                               '',
+                               'infinite<br />0 minutes left',
+                               $row,
+                       ],
+                       [
+                               'ipb_by',
+                               '',
+                               $row->ipb_by_text,
+                               $row,
+                       ],
+                       [
+                               'ipb_params',
+                               '',
+                               '<ul><li>account creation disabled</li><li>cannot edit own talk page</li></ul>',
+                               $row,
+                       ]
+               ];
+       }
+
+       /**
+        * @covers ::formatValue
+        */
+       public function testFormatValueRestrictions() {
+               $pager = new BlockListPager( new SpecialPage(),  [] );
+
+               $row = (object)[
+                       'ipb_id' => 0,
+                       'ipb_user' => 0,
+                       'ipb_anon_only' => 0,
+                       'ipb_enable_autoblock' => 0,
+                       'ipb_create_account' => 0,
+                       'ipb_block_email' => 0,
+                       'ipb_allow_usertalk' => 1,
+                       'ipb_sitewide' => 0,
+               ];
+               $wrappedPager = TestingAccessWrapper::newFromObject( $pager );
+               $wrappedPager->mCurrentRow = $row;
+
+               $pageName = 'Victor Frankenstein';
+               $page = $this->insertPage( $pageName );
+               $title = $page['title'];
+               $pageId = $page['id'];
+
+               $restrictions = [
+                       ( new PageRestriction( 0, $pageId ) )->setTitle( $title )
+               ];
+
+               $wrappedPager = TestingAccessWrapper::newFromObject( $pager );
+               $wrappedPager->restrictions = $restrictions;
+
+               $formatted = $pager->formatValue( 'ipb_params', '' );
+               $this->assertEquals( '<ul><li>'
+                       . wfMessage( 'blocklist-editing' )->text()
+                       . '<ul><li><a href="/index.php/'
+                       . $title->getDBKey()
+                       . '" title="'
+                       . $pageName
+                       . '">'
+                       . $pageName
+                       . '</a></li></ul></li></ul>',
+                       $formatted
+               );
+       }
+
+       /**
+        * @covers ::preprocessResults
+        */
+       public function testPreprocessResults() {
+               // Test the Link Cache.
+               $linkCache = MediaWikiServices::getInstance()->getLinkCache();
+               $wrappedlinkCache = TestingAccessWrapper::newFromObject( $linkCache );
+
+               $links = [
+                       'User:127.0.0.1',
+                       'User_talk:127.0.0.1',
+                       'User:Admin',
+                       'User_talk:Admin',
+               ];
+
+               foreach ( $links as $link ) {
+                       $this->assertNull( $wrappedlinkCache->badLinks->get( $link ) );
+               }
+
+               $row = (object)[
+                       'ipb_address' => '127.0.0.1',
+                       'by_user_name' => 'Admin',
+                       'ipb_sitewide' => 1,
+                       'ipb_timestamp' => $this->db->timestamp( wfTimestamp( TS_MW ) ),
+               ];
+               $pager = new BlockListPager( new SpecialPage(),  [] );
+               $pager->preprocessResults( [ $row ] );
+
+               foreach ( $links as $link ) {
+                       $this->assertSame( 1, $wrappedlinkCache->badLinks->get( $link ) );
+               }
+
+               // Test Sitewide Blocks.
+               $row = (object)[
+                       'ipb_address' => '127.0.0.1',
+                       'by_user_name' => 'Admin',
+                       'ipb_sitewide' => 1,
+               ];
+               $pager = new BlockListPager( new SpecialPage(),  [] );
+               $pager->preprocessResults( [ $row ] );
+
+               $this->assertObjectNotHasAttribute( 'ipb_restrictions', $row );
+
+               $pageName = 'Victor Frankenstein';
+               $page = $this->getExistingTestPage( 'Victor Frankenstein' );
+               $title = $page->getTitle();
+
+               $target = '127.0.0.1';
+
+               // Test Partial Blocks Blocks.
+               $block = new Block( [
+                       'address' => $target,
+                       'by' => $this->getTestSysop()->getUser()->getId(),
+                       'reason' => 'Parce que',
+                       'expiry' => $this->db->getInfinity(),
+                       'sitewide' => false,
+               ] );
+               $block->setRestrictions( [
+                       new PageRestriction( 0, $page->getId() ),
+               ] );
+               $block->insert();
+
+               $result = $this->db->select( 'ipblocks', [ '*' ], [ 'ipb_id' => $block->getId() ] );
+
+               $pager = new BlockListPager( new SpecialPage(),  [] );
+               $pager->preprocessResults( $result );
+
+               $wrappedPager = TestingAccessWrapper::newFromObject( $pager );
+
+               $restrictions = $wrappedPager->restrictions;
+               $this->assertInternalType( 'array', $restrictions );
+
+               $restriction = $restrictions[0];
+               $this->assertEquals( $page->getId(), $restriction->getValue() );
+               $this->assertEquals( $page->getId(), $restriction->getTitle()->getArticleId() );
+               $this->assertEquals( $title->getDBKey(), $restriction->getTitle()->getDBKey() );
+               $this->assertEquals( $title->getNamespace(), $restriction->getTitle()->getNamespace() );
+
+               // Delete the block and the restrictions.
+               $block->delete();
+       }
+}
index e828e3f..dca1363 100644 (file)
@@ -1878,6 +1878,19 @@ class LanguageTest extends LanguageClassesTestCase {
                ];
        }
 
+       /**
+        * @covers Language::hasVariant
+        */
+       public function testHasVariant() {
+               // See LanguageSrTest::testHasVariant() for additional tests
+               $en = Language::factory( 'en' );
+               $this->assertTrue( $en->hasVariant( 'en' ), 'base is always a variant' );
+               $this->assertFalse( $en->hasVariant( 'en-bogus' ), 'bogus en variant' );
+
+               $bogus = Language::factory( 'bogus' );
+               $this->assertTrue( $bogus->hasVariant( 'bogus' ), 'base is always a variant' );
+       }
+
        /**
         * @covers Language::equals
         */
index b846c56..c9f2f3e 100644 (file)
  * @covers SrConverter
  */
 class LanguageSrTest extends LanguageClassesTestCase {
+       /**
+        * @covers Language::hasVariants
+        */
+       public function testHasVariants() {
+               $this->assertTrue( $this->getLang()->hasVariants(), 'sr has variants' );
+       }
+
+       /**
+        * @covers Language::hasVariant
+        */
+       public function testHasVariant() {
+               $langs = [
+                       'sr' => $this->getLang(),
+                       'sr-ec' => Language::factory( 'sr-ec' ),
+                       'sr-cyrl' => Language::factory( 'sr-cyrl' ),
+               ];
+               foreach ( $langs as $code => $l ) {
+                       $p = $l->getParentLanguage();
+                       $this->assertTrue( $p !== null, 'parent language exists' );
+                       $this->assertEquals( 'sr', $p->getCode(), 'sr is parent language' );
+                       $this->assertTrue( $p instanceof LanguageSr, 'parent is LanguageSr' );
+                       // This is a valid variant of the base
+                       $this->assertTrue( $p->hasVariant( $l->getCode() ) );
+                       // This test should be tweaked if/when sr-ec is renamed (T117845)
+                       // to swap the roles of sr-ec and sr-Cyrl
+                       $this->assertTrue( $l->hasVariant( 'sr-ec' ), 'sr-ec exists' );
+                       // note that sr-cyrl is an alias, not a (strict) variant name
+                       foreach ( [ 'sr-EC', 'sr-Cyrl', 'sr-cyrl', 'sr-bogus' ] as $v ) {
+                               $this->assertFalse( $l->hasVariant( $v ), "$v is not a variant of $code" );
+                       }
+               }
+       }
+
+       /**
+        * @covers Language::hasVariant
+        */
+       public function testHasVariantBogus() {
+               $langs = [
+                       // Note that case matters when calling Language::factory();
+                       // these are all bogus language codes
+                       'sr-EC' => Language::factory( 'sr-EC' ),
+                       'sr-Cyrl' => Language::factory( 'sr-Cyrl' ),
+                       'sr-bogus' => Language::factory( 'sr-bogus' ),
+               ];
+               foreach ( $langs as $code => $l ) {
+                       $p = $l->getParentLanguage();
+                       $this->assertTrue( $p === null, 'no parent for bogus language' );
+                       $this->assertFalse( $l instanceof LanguageSr, "$code is not sr" );
+                       $this->assertFalse( $this->getLang()->hasVariant( $code ), "$code is not a sr variant" );
+                       foreach ( [ 'sr', 'sr-ec', 'sr-EC', 'sr-Cyrl', 'sr-cyrl', 'sr-bogus' ] as $v ) {
+                               if ( $v !== $code ) {
+                                       $this->assertFalse( $l->hasVariant( $v ), "no variant $v" );
+                               }
+                       }
+               }
+       }
+
        /**
         * @covers LanguageConverter::convertTo
         */