Merge "Test for Revision::newKnownCurrent"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 14 Nov 2017 13:27:03 +0000 (13:27 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 14 Nov 2017 13:27:03 +0000 (13:27 +0000)
77 files changed:
RELEASE-NOTES-1.30
RELEASE-NOTES-1.31
autoload.php
composer.json
includes/DefaultSettings.php
includes/EditPage.php
includes/Html.php
includes/WatchedItem.php [deleted file]
includes/WatchedItemQueryService.php [deleted file]
includes/WatchedItemQueryServiceExtension.php [deleted file]
includes/WatchedItemStore.php [deleted file]
includes/api/i18n/cs.json
includes/api/i18n/ko.json
includes/api/i18n/nb.json
includes/exception/MWException.php
includes/installer/i18n/eu.json
includes/libs/HashRing.php
includes/page/Article.php
includes/skins/SkinFallbackTemplate.php
includes/specials/SpecialEditTags.php
includes/specials/SpecialMovepage.php
includes/specials/SpecialRecentchangeslinked.php
includes/specials/SpecialResetTokens.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialSearch.php
includes/watcheditem/WatchedItem.php [new file with mode: 0644]
includes/watcheditem/WatchedItemQueryService.php [new file with mode: 0644]
includes/watcheditem/WatchedItemQueryServiceExtension.php [new file with mode: 0644]
includes/watcheditem/WatchedItemStore.php [new file with mode: 0644]
languages/i18n/ais.json
languages/i18n/azb.json
languages/i18n/be-tarask.json
languages/i18n/bn.json
languages/i18n/ca.json
languages/i18n/cs.json
languages/i18n/de.json
languages/i18n/en.json
languages/i18n/et.json
languages/i18n/fa.json
languages/i18n/fr.json
languages/i18n/ga.json
languages/i18n/gl.json
languages/i18n/hu.json
languages/i18n/jv.json
languages/i18n/lad.json
languages/i18n/lki.json
languages/i18n/lv.json
languages/i18n/mr.json
languages/i18n/nl.json
languages/i18n/ps.json
languages/i18n/pt-br.json
languages/i18n/shn.json
languages/i18n/sr-ec.json
languages/i18n/sr-el.json
languages/i18n/su.json
languages/i18n/tyv.json
languages/i18n/zh-hant.json
languages/messages/MessagesMwl.php
maintenance/checkComposerLockUpToDate.php
resources/src/mediawiki.action/mediawiki.action.history.styles.css
resources/src/mediawiki.legacy/commonPrint.css
resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js
resources/src/mediawiki.skinning/content.externallinks.css
resources/src/mediawiki.skinning/elements.css
resources/src/mediawiki.skinning/interface.css
resources/src/mediawiki/mediawiki.notification.css
tests/parser/parserTests.txt
tests/phpunit/includes/WatchedItemIntegrationTest.php [deleted file]
tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php [deleted file]
tests/phpunit/includes/WatchedItemStoreIntegrationTest.php [deleted file]
tests/phpunit/includes/WatchedItemStoreUnitTest.php [deleted file]
tests/phpunit/includes/WatchedItemUnitTest.php [deleted file]
tests/phpunit/includes/watcheditem/WatchedItemIntegrationTest.php [new file with mode: 0644]
tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php [new file with mode: 0644]
tests/phpunit/includes/watcheditem/WatchedItemStoreIntegrationTest.php [new file with mode: 0644]
tests/phpunit/includes/watcheditem/WatchedItemStoreUnitTest.php [new file with mode: 0644]
tests/phpunit/includes/watcheditem/WatchedItemUnitTest.php [new file with mode: 0644]

index f79ae83..d92c38c 100644 (file)
@@ -80,12 +80,18 @@ section).
 === External library changes in 1.30 ===
 
 ==== Upgraded external libraries ====
-* mediawiki/mediawiki-codesniffer updated to 0.8.1.
-* wikimedia/composer-merge-plugin updated to 1.4.1.
+* Updated justinrainbow/json-schema from v3.0 to v5.2.
+* Updated mediawiki/mediawiki-codesniffer from v0.7.2 to v0.12.0.
+* Updated wikimedia/composer-merge-plugin from v1.4.0 to v1.4.1.
+* Updated wikimedia/relpath from v1.0.3 to v2.0.0.
+* Updated OOjs from v2.0.0 to v2.1.0.
+* Updated OOUI from v0.21.1 to v0.23.0.
+* Updated QUnit from v1.23.1 to v2.4.0.
 
 ==== New external libraries ====
 * The class \TestingAccessWrapper has been moved to the external library
   wikimedia/testing-access-wrapper and renamed \Wikimedia\TestingAccessWrapper.
+* Purtle, a fast, lightweight RDF generator.
 
 ==== Removed and replaced external libraries ====
 * …
index 9a4c74c..d9da9ac 100644 (file)
@@ -20,11 +20,14 @@ production.
 === New features in 1.31 ===
 * Wikimedia\Rdbms\IDatabase->select() and similar methods now support
   joins with parentheses for grouping.
+* As a first pass in standardizing dialog boxes across the MediaWiki product,
+Html class now provides helper methods for messageBox, successBox, errorBox and
+warningBox generation.
 
 === External library changes in 1.31 ===
 
 ==== Upgraded external libraries ====
-* 
+* Updated dev dependancy phpunit/phpunit from v4.8.35 to v4.8.36.
 
 ==== New external libraries ====
 * …
@@ -55,7 +58,7 @@ MediaWiki supports over 350 languages. Many localisations are updated
 regularly. Below only new and removed languages are listed, as well as
 changes to languages because of Phabricator reports.
 
-* 
+* (T180052) Mirandese (mwl) now supports gendered NS_USER/NS_USER_TALK namespaces.
 
 === Other changes in 1.31 ===
 * MessageBlobStore::insertMessageBlob() (deprecated in 1.27) was removed.
index bfc8928..edac2c5 100644 (file)
@@ -1591,10 +1591,10 @@ $wgAutoloadLocalClasses = [
        'WantedQueryPage' => __DIR__ . '/includes/specialpage/WantedQueryPage.php',
        'WantedTemplatesPage' => __DIR__ . '/includes/specials/SpecialWantedtemplates.php',
        'WatchAction' => __DIR__ . '/includes/actions/WatchAction.php',
-       'WatchedItem' => __DIR__ . '/includes/WatchedItem.php',
-       'WatchedItemQueryService' => __DIR__ . '/includes/WatchedItemQueryService.php',
-       'WatchedItemQueryServiceExtension' => __DIR__ . '/includes/WatchedItemQueryServiceExtension.php',
-       'WatchedItemStore' => __DIR__ . '/includes/WatchedItemStore.php',
+       'WatchedItem' => __DIR__ . '/includes/watcheditem/WatchedItem.php',
+       'WatchedItemQueryService' => __DIR__ . '/includes/watcheditem/WatchedItemQueryService.php',
+       'WatchedItemQueryServiceExtension' => __DIR__ . '/includes/watcheditem/WatchedItemQueryServiceExtension.php',
+       'WatchedItemStore' => __DIR__ . '/includes/watcheditem/WatchedItemStore.php',
        'WatchlistCleanup' => __DIR__ . '/maintenance/cleanupWatchlist.php',
        'WebInstaller' => __DIR__ . '/includes/installer/WebInstaller.php',
        'WebInstallerComplete' => __DIR__ . '/includes/installer/WebInstallerComplete.php',
index 7031cad..71c9398 100644 (file)
@@ -58,7 +58,7 @@
                "monolog/monolog": "~1.22.1",
                "nikic/php-parser": "2.1.0",
                "nmred/kafka-php": "0.1.5",
-               "phpunit/phpunit": "4.8.35",
+               "phpunit/phpunit": "4.8.36",
                "psy/psysh": "0.8.11",
                "wikimedia/avro": "1.7.7",
                "wikimedia/testing-access-wrapper": "~1.0",
index d9f032c..3cd7ef1 100644 (file)
@@ -5785,7 +5785,7 @@ $wgPasswordAttemptThrottle = [
 ];
 
 /**
- * @var Array Map of (grant => right => boolean)
+ * @var array Map of (grant => right => boolean)
  * Users authorize consumers (like Apps) to act on their behalf but only with
  * a subset of the user's normal account rights (signed off on by the user).
  * The possible rights to grant to a consumer are bundled into groups called
@@ -5887,7 +5887,7 @@ $wgGrantPermissions['createaccount']['createaccount'] = true;
 $wgGrantPermissions['privateinfo']['viewmyprivateinfo'] = true;
 
 /**
- * @var Array Map of grants to their UI grouping
+ * @var array Map of grants to their UI grouping
  * @since 1.27
  */
 $wgGrantPermissionGroups = [
index 4260c99..ff224c5 100644 (file)
@@ -3288,7 +3288,7 @@ class EditPage {
 
        protected function showFormBeforeText() {
                $out = $this->context->getOutput();
-               $out->addHTML( Html::hidden( 'wpSection', htmlspecialchars( $this->section ) ) );
+               $out->addHTML( Html::hidden( 'wpSection', $this->section ) );
                $out->addHTML( Html::hidden( 'wpStarttime', $this->starttime ) );
                $out->addHTML( Html::hidden( 'wpEdittime', $this->edittime ) );
                $out->addHTML( Html::hidden( 'editRevId', $this->editRevId ) );
index 0988b05..524fdcd 100644 (file)
@@ -675,6 +675,52 @@ class Html {
                return self::input( $name, $value, 'checkbox', $attribs );
        }
 
+       /**
+        * Return the HTML for a message box.
+        * @since 1.31
+        * @param string $html of contents of box
+        * @param string $className corresponding to box
+        * @param string $heading (optional)
+        * @return string of HTML representing a box.
+        */
+       public static function messageBox( $html, $className, $heading = '' ) {
+               if ( $heading ) {
+                       $html = self::element( 'h2', [], $heading ) . $html;
+               }
+               return self::rawElement( 'div', [ 'class' => $className ], $html );
+       }
+
+       /**
+        * Return a warning box.
+        * @since 1.31
+        * @param string $html of contents of box
+        * @return string of HTML representing a warning box.
+        */
+       public static function warningBox( $html ) {
+               return self::messageBox( $html, 'warningbox' );
+       }
+
+       /**
+        * Return an error box.
+        * @since 1.31
+        * @param string $html of contents of error box
+        * @param string $heading (optional)
+        * @return string of HTML representing an error box.
+        */
+       public static function errorBox( $html, $heading = '' ) {
+               return self::messageBox( $html, 'errorbox', $heading );
+       }
+
+       /**
+        * Return a success box.
+        * @since 1.31
+        * @param string $html of contents of box
+        * @return string of HTML representing a success box.
+        */
+       public static function successBox( $html ) {
+               return self::messageBox( $html, 'successbox' );
+       }
+
        /**
         * Convenience function to produce a radio button (input element with type=radio)
         *
diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php
deleted file mode 100644 (file)
index bfd1d61..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Watchlist
- */
-use MediaWiki\MediaWikiServices;
-use MediaWiki\Linker\LinkTarget;
-
-/**
- * Representation of a pair of user and title for watchlist entries.
- *
- * @author Tim Starling
- * @author Addshore
- *
- * @ingroup Watchlist
- */
-class WatchedItem {
-
-       /**
-        * @deprecated since 1.27, see User::IGNORE_USER_RIGHTS
-        */
-       const IGNORE_USER_RIGHTS = User::IGNORE_USER_RIGHTS;
-
-       /**
-        * @deprecated since 1.27, see User::CHECK_USER_RIGHTS
-        */
-       const CHECK_USER_RIGHTS = User::CHECK_USER_RIGHTS;
-
-       /**
-        * @deprecated Internal class use only
-        */
-       const DEPRECATED_USAGE_TIMESTAMP = -100;
-
-       /**
-        * @var bool
-        * @deprecated Internal class use only
-        */
-       public $checkRights = User::CHECK_USER_RIGHTS;
-
-       /**
-        * @var Title
-        * @deprecated Internal class use only
-        */
-       private $title;
-
-       /**
-        * @var LinkTarget
-        */
-       private $linkTarget;
-
-       /**
-        * @var User
-        */
-       private $user;
-
-       /**
-        * @var null|string the value of the wl_notificationtimestamp field
-        */
-       private $notificationTimestamp;
-
-       /**
-        * @param User $user
-        * @param LinkTarget $linkTarget
-        * @param null|string $notificationTimestamp the value of the wl_notificationtimestamp field
-        * @param bool|null $checkRights DO NOT USE - used internally for backward compatibility
-        */
-       public function __construct(
-               User $user,
-               LinkTarget $linkTarget,
-               $notificationTimestamp,
-               $checkRights = null
-       ) {
-               $this->user = $user;
-               $this->linkTarget = $linkTarget;
-               $this->notificationTimestamp = $notificationTimestamp;
-               if ( $checkRights !== null ) {
-                       $this->checkRights = $checkRights;
-               }
-       }
-
-       /**
-        * @return User
-        */
-       public function getUser() {
-               return $this->user;
-       }
-
-       /**
-        * @return LinkTarget
-        */
-       public function getLinkTarget() {
-               return $this->linkTarget;
-       }
-
-       /**
-        * Get the notification timestamp of this entry.
-        *
-        * @return bool|null|string
-        */
-       public function getNotificationTimestamp() {
-               // Back compat for objects constructed using self::fromUserTitle
-               if ( $this->notificationTimestamp === self::DEPRECATED_USAGE_TIMESTAMP ) {
-                       // wfDeprecated( __METHOD__, '1.27' );
-                       if ( $this->checkRights && !$this->user->isAllowed( 'viewmywatchlist' ) ) {
-                               return false;
-                       }
-                       $item = MediaWikiServices::getInstance()->getWatchedItemStore()
-                               ->loadWatchedItem( $this->user, $this->linkTarget );
-                       if ( $item ) {
-                               $this->notificationTimestamp = $item->getNotificationTimestamp();
-                       } else {
-                               $this->notificationTimestamp = false;
-                       }
-               }
-               return $this->notificationTimestamp;
-       }
-
-       /**
-        * Back compat pre 1.27 with the WatchedItemStore introduction
-        * @todo remove in 1.28/9
-        * -------------------------------------------------
-        */
-
-       /**
-        * @return Title
-        * @deprecated Internal class use only
-        */
-       public function getTitle() {
-               if ( !$this->title ) {
-                       $this->title = Title::newFromLinkTarget( $this->linkTarget );
-               }
-               return $this->title;
-       }
-
-       /**
-        * @deprecated since 1.27 Use the constructor, WatchedItemStore::getWatchedItem()
-        *             or WatchedItemStore::loadWatchedItem()
-        */
-       public static function fromUserTitle( $user, $title, $checkRights = User::CHECK_USER_RIGHTS ) {
-               wfDeprecated( __METHOD__, '1.27' );
-               return new self( $user, $title, self::DEPRECATED_USAGE_TIMESTAMP, (bool)$checkRights );
-       }
-
-       /**
-        * @deprecated since 1.27 Use User::addWatch()
-        * @return bool
-        */
-       public function addWatch() {
-               wfDeprecated( __METHOD__, '1.27' );
-               $this->user->addWatch( $this->getTitle(), $this->checkRights );
-               return true;
-       }
-
-       /**
-        * @deprecated since 1.27 Use User::removeWatch()
-        * @return bool
-        */
-       public function removeWatch() {
-               wfDeprecated( __METHOD__, '1.27' );
-               if ( $this->checkRights && !$this->user->isAllowed( 'editmywatchlist' ) ) {
-                       return false;
-               }
-               $this->user->removeWatch( $this->getTitle(), $this->checkRights );
-               return true;
-       }
-
-       /**
-        * @deprecated since 1.27 Use User::isWatched()
-        * @return bool
-        */
-       public function isWatched() {
-               wfDeprecated( __METHOD__, '1.27' );
-               return $this->user->isWatched( $this->getTitle(), $this->checkRights );
-       }
-
-       /**
-        * @deprecated since 1.27 Use WatchedItemStore::duplicateAllAssociatedEntries()
-        */
-       public static function duplicateEntries( Title $oldTitle, Title $newTitle ) {
-               wfDeprecated( __METHOD__, '1.27' );
-               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
-               $store->duplicateAllAssociatedEntries( $oldTitle, $newTitle );
-       }
-
-}
diff --git a/includes/WatchedItemQueryService.php b/includes/WatchedItemQueryService.php
deleted file mode 100644 (file)
index d0f45be..0000000
+++ /dev/null
@@ -1,684 +0,0 @@
-<?php
-
-use Wikimedia\Rdbms\IDatabase;
-use MediaWiki\Linker\LinkTarget;
-use Wikimedia\Assert\Assert;
-use Wikimedia\Rdbms\LoadBalancer;
-
-/**
- * Class performing complex database queries related to WatchedItems.
- *
- * @since 1.28
- *
- * @file
- * @ingroup Watchlist
- *
- * @license GNU GPL v2+
- */
-class WatchedItemQueryService {
-
-       const DIR_OLDER = 'older';
-       const DIR_NEWER = 'newer';
-
-       const INCLUDE_FLAGS = 'flags';
-       const INCLUDE_USER = 'user';
-       const INCLUDE_USER_ID = 'userid';
-       const INCLUDE_COMMENT = 'comment';
-       const INCLUDE_PATROL_INFO = 'patrol';
-       const INCLUDE_SIZES = 'sizes';
-       const INCLUDE_LOG_INFO = 'loginfo';
-
-       // FILTER_* constants are part of public API (are used in ApiQueryWatchlist and
-       // ApiQueryWatchlistRaw classes) and should not be changed.
-       // Changing values of those constants will result in a breaking change in the API
-       const FILTER_MINOR = 'minor';
-       const FILTER_NOT_MINOR = '!minor';
-       const FILTER_BOT = 'bot';
-       const FILTER_NOT_BOT = '!bot';
-       const FILTER_ANON = 'anon';
-       const FILTER_NOT_ANON = '!anon';
-       const FILTER_PATROLLED = 'patrolled';
-       const FILTER_NOT_PATROLLED = '!patrolled';
-       const FILTER_UNREAD = 'unread';
-       const FILTER_NOT_UNREAD = '!unread';
-       const FILTER_CHANGED = 'changed';
-       const FILTER_NOT_CHANGED = '!changed';
-
-       const SORT_ASC = 'ASC';
-       const SORT_DESC = 'DESC';
-
-       /**
-        * @var LoadBalancer
-        */
-       private $loadBalancer;
-
-       /** @var WatchedItemQueryServiceExtension[]|null */
-       private $extensions = null;
-
-       /**
-        * @var CommentStore|null */
-       private $commentStore = null;
-
-       public function __construct( LoadBalancer $loadBalancer ) {
-               $this->loadBalancer = $loadBalancer;
-       }
-
-       /**
-        * @return WatchedItemQueryServiceExtension[]
-        */
-       private function getExtensions() {
-               if ( $this->extensions === null ) {
-                       $this->extensions = [];
-                       Hooks::run( 'WatchedItemQueryServiceExtensions', [ &$this->extensions, $this ] );
-               }
-               return $this->extensions;
-       }
-
-       /**
-        * @return IDatabase
-        * @throws MWException
-        */
-       private function getConnection() {
-               return $this->loadBalancer->getConnectionRef( DB_REPLICA, [ 'watchlist' ] );
-       }
-
-       private function getCommentStore() {
-               if ( !$this->commentStore ) {
-                       $this->commentStore = new CommentStore( 'rc_comment' );
-               }
-               return $this->commentStore;
-       }
-
-       /**
-        * @param User $user
-        * @param array $options Allowed keys:
-        *        'includeFields'       => string[] RecentChange fields to be included in the result,
-        *                                 self::INCLUDE_* constants should be used
-        *        'filters'             => string[] optional filters to narrow down resulted items
-        *        'namespaceIds'        => int[] optional namespace IDs to filter by
-        *                                 (defaults to all namespaces)
-        *        'allRevisions'        => bool return multiple revisions of the same page if true,
-        *                                 only the most recent if false (default)
-        *        'rcTypes'             => int[] which types of RecentChanges to include
-        *                                 (defaults to all types), allowed values: RC_EDIT, RC_NEW,
-        *                                 RC_LOG, RC_EXTERNAL, RC_CATEGORIZE
-        *        'onlyByUser'          => string only list changes by a specified user
-        *        'notByUser'           => string do not incluide changes by a specified user
-        *        'dir'                 => string in which direction to enumerate, accepted values:
-        *                                 - DIR_OLDER list newest first
-        *                                 - DIR_NEWER list oldest first
-        *        'start'               => string (format accepted by wfTimestamp) requires 'dir' option,
-        *                                 timestamp to start enumerating from
-        *        'end'                 => string (format accepted by wfTimestamp) requires 'dir' option,
-        *                                 timestamp to end enumerating
-        *        'watchlistOwner'      => User user whose watchlist items should be listed if different
-        *                                 than the one specified with $user param,
-        *                                 requires 'watchlistOwnerToken' option
-        *        'watchlistOwnerToken' => string a watchlist token used to access another user's
-        *                                 watchlist, used with 'watchlistOwnerToken' option
-        *        'limit'               => int maximum numbers of items to return
-        *        'usedInGenerator'     => bool include only RecentChange id field required by the
-        *                                 generator ('rc_cur_id' or 'rc_this_oldid') if true, or all
-        *                                 id fields ('rc_cur_id', 'rc_this_oldid', 'rc_last_oldid')
-        *                                 if false (default)
-        * @param array|null &$startFrom Continuation value: [ string $rcTimestamp, int $rcId ]
-        * @return array of pairs ( WatchedItem $watchedItem, string[] $recentChangeInfo ),
-        *         where $recentChangeInfo contains the following keys:
-        *         - 'rc_id',
-        *         - 'rc_namespace',
-        *         - 'rc_title',
-        *         - 'rc_timestamp',
-        *         - 'rc_type',
-        *         - 'rc_deleted',
-        *         Additional keys could be added by specifying the 'includeFields' option
-        */
-       public function getWatchedItemsWithRecentChangeInfo(
-               User $user, array $options = [], &$startFrom = null
-       ) {
-               $options += [
-                       'includeFields' => [],
-                       'namespaceIds' => [],
-                       'filters' => [],
-                       'allRevisions' => false,
-                       'usedInGenerator' => false
-               ];
-
-               Assert::parameter(
-                       !isset( $options['rcTypes'] )
-                               || !array_diff( $options['rcTypes'], [ RC_EDIT, RC_NEW, RC_LOG, RC_EXTERNAL, RC_CATEGORIZE ] ),
-                       '$options[\'rcTypes\']',
-                       'must be an array containing only: RC_EDIT, RC_NEW, RC_LOG, RC_EXTERNAL and/or RC_CATEGORIZE'
-               );
-               Assert::parameter(
-                       !isset( $options['dir'] ) || in_array( $options['dir'], [ self::DIR_OLDER, self::DIR_NEWER ] ),
-                       '$options[\'dir\']',
-                       'must be DIR_OLDER or DIR_NEWER'
-               );
-               Assert::parameter(
-                       !isset( $options['start'] ) && !isset( $options['end'] ) && $startFrom === null
-                               || isset( $options['dir'] ),
-                       '$options[\'dir\']',
-                       'must be provided when providing the "start" or "end" options or the $startFrom parameter'
-               );
-               Assert::parameter(
-                       !isset( $options['startFrom'] ),
-                       '$options[\'startFrom\']',
-                       'must not be provided, use $startFrom instead'
-               );
-               Assert::parameter(
-                       !isset( $startFrom ) || ( is_array( $startFrom ) && count( $startFrom ) === 2 ),
-                       '$startFrom',
-                       'must be a two-element array'
-               );
-               if ( array_key_exists( 'watchlistOwner', $options ) ) {
-                       Assert::parameterType(
-                               User::class,
-                               $options['watchlistOwner'],
-                               '$options[\'watchlistOwner\']'
-                       );
-                       Assert::parameter(
-                               isset( $options['watchlistOwnerToken'] ),
-                               '$options[\'watchlistOwnerToken\']',
-                               'must be provided when providing watchlistOwner option'
-                       );
-               }
-
-               $db = $this->getConnection();
-
-               $tables = $this->getWatchedItemsWithRCInfoQueryTables( $options );
-               $fields = $this->getWatchedItemsWithRCInfoQueryFields( $options );
-               $conds = $this->getWatchedItemsWithRCInfoQueryConds( $db, $user, $options );
-               $dbOptions = $this->getWatchedItemsWithRCInfoQueryDbOptions( $options );
-               $joinConds = $this->getWatchedItemsWithRCInfoQueryJoinConds( $options );
-
-               if ( $startFrom !== null ) {
-                       $conds[] = $this->getStartFromConds( $db, $options, $startFrom );
-               }
-
-               foreach ( $this->getExtensions() as $extension ) {
-                       $extension->modifyWatchedItemsWithRCInfoQuery(
-                               $user, $options, $db,
-                               $tables,
-                               $fields,
-                               $conds,
-                               $dbOptions,
-                               $joinConds
-                       );
-               }
-
-               $res = $db->select(
-                       $tables,
-                       $fields,
-                       $conds,
-                       __METHOD__,
-                       $dbOptions,
-                       $joinConds
-               );
-
-               $limit = isset( $dbOptions['LIMIT'] ) ? $dbOptions['LIMIT'] : INF;
-               $items = [];
-               $startFrom = null;
-               foreach ( $res as $row ) {
-                       if ( --$limit <= 0 ) {
-                               $startFrom = [ $row->rc_timestamp, $row->rc_id ];
-                               break;
-                       }
-
-                       $items[] = [
-                               new WatchedItem(
-                                       $user,
-                                       new TitleValue( (int)$row->rc_namespace, $row->rc_title ),
-                                       $row->wl_notificationtimestamp
-                               ),
-                               $this->getRecentChangeFieldsFromRow( $row )
-                       ];
-               }
-
-               foreach ( $this->getExtensions() as $extension ) {
-                       $extension->modifyWatchedItemsWithRCInfo( $user, $options, $db, $items, $res, $startFrom );
-               }
-
-               return $items;
-       }
-
-       /**
-        * For simple listing of user's watchlist items, see WatchedItemStore::getWatchedItemsForUser
-        *
-        * @param User $user
-        * @param array $options Allowed keys:
-        *        'sort'         => string optional sorting by namespace ID and title
-        *                          one of the self::SORT_* constants
-        *        'namespaceIds' => int[] optional namespace IDs to filter by (defaults to all namespaces)
-        *        'limit'        => int maximum number of items to return
-        *        'filter'       => string optional filter, one of the self::FILTER_* contants
-        *        'from'         => LinkTarget requires 'sort' key, only return items starting from
-        *                          those related to the link target
-        *        'until'        => LinkTarget requires 'sort' key, only return items until
-        *                          those related to the link target
-        *        'startFrom'    => LinkTarget requires 'sort' key, only return items starting from
-        *                          those related to the link target, allows to skip some link targets
-        *                          specified using the form option
-        * @return WatchedItem[]
-        */
-       public function getWatchedItemsForUser( User $user, array $options = [] ) {
-               if ( $user->isAnon() ) {
-                       // TODO: should this just return an empty array or rather complain loud at this point
-                       // as e.g. ApiBase::getWatchlistUser does?
-                       return [];
-               }
-
-               $options += [ 'namespaceIds' => [] ];
-
-               Assert::parameter(
-                       !isset( $options['sort'] ) || in_array( $options['sort'], [ self::SORT_ASC, self::SORT_DESC ] ),
-                       '$options[\'sort\']',
-                       'must be SORT_ASC or SORT_DESC'
-               );
-               Assert::parameter(
-                       !isset( $options['filter'] ) || in_array(
-                               $options['filter'], [ self::FILTER_CHANGED, self::FILTER_NOT_CHANGED ]
-                       ),
-                       '$options[\'filter\']',
-                       'must be FILTER_CHANGED or FILTER_NOT_CHANGED'
-               );
-               Assert::parameter(
-                       !isset( $options['from'] ) && !isset( $options['until'] ) && !isset( $options['startFrom'] )
-                       || isset( $options['sort'] ),
-                       '$options[\'sort\']',
-                       'must be provided if any of "from", "until", "startFrom" options is provided'
-               );
-
-               $db = $this->getConnection();
-
-               $conds = $this->getWatchedItemsForUserQueryConds( $db, $user, $options );
-               $dbOptions = $this->getWatchedItemsForUserQueryDbOptions( $options );
-
-               $res = $db->select(
-                       'watchlist',
-                       [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                       $conds,
-                       __METHOD__,
-                       $dbOptions
-               );
-
-               $watchedItems = [];
-               foreach ( $res as $row ) {
-                       // todo these could all be cached at some point?
-                       $watchedItems[] = new WatchedItem(
-                               $user,
-                               new TitleValue( (int)$row->wl_namespace, $row->wl_title ),
-                               $row->wl_notificationtimestamp
-                       );
-               }
-
-               return $watchedItems;
-       }
-
-       private function getRecentChangeFieldsFromRow( stdClass $row ) {
-               // This can be simplified to single array_filter call filtering by key value,
-               // once we stop supporting PHP 5.5
-               $allFields = get_object_vars( $row );
-               $rcKeys = array_filter(
-                       array_keys( $allFields ),
-                       function ( $key ) {
-                               return substr( $key, 0, 3 ) === 'rc_';
-                       }
-               );
-               return array_intersect_key( $allFields, array_flip( $rcKeys ) );
-       }
-
-       private function getWatchedItemsWithRCInfoQueryTables( array $options ) {
-               $tables = [ 'recentchanges', 'watchlist' ];
-               if ( !$options['allRevisions'] ) {
-                       $tables[] = 'page';
-               }
-               if ( in_array( self::INCLUDE_COMMENT, $options['includeFields'] ) ) {
-                       $tables += $this->getCommentStore()->getJoin()['tables'];
-               }
-               return $tables;
-       }
-
-       private function getWatchedItemsWithRCInfoQueryFields( array $options ) {
-               $fields = [
-                       'rc_id',
-                       'rc_namespace',
-                       'rc_title',
-                       'rc_timestamp',
-                       'rc_type',
-                       'rc_deleted',
-                       'wl_notificationtimestamp'
-               ];
-
-               $rcIdFields = [
-                       'rc_cur_id',
-                       'rc_this_oldid',
-                       'rc_last_oldid',
-               ];
-               if ( $options['usedInGenerator'] ) {
-                       if ( $options['allRevisions'] ) {
-                               $rcIdFields = [ 'rc_this_oldid' ];
-                       } else {
-                               $rcIdFields = [ 'rc_cur_id' ];
-                       }
-               }
-               $fields = array_merge( $fields, $rcIdFields );
-
-               if ( in_array( self::INCLUDE_FLAGS, $options['includeFields'] ) ) {
-                       $fields = array_merge( $fields, [ 'rc_type', 'rc_minor', 'rc_bot' ] );
-               }
-               if ( in_array( self::INCLUDE_USER, $options['includeFields'] ) ) {
-                       $fields[] = 'rc_user_text';
-               }
-               if ( in_array( self::INCLUDE_USER_ID, $options['includeFields'] ) ) {
-                       $fields[] = 'rc_user';
-               }
-               if ( in_array( self::INCLUDE_COMMENT, $options['includeFields'] ) ) {
-                       $fields += $this->getCommentStore()->getJoin()['fields'];
-               }
-               if ( in_array( self::INCLUDE_PATROL_INFO, $options['includeFields'] ) ) {
-                       $fields = array_merge( $fields, [ 'rc_patrolled', 'rc_log_type' ] );
-               }
-               if ( in_array( self::INCLUDE_SIZES, $options['includeFields'] ) ) {
-                       $fields = array_merge( $fields, [ 'rc_old_len', 'rc_new_len' ] );
-               }
-               if ( in_array( self::INCLUDE_LOG_INFO, $options['includeFields'] ) ) {
-                       $fields = array_merge( $fields, [ 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ] );
-               }
-
-               return $fields;
-       }
-
-       private function getWatchedItemsWithRCInfoQueryConds(
-               IDatabase $db,
-               User $user,
-               array $options
-       ) {
-               $watchlistOwnerId = $this->getWatchlistOwnerId( $user, $options );
-               $conds = [ 'wl_user' => $watchlistOwnerId ];
-
-               if ( !$options['allRevisions'] ) {
-                       $conds[] = $db->makeList(
-                               [ 'rc_this_oldid=page_latest', 'rc_type=' . RC_LOG ],
-                               LIST_OR
-                       );
-               }
-
-               if ( $options['namespaceIds'] ) {
-                       $conds['wl_namespace'] = array_map( 'intval', $options['namespaceIds'] );
-               }
-
-               if ( array_key_exists( 'rcTypes', $options ) ) {
-                       $conds['rc_type'] = array_map( 'intval', $options['rcTypes'] );
-               }
-
-               $conds = array_merge(
-                       $conds,
-                       $this->getWatchedItemsWithRCInfoQueryFilterConds( $user, $options )
-               );
-
-               $conds = array_merge( $conds, $this->getStartEndConds( $db, $options ) );
-
-               if ( !isset( $options['start'] ) && !isset( $options['end'] ) ) {
-                       if ( $db->getType() === 'mysql' ) {
-                               // This is an index optimization for mysql
-                               $conds[] = 'rc_timestamp > ' . $db->addQuotes( '' );
-                       }
-               }
-
-               $conds = array_merge( $conds, $this->getUserRelatedConds( $db, $user, $options ) );
-
-               $deletedPageLogCond = $this->getExtraDeletedPageLogEntryRelatedCond( $db, $user );
-               if ( $deletedPageLogCond ) {
-                       $conds[] = $deletedPageLogCond;
-               }
-
-               return $conds;
-       }
-
-       private function getWatchlistOwnerId( User $user, array $options ) {
-               if ( array_key_exists( 'watchlistOwner', $options ) ) {
-                       /** @var User $watchlistOwner */
-                       $watchlistOwner = $options['watchlistOwner'];
-                       $ownersToken = $watchlistOwner->getOption( 'watchlisttoken' );
-                       $token = $options['watchlistOwnerToken'];
-                       if ( $ownersToken == '' || !hash_equals( $ownersToken, $token ) ) {
-                               throw ApiUsageException::newWithMessage( null, 'apierror-bad-watchlist-token', 'bad_wltoken' );
-                       }
-                       return $watchlistOwner->getId();
-               }
-               return $user->getId();
-       }
-
-       private function getWatchedItemsWithRCInfoQueryFilterConds( User $user, array $options ) {
-               $conds = [];
-
-               if ( in_array( self::FILTER_MINOR, $options['filters'] ) ) {
-                       $conds[] = 'rc_minor != 0';
-               } elseif ( in_array( self::FILTER_NOT_MINOR, $options['filters'] ) ) {
-                       $conds[] = 'rc_minor = 0';
-               }
-
-               if ( in_array( self::FILTER_BOT, $options['filters'] ) ) {
-                       $conds[] = 'rc_bot != 0';
-               } elseif ( in_array( self::FILTER_NOT_BOT, $options['filters'] ) ) {
-                       $conds[] = 'rc_bot = 0';
-               }
-
-               if ( in_array( self::FILTER_ANON, $options['filters'] ) ) {
-                       $conds[] = 'rc_user = 0';
-               } elseif ( in_array( self::FILTER_NOT_ANON, $options['filters'] ) ) {
-                       $conds[] = 'rc_user != 0';
-               }
-
-               if ( $user->useRCPatrol() || $user->useNPPatrol() ) {
-                       // TODO: not sure if this should simply ignore patrolled filters if user does not have the patrol
-                       // right, or maybe rather fail loud at this point, same as e.g. ApiQueryWatchlist does?
-                       if ( in_array( self::FILTER_PATROLLED, $options['filters'] ) ) {
-                               $conds[] = 'rc_patrolled != 0';
-                       } elseif ( in_array( self::FILTER_NOT_PATROLLED, $options['filters'] ) ) {
-                               $conds[] = 'rc_patrolled = 0';
-                       }
-               }
-
-               if ( in_array( self::FILTER_UNREAD, $options['filters'] ) ) {
-                       $conds[] = 'rc_timestamp >= wl_notificationtimestamp';
-               } elseif ( in_array( self::FILTER_NOT_UNREAD, $options['filters'] ) ) {
-                       // TODO: should this be changed to use Database::makeList?
-                       $conds[] = 'wl_notificationtimestamp IS NULL OR rc_timestamp < wl_notificationtimestamp';
-               }
-
-               return $conds;
-       }
-
-       private function getStartEndConds( IDatabase $db, array $options ) {
-               if ( !isset( $options['start'] ) && !isset( $options['end'] ) ) {
-                       return [];
-               }
-
-               $conds = [];
-
-               if ( isset( $options['start'] ) ) {
-                       $after = $options['dir'] === self::DIR_OLDER ? '<=' : '>=';
-                       $conds[] = 'rc_timestamp ' . $after . ' ' .
-                               $db->addQuotes( $db->timestamp( $options['start'] ) );
-               }
-               if ( isset( $options['end'] ) ) {
-                       $before = $options['dir'] === self::DIR_OLDER ? '>=' : '<=';
-                       $conds[] = 'rc_timestamp ' . $before . ' ' .
-                               $db->addQuotes( $db->timestamp( $options['end'] ) );
-               }
-
-               return $conds;
-       }
-
-       private function getUserRelatedConds( IDatabase $db, User $user, array $options ) {
-               if ( !array_key_exists( 'onlyByUser', $options ) && !array_key_exists( 'notByUser', $options ) ) {
-                       return [];
-               }
-
-               $conds = [];
-
-               if ( array_key_exists( 'onlyByUser', $options ) ) {
-                       $conds['rc_user_text'] = $options['onlyByUser'];
-               } elseif ( array_key_exists( 'notByUser', $options ) ) {
-                       $conds[] = 'rc_user_text != ' . $db->addQuotes( $options['notByUser'] );
-               }
-
-               // Avoid brute force searches (T19342)
-               $bitmask = 0;
-               if ( !$user->isAllowed( 'deletedhistory' ) ) {
-                       $bitmask = Revision::DELETED_USER;
-               } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
-                       $bitmask = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
-               }
-               if ( $bitmask ) {
-                       $conds[] = $db->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask";
-               }
-
-               return $conds;
-       }
-
-       private function getExtraDeletedPageLogEntryRelatedCond( IDatabase $db, User $user ) {
-               // LogPage::DELETED_ACTION hides the affected page, too. So hide those
-               // entirely from the watchlist, or someone could guess the title.
-               $bitmask = 0;
-               if ( !$user->isAllowed( 'deletedhistory' ) ) {
-                       $bitmask = LogPage::DELETED_ACTION;
-               } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
-                       $bitmask = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED;
-               }
-               if ( $bitmask ) {
-                       return $db->makeList( [
-                               'rc_type != ' . RC_LOG,
-                               $db->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask",
-                       ], LIST_OR );
-               }
-               return '';
-       }
-
-       private function getStartFromConds( IDatabase $db, array $options, array $startFrom ) {
-               $op = $options['dir'] === self::DIR_OLDER ? '<' : '>';
-               list( $rcTimestamp, $rcId ) = $startFrom;
-               $rcTimestamp = $db->addQuotes( $db->timestamp( $rcTimestamp ) );
-               $rcId = (int)$rcId;
-               return $db->makeList(
-                       [
-                               "rc_timestamp $op $rcTimestamp",
-                               $db->makeList(
-                                       [
-                                               "rc_timestamp = $rcTimestamp",
-                                               "rc_id $op= $rcId"
-                                       ],
-                                       LIST_AND
-                               )
-                       ],
-                       LIST_OR
-               );
-       }
-
-       private function getWatchedItemsForUserQueryConds( IDatabase $db, User $user, array $options ) {
-               $conds = [ 'wl_user' => $user->getId() ];
-               if ( $options['namespaceIds'] ) {
-                       $conds['wl_namespace'] = array_map( 'intval', $options['namespaceIds'] );
-               }
-               if ( isset( $options['filter'] ) ) {
-                       $filter = $options['filter'];
-                       if ( $filter === self::FILTER_CHANGED ) {
-                               $conds[] = 'wl_notificationtimestamp IS NOT NULL';
-                       } else {
-                               $conds[] = 'wl_notificationtimestamp IS NULL';
-                       }
-               }
-
-               if ( isset( $options['from'] ) ) {
-                       $op = $options['sort'] === self::SORT_ASC ? '>' : '<';
-                       $conds[] = $this->getFromUntilTargetConds( $db, $options['from'], $op );
-               }
-               if ( isset( $options['until'] ) ) {
-                       $op = $options['sort'] === self::SORT_ASC ? '<' : '>';
-                       $conds[] = $this->getFromUntilTargetConds( $db, $options['until'], $op );
-               }
-               if ( isset( $options['startFrom'] ) ) {
-                       $op = $options['sort'] === self::SORT_ASC ? '>' : '<';
-                       $conds[] = $this->getFromUntilTargetConds( $db, $options['startFrom'], $op );
-               }
-
-               return $conds;
-       }
-
-       /**
-        * Creates a query condition part for getting only items before or after the given link target
-        * (while ordering using $sort mode)
-        *
-        * @param IDatabase $db
-        * @param LinkTarget $target
-        * @param string $op comparison operator to use in the conditions
-        * @return string
-        */
-       private function getFromUntilTargetConds( IDatabase $db, LinkTarget $target, $op ) {
-               return $db->makeList(
-                       [
-                               "wl_namespace $op " . $target->getNamespace(),
-                               $db->makeList(
-                                       [
-                                               'wl_namespace = ' . $target->getNamespace(),
-                                               "wl_title $op= " . $db->addQuotes( $target->getDBkey() )
-                                       ],
-                                       LIST_AND
-                               )
-                       ],
-                       LIST_OR
-               );
-       }
-
-       private function getWatchedItemsWithRCInfoQueryDbOptions( array $options ) {
-               $dbOptions = [];
-
-               if ( array_key_exists( 'dir', $options ) ) {
-                       $sort = $options['dir'] === self::DIR_OLDER ? ' DESC' : '';
-                       $dbOptions['ORDER BY'] = [ 'rc_timestamp' . $sort, 'rc_id' . $sort ];
-               }
-
-               if ( array_key_exists( 'limit', $options ) ) {
-                       $dbOptions['LIMIT'] = (int)$options['limit'] + 1;
-               }
-
-               return $dbOptions;
-       }
-
-       private function getWatchedItemsForUserQueryDbOptions( array $options ) {
-               $dbOptions = [];
-               if ( array_key_exists( 'sort', $options ) ) {
-                       $dbOptions['ORDER BY'] = [
-                               "wl_namespace {$options['sort']}",
-                               "wl_title {$options['sort']}"
-                       ];
-                       if ( count( $options['namespaceIds'] ) === 1 ) {
-                               $dbOptions['ORDER BY'] = "wl_title {$options['sort']}";
-                       }
-               }
-               if ( array_key_exists( 'limit', $options ) ) {
-                       $dbOptions['LIMIT'] = (int)$options['limit'];
-               }
-               return $dbOptions;
-       }
-
-       private function getWatchedItemsWithRCInfoQueryJoinConds( array $options ) {
-               $joinConds = [
-                       'watchlist' => [ 'INNER JOIN',
-                               [
-                                       'wl_namespace=rc_namespace',
-                                       'wl_title=rc_title'
-                               ]
-                       ]
-               ];
-               if ( !$options['allRevisions'] ) {
-                       $joinConds['page'] = [ 'LEFT JOIN', 'rc_cur_id=page_id' ];
-               }
-               if ( in_array( self::INCLUDE_COMMENT, $options['includeFields'] ) ) {
-                       $joinConds += $this->getCommentStore()->getJoin()['joins'];
-               }
-               return $joinConds;
-       }
-
-}
diff --git a/includes/WatchedItemQueryServiceExtension.php b/includes/WatchedItemQueryServiceExtension.php
deleted file mode 100644 (file)
index 93d5033..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-use Wikimedia\Rdbms\ResultWrapper;
-use Wikimedia\Rdbms\IDatabase;
-
-/**
- * Extension mechanism for WatchedItemQueryService
- *
- * @since 1.29
- *
- * @file
- * @ingroup Watchlist
- *
- * @license GNU GPL v2+
- */
-interface WatchedItemQueryServiceExtension {
-
-       /**
-        * Modify the WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
-        * query before it's made.
-        *
-        * @warning Any joins added *must* join on a unique key of the target table
-        *  unless you really know what you're doing.
-        * @param User $user
-        * @param array $options Options from
-        *  WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
-        * @param IDatabase $db Database connection being used for the query
-        * @param array &$tables Tables for Database::select()
-        * @param array &$fields Fields for Database::select()
-        * @param array &$conds Conditions for Database::select()
-        * @param array &$dbOptions Options for Database::select()
-        * @param array &$joinConds Join conditions for Database::select()
-        */
-       public function modifyWatchedItemsWithRCInfoQuery( User $user, array $options, IDatabase $db,
-               array &$tables, array &$fields, array &$conds, array &$dbOptions, array &$joinConds
-       );
-
-       /**
-        * Modify the results from WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
-        * before they're returned.
-        *
-        * @param User $user
-        * @param array $options Options from
-        *  WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
-        * @param IDatabase $db Database connection being used for the query
-        * @param array &$items array of pairs ( WatchedItem $watchedItem, string[] $recentChangeInfo ).
-        *  May be truncated if necessary, in which case $startFrom must be updated.
-        * @param ResultWrapper|bool $res Database query result
-        * @param array|null &$startFrom Continuation value. If you truncate $items, set this to
-        *  [ $recentChangeInfo['rc_timestamp'], $recentChangeInfo['rc_id'] ] from the first item
-        *  removed.
-        */
-       public function modifyWatchedItemsWithRCInfo( User $user, array $options, IDatabase $db,
-               array &$items, $res, &$startFrom
-       );
-
-}
diff --git a/includes/WatchedItemStore.php b/includes/WatchedItemStore.php
deleted file mode 100644 (file)
index 60d8b76..0000000
+++ /dev/null
@@ -1,986 +0,0 @@
-<?php
-
-use Wikimedia\Rdbms\IDatabase;
-use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
-use MediaWiki\Linker\LinkTarget;
-use MediaWiki\MediaWikiServices;
-use Wikimedia\Assert\Assert;
-use Wikimedia\ScopedCallback;
-use Wikimedia\Rdbms\LoadBalancer;
-use Wikimedia\Rdbms\DBUnexpectedError;
-
-/**
- * Storage layer class for WatchedItems.
- * Database interaction.
- *
- * Uses database because this uses User::isAnon
- *
- * @group Database
- *
- * @author Addshore
- * @since 1.27
- */
-class WatchedItemStore implements StatsdAwareInterface {
-
-       const SORT_DESC = 'DESC';
-       const SORT_ASC = 'ASC';
-
-       /**
-        * @var LoadBalancer
-        */
-       private $loadBalancer;
-
-       /**
-        * @var ReadOnlyMode
-        */
-       private $readOnlyMode;
-
-       /**
-        * @var HashBagOStuff
-        */
-       private $cache;
-
-       /**
-        * @var array[] Looks like $cacheIndex[Namespace ID][Target DB Key][User Id] => 'key'
-        * The index is needed so that on mass changes all relevant items can be un-cached.
-        * For example: Clearing a users watchlist of all items or updating notification timestamps
-        *              for all users watching a single target.
-        */
-       private $cacheIndex = [];
-
-       /**
-        * @var callable|null
-        */
-       private $deferredUpdatesAddCallableUpdateCallback;
-
-       /**
-        * @var callable|null
-        */
-       private $revisionGetTimestampFromIdCallback;
-
-       /**
-        * @var StatsdDataFactoryInterface
-        */
-       private $stats;
-
-       /**
-        * @param LoadBalancer $loadBalancer
-        * @param HashBagOStuff $cache
-        * @param ReadOnlyMode $readOnlyMode
-        */
-       public function __construct(
-               LoadBalancer $loadBalancer,
-               HashBagOStuff $cache,
-               ReadOnlyMode $readOnlyMode
-       ) {
-               $this->loadBalancer = $loadBalancer;
-               $this->cache = $cache;
-               $this->readOnlyMode = $readOnlyMode;
-               $this->stats = new NullStatsdDataFactory();
-               $this->deferredUpdatesAddCallableUpdateCallback = [ 'DeferredUpdates', 'addCallableUpdate' ];
-               $this->revisionGetTimestampFromIdCallback = [ 'Revision', 'getTimestampFromId' ];
-       }
-
-       public function setStatsdDataFactory( StatsdDataFactoryInterface $stats ) {
-               $this->stats = $stats;
-       }
-
-       /**
-        * Overrides the DeferredUpdates::addCallableUpdate callback
-        * This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
-        *
-        * @param callable $callback
-        *
-        * @see DeferredUpdates::addCallableUpdate for callback signiture
-        *
-        * @return ScopedCallback to reset the overridden value
-        * @throws MWException
-        */
-       public function overrideDeferredUpdatesAddCallableUpdateCallback( callable $callback ) {
-               if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
-                       throw new MWException(
-                               'Cannot override DeferredUpdates::addCallableUpdate callback in operation.'
-                       );
-               }
-               $previousValue = $this->deferredUpdatesAddCallableUpdateCallback;
-               $this->deferredUpdatesAddCallableUpdateCallback = $callback;
-               return new ScopedCallback( function () use ( $previousValue ) {
-                       $this->deferredUpdatesAddCallableUpdateCallback = $previousValue;
-               } );
-       }
-
-       /**
-        * Overrides the Revision::getTimestampFromId callback
-        * This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
-        *
-        * @param callable $callback
-        * @see Revision::getTimestampFromId for callback signiture
-        *
-        * @return ScopedCallback to reset the overridden value
-        * @throws MWException
-        */
-       public function overrideRevisionGetTimestampFromIdCallback( callable $callback ) {
-               if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
-                       throw new MWException(
-                               'Cannot override Revision::getTimestampFromId callback in operation.'
-                       );
-               }
-               $previousValue = $this->revisionGetTimestampFromIdCallback;
-               $this->revisionGetTimestampFromIdCallback = $callback;
-               return new ScopedCallback( function () use ( $previousValue ) {
-                       $this->revisionGetTimestampFromIdCallback = $previousValue;
-               } );
-       }
-
-       private function getCacheKey( User $user, LinkTarget $target ) {
-               return $this->cache->makeKey(
-                       (string)$target->getNamespace(),
-                       $target->getDBkey(),
-                       (string)$user->getId()
-               );
-       }
-
-       private function cache( WatchedItem $item ) {
-               $user = $item->getUser();
-               $target = $item->getLinkTarget();
-               $key = $this->getCacheKey( $user, $target );
-               $this->cache->set( $key, $item );
-               $this->cacheIndex[$target->getNamespace()][$target->getDBkey()][$user->getId()] = $key;
-               $this->stats->increment( 'WatchedItemStore.cache' );
-       }
-
-       private function uncache( User $user, LinkTarget $target ) {
-               $this->cache->delete( $this->getCacheKey( $user, $target ) );
-               unset( $this->cacheIndex[$target->getNamespace()][$target->getDBkey()][$user->getId()] );
-               $this->stats->increment( 'WatchedItemStore.uncache' );
-       }
-
-       private function uncacheLinkTarget( LinkTarget $target ) {
-               $this->stats->increment( 'WatchedItemStore.uncacheLinkTarget' );
-               if ( !isset( $this->cacheIndex[$target->getNamespace()][$target->getDBkey()] ) ) {
-                       return;
-               }
-               foreach ( $this->cacheIndex[$target->getNamespace()][$target->getDBkey()] as $key ) {
-                       $this->stats->increment( 'WatchedItemStore.uncacheLinkTarget.items' );
-                       $this->cache->delete( $key );
-               }
-       }
-
-       private function uncacheUser( User $user ) {
-               $this->stats->increment( 'WatchedItemStore.uncacheUser' );
-               foreach ( $this->cacheIndex as $ns => $dbKeyArray ) {
-                       foreach ( $dbKeyArray as $dbKey => $userArray ) {
-                               if ( isset( $userArray[$user->getId()] ) ) {
-                                       $this->stats->increment( 'WatchedItemStore.uncacheUser.items' );
-                                       $this->cache->delete( $userArray[$user->getId()] );
-                               }
-                       }
-               }
-       }
-
-       /**
-        * @param User $user
-        * @param LinkTarget $target
-        *
-        * @return WatchedItem|false
-        */
-       private function getCached( User $user, LinkTarget $target ) {
-               return $this->cache->get( $this->getCacheKey( $user, $target ) );
-       }
-
-       /**
-        * Return an array of conditions to select or update the appropriate database
-        * row.
-        *
-        * @param User $user
-        * @param LinkTarget $target
-        *
-        * @return array
-        */
-       private function dbCond( User $user, LinkTarget $target ) {
-               return [
-                       'wl_user' => $user->getId(),
-                       'wl_namespace' => $target->getNamespace(),
-                       'wl_title' => $target->getDBkey(),
-               ];
-       }
-
-       /**
-        * @param int $dbIndex DB_MASTER or DB_REPLICA
-        *
-        * @return IDatabase
-        * @throws MWException
-        */
-       private function getConnectionRef( $dbIndex ) {
-               return $this->loadBalancer->getConnectionRef( $dbIndex, [ 'watchlist' ] );
-       }
-
-       /**
-        * Count the number of individual items that are watched by the user.
-        * If a subject and corresponding talk page are watched this will return 2.
-        *
-        * @param User $user
-        *
-        * @return int
-        */
-       public function countWatchedItems( User $user ) {
-               $dbr = $this->getConnectionRef( DB_REPLICA );
-               $return = (int)$dbr->selectField(
-                       'watchlist',
-                       'COUNT(*)',
-                       [
-                               'wl_user' => $user->getId()
-                       ],
-                       __METHOD__
-               );
-
-               return $return;
-       }
-
-       /**
-        * @param LinkTarget $target
-        *
-        * @return int
-        */
-       public function countWatchers( LinkTarget $target ) {
-               $dbr = $this->getConnectionRef( DB_REPLICA );
-               $return = (int)$dbr->selectField(
-                       'watchlist',
-                       'COUNT(*)',
-                       [
-                               'wl_namespace' => $target->getNamespace(),
-                               'wl_title' => $target->getDBkey(),
-                       ],
-                       __METHOD__
-               );
-
-               return $return;
-       }
-
-       /**
-        * Number of page watchers who also visited a "recent" edit
-        *
-        * @param LinkTarget $target
-        * @param mixed $threshold timestamp accepted by wfTimestamp
-        *
-        * @return int
-        * @throws DBUnexpectedError
-        * @throws MWException
-        */
-       public function countVisitingWatchers( LinkTarget $target, $threshold ) {
-               $dbr = $this->getConnectionRef( DB_REPLICA );
-               $visitingWatchers = (int)$dbr->selectField(
-                       'watchlist',
-                       'COUNT(*)',
-                       [
-                               'wl_namespace' => $target->getNamespace(),
-                               'wl_title' => $target->getDBkey(),
-                               'wl_notificationtimestamp >= ' .
-                               $dbr->addQuotes( $dbr->timestamp( $threshold ) ) .
-                               ' OR wl_notificationtimestamp IS NULL'
-                       ],
-                       __METHOD__
-               );
-
-               return $visitingWatchers;
-       }
-
-       /**
-        * @param LinkTarget[] $targets
-        * @param array $options Allowed keys:
-        *        'minimumWatchers' => int
-        *
-        * @return array multi dimensional like $return[$namespaceId][$titleString] = int $watchers
-        *         All targets will be present in the result. 0 either means no watchers or the number
-        *         of watchers was below the minimumWatchers option if passed.
-        */
-       public function countWatchersMultiple( array $targets, array $options = [] ) {
-               $dbOptions = [ 'GROUP BY' => [ 'wl_namespace', 'wl_title' ] ];
-
-               $dbr = $this->getConnectionRef( DB_REPLICA );
-
-               if ( array_key_exists( 'minimumWatchers', $options ) ) {
-                       $dbOptions['HAVING'] = 'COUNT(*) >= ' . (int)$options['minimumWatchers'];
-               }
-
-               $lb = new LinkBatch( $targets );
-               $res = $dbr->select(
-                       'watchlist',
-                       [ 'wl_title', 'wl_namespace', 'watchers' => 'COUNT(*)' ],
-                       [ $lb->constructSet( 'wl', $dbr ) ],
-                       __METHOD__,
-                       $dbOptions
-               );
-
-               $watchCounts = [];
-               foreach ( $targets as $linkTarget ) {
-                       $watchCounts[$linkTarget->getNamespace()][$linkTarget->getDBkey()] = 0;
-               }
-
-               foreach ( $res as $row ) {
-                       $watchCounts[$row->wl_namespace][$row->wl_title] = (int)$row->watchers;
-               }
-
-               return $watchCounts;
-       }
-
-       /**
-        * Number of watchers of each page who have visited recent edits to that page
-        *
-        * @param array $targetsWithVisitThresholds array of pairs (LinkTarget $target, mixed $threshold),
-        *        $threshold is:
-        *        - a timestamp of the recent edit if $target exists (format accepted by wfTimestamp)
-        *        - null if $target doesn't exist
-        * @param int|null $minimumWatchers
-        * @return array multi-dimensional like $return[$namespaceId][$titleString] = $watchers,
-        *         where $watchers is an int:
-        *         - if the page exists, number of users watching who have visited the page recently
-        *         - if the page doesn't exist, number of users that have the page on their watchlist
-        *         - 0 means there are no visiting watchers or their number is below the minimumWatchers
-        *         option (if passed).
-        */
-       public function countVisitingWatchersMultiple(
-               array $targetsWithVisitThresholds,
-               $minimumWatchers = null
-       ) {
-               $dbr = $this->getConnectionRef( DB_REPLICA );
-
-               $conds = $this->getVisitingWatchersCondition( $dbr, $targetsWithVisitThresholds );
-
-               $dbOptions = [ 'GROUP BY' => [ 'wl_namespace', 'wl_title' ] ];
-               if ( $minimumWatchers !== null ) {
-                       $dbOptions['HAVING'] = 'COUNT(*) >= ' . (int)$minimumWatchers;
-               }
-               $res = $dbr->select(
-                       'watchlist',
-                       [ 'wl_namespace', 'wl_title', 'watchers' => 'COUNT(*)' ],
-                       $conds,
-                       __METHOD__,
-                       $dbOptions
-               );
-
-               $watcherCounts = [];
-               foreach ( $targetsWithVisitThresholds as list( $target ) ) {
-                       /* @var LinkTarget $target */
-                       $watcherCounts[$target->getNamespace()][$target->getDBkey()] = 0;
-               }
-
-               foreach ( $res as $row ) {
-                       $watcherCounts[$row->wl_namespace][$row->wl_title] = (int)$row->watchers;
-               }
-
-               return $watcherCounts;
-       }
-
-       /**
-        * Generates condition for the query used in a batch count visiting watchers.
-        *
-        * @param IDatabase $db
-        * @param array $targetsWithVisitThresholds array of pairs (LinkTarget, last visit threshold)
-        * @return string
-        */
-       private function getVisitingWatchersCondition(
-               IDatabase $db,
-               array $targetsWithVisitThresholds
-       ) {
-               $missingTargets = [];
-               $namespaceConds = [];
-               foreach ( $targetsWithVisitThresholds as list( $target, $threshold ) ) {
-                       if ( $threshold === null ) {
-                               $missingTargets[] = $target;
-                               continue;
-                       }
-                       /* @var LinkTarget $target */
-                       $namespaceConds[$target->getNamespace()][] = $db->makeList( [
-                               'wl_title = ' . $db->addQuotes( $target->getDBkey() ),
-                               $db->makeList( [
-                                       'wl_notificationtimestamp >= ' . $db->addQuotes( $db->timestamp( $threshold ) ),
-                                       'wl_notificationtimestamp IS NULL'
-                               ], LIST_OR )
-                       ], LIST_AND );
-               }
-
-               $conds = [];
-               foreach ( $namespaceConds as $namespace => $pageConds ) {
-                       $conds[] = $db->makeList( [
-                               'wl_namespace = ' . $namespace,
-                               '(' . $db->makeList( $pageConds, LIST_OR ) . ')'
-                       ], LIST_AND );
-               }
-
-               if ( $missingTargets ) {
-                       $lb = new LinkBatch( $missingTargets );
-                       $conds[] = $lb->constructSet( 'wl', $db );
-               }
-
-               return $db->makeList( $conds, LIST_OR );
-       }
-
-       /**
-        * Get an item (may be cached)
-        *
-        * @param User $user
-        * @param LinkTarget $target
-        *
-        * @return WatchedItem|false
-        */
-       public function getWatchedItem( User $user, LinkTarget $target ) {
-               if ( $user->isAnon() ) {
-                       return false;
-               }
-
-               $cached = $this->getCached( $user, $target );
-               if ( $cached ) {
-                       $this->stats->increment( 'WatchedItemStore.getWatchedItem.cached' );
-                       return $cached;
-               }
-               $this->stats->increment( 'WatchedItemStore.getWatchedItem.load' );
-               return $this->loadWatchedItem( $user, $target );
-       }
-
-       /**
-        * Loads an item from the db
-        *
-        * @param User $user
-        * @param LinkTarget $target
-        *
-        * @return WatchedItem|false
-        */
-       public function loadWatchedItem( User $user, LinkTarget $target ) {
-               // Only loggedin user can have a watchlist
-               if ( $user->isAnon() ) {
-                       return false;
-               }
-
-               $dbr = $this->getConnectionRef( DB_REPLICA );
-               $row = $dbr->selectRow(
-                       'watchlist',
-                       'wl_notificationtimestamp',
-                       $this->dbCond( $user, $target ),
-                       __METHOD__
-               );
-
-               if ( !$row ) {
-                       return false;
-               }
-
-               $item = new WatchedItem(
-                       $user,
-                       $target,
-                       wfTimestampOrNull( TS_MW, $row->wl_notificationtimestamp )
-               );
-               $this->cache( $item );
-
-               return $item;
-       }
-
-       /**
-        * @param User $user
-        * @param array $options Allowed keys:
-        *        'forWrite' => bool defaults to false
-        *        'sort' => string optional sorting by namespace ID and title
-        *                     one of the self::SORT_* constants
-        *
-        * @return WatchedItem[]
-        */
-       public function getWatchedItemsForUser( User $user, array $options = [] ) {
-               $options += [ 'forWrite' => false ];
-
-               $dbOptions = [];
-               if ( array_key_exists( 'sort', $options ) ) {
-                       Assert::parameter(
-                               ( in_array( $options['sort'], [ self::SORT_ASC, self::SORT_DESC ] ) ),
-                               '$options[\'sort\']',
-                               'must be SORT_ASC or SORT_DESC'
-                       );
-                       $dbOptions['ORDER BY'] = [
-                               "wl_namespace {$options['sort']}",
-                               "wl_title {$options['sort']}"
-                       ];
-               }
-               $db = $this->getConnectionRef( $options['forWrite'] ? DB_MASTER : DB_REPLICA );
-
-               $res = $db->select(
-                       'watchlist',
-                       [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                       [ 'wl_user' => $user->getId() ],
-                       __METHOD__,
-                       $dbOptions
-               );
-
-               $watchedItems = [];
-               foreach ( $res as $row ) {
-                       // @todo: Should we add these to the process cache?
-                       $watchedItems[] = new WatchedItem(
-                               $user,
-                               new TitleValue( (int)$row->wl_namespace, $row->wl_title ),
-                               $row->wl_notificationtimestamp
-                       );
-               }
-
-               return $watchedItems;
-       }
-
-       /**
-        * Must be called separately for Subject & Talk namespaces
-        *
-        * @param User $user
-        * @param LinkTarget $target
-        *
-        * @return bool
-        */
-       public function isWatched( User $user, LinkTarget $target ) {
-               return (bool)$this->getWatchedItem( $user, $target );
-       }
-
-       /**
-        * @param User $user
-        * @param LinkTarget[] $targets
-        *
-        * @return array multi-dimensional like $return[$namespaceId][$titleString] = $timestamp,
-        *         where $timestamp is:
-        *         - string|null value of wl_notificationtimestamp,
-        *         - false if $target is not watched by $user.
-        */
-       public function getNotificationTimestampsBatch( User $user, array $targets ) {
-               $timestamps = [];
-               foreach ( $targets as $target ) {
-                       $timestamps[$target->getNamespace()][$target->getDBkey()] = false;
-               }
-
-               if ( $user->isAnon() ) {
-                       return $timestamps;
-               }
-
-               $targetsToLoad = [];
-               foreach ( $targets as $target ) {
-                       $cachedItem = $this->getCached( $user, $target );
-                       if ( $cachedItem ) {
-                               $timestamps[$target->getNamespace()][$target->getDBkey()] =
-                                       $cachedItem->getNotificationTimestamp();
-                       } else {
-                               $targetsToLoad[] = $target;
-                       }
-               }
-
-               if ( !$targetsToLoad ) {
-                       return $timestamps;
-               }
-
-               $dbr = $this->getConnectionRef( DB_REPLICA );
-
-               $lb = new LinkBatch( $targetsToLoad );
-               $res = $dbr->select(
-                       'watchlist',
-                       [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                       [
-                               $lb->constructSet( 'wl', $dbr ),
-                               'wl_user' => $user->getId(),
-                       ],
-                       __METHOD__
-               );
-
-               foreach ( $res as $row ) {
-                       $timestamps[$row->wl_namespace][$row->wl_title] =
-                               wfTimestampOrNull( TS_MW, $row->wl_notificationtimestamp );
-               }
-
-               return $timestamps;
-       }
-
-       /**
-        * Must be called separately for Subject & Talk namespaces
-        *
-        * @param User $user
-        * @param LinkTarget $target
-        */
-       public function addWatch( User $user, LinkTarget $target ) {
-               $this->addWatchBatchForUser( $user, [ $target ] );
-       }
-
-       /**
-        * @param User $user
-        * @param LinkTarget[] $targets
-        *
-        * @return bool success
-        */
-       public function addWatchBatchForUser( User $user, array $targets ) {
-               if ( $this->readOnlyMode->isReadOnly() ) {
-                       return false;
-               }
-               // Only loggedin user can have a watchlist
-               if ( $user->isAnon() ) {
-                       return false;
-               }
-
-               if ( !$targets ) {
-                       return true;
-               }
-
-               $rows = [];
-               $items = [];
-               foreach ( $targets as $target ) {
-                       $rows[] = [
-                               'wl_user' => $user->getId(),
-                               'wl_namespace' => $target->getNamespace(),
-                               'wl_title' => $target->getDBkey(),
-                               'wl_notificationtimestamp' => null,
-                       ];
-                       $items[] = new WatchedItem(
-                               $user,
-                               $target,
-                               null
-                       );
-                       $this->uncache( $user, $target );
-               }
-
-               $dbw = $this->getConnectionRef( DB_MASTER );
-               foreach ( array_chunk( $rows, 100 ) as $toInsert ) {
-                       // Use INSERT IGNORE to avoid overwriting the notification timestamp
-                       // if there's already an entry for this page
-                       $dbw->insert( 'watchlist', $toInsert, __METHOD__, 'IGNORE' );
-               }
-               // Update process cache to ensure skin doesn't claim that the current
-               // page is unwatched in the response of action=watch itself (T28292).
-               // This would otherwise be re-queried from a slave by isWatched().
-               foreach ( $items as $item ) {
-                       $this->cache( $item );
-               }
-
-               return true;
-       }
-
-       /**
-        * Removes the an entry for the User watching the LinkTarget
-        * Must be called separately for Subject & Talk namespaces
-        *
-        * @param User $user
-        * @param LinkTarget $target
-        *
-        * @return bool success
-        * @throws DBUnexpectedError
-        * @throws MWException
-        */
-       public function removeWatch( User $user, LinkTarget $target ) {
-               // Only logged in user can have a watchlist
-               if ( $this->readOnlyMode->isReadOnly() || $user->isAnon() ) {
-                       return false;
-               }
-
-               $this->uncache( $user, $target );
-
-               $dbw = $this->getConnectionRef( DB_MASTER );
-               $dbw->delete( 'watchlist',
-                       [
-                               'wl_user' => $user->getId(),
-                               'wl_namespace' => $target->getNamespace(),
-                               'wl_title' => $target->getDBkey(),
-                       ], __METHOD__
-               );
-               $success = (bool)$dbw->affectedRows();
-
-               return $success;
-       }
-
-       /**
-        * @param User $user The user to set the timestamp for
-        * @param string|null $timestamp Set the update timestamp to this value
-        * @param LinkTarget[] $targets List of targets to update. Default to all targets
-        *
-        * @return bool success
-        */
-       public function setNotificationTimestampsForUser( User $user, $timestamp, array $targets = [] ) {
-               // Only loggedin user can have a watchlist
-               if ( $user->isAnon() ) {
-                       return false;
-               }
-
-               $dbw = $this->getConnectionRef( DB_MASTER );
-
-               $conds = [ 'wl_user' => $user->getId() ];
-               if ( $targets ) {
-                       $batch = new LinkBatch( $targets );
-                       $conds[] = $batch->constructSet( 'wl', $dbw );
-               }
-
-               if ( $timestamp !== null ) {
-                       $timestamp = $dbw->timestamp( $timestamp );
-               }
-
-               $success = $dbw->update(
-                       'watchlist',
-                       [ 'wl_notificationtimestamp' => $timestamp ],
-                       $conds,
-                       __METHOD__
-               );
-
-               $this->uncacheUser( $user );
-
-               return $success;
-       }
-
-       /**
-        * @param User $editor The editor that triggered the update. Their notification
-        *  timestamp will not be updated(they have already seen it)
-        * @param LinkTarget $target The target to update timestamps for
-        * @param string $timestamp Set the update timestamp to this value
-        *
-        * @return int[] Array of user IDs the timestamp has been updated for
-        */
-       public function updateNotificationTimestamp( User $editor, LinkTarget $target, $timestamp ) {
-               $dbw = $this->getConnectionRef( DB_MASTER );
-               $uids = $dbw->selectFieldValues(
-                       'watchlist',
-                       'wl_user',
-                       [
-                               'wl_user != ' . intval( $editor->getId() ),
-                               'wl_namespace' => $target->getNamespace(),
-                               'wl_title' => $target->getDBkey(),
-                               'wl_notificationtimestamp IS NULL',
-                       ],
-                       __METHOD__
-               );
-
-               $watchers = array_map( 'intval', $uids );
-               if ( $watchers ) {
-                       // Update wl_notificationtimestamp for all watching users except the editor
-                       $fname = __METHOD__;
-                       DeferredUpdates::addCallableUpdate(
-                               function () use ( $timestamp, $watchers, $target, $fname ) {
-                                       global $wgUpdateRowsPerQuery;
-
-                                       $dbw = $this->getConnectionRef( DB_MASTER );
-                                       $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-                                       $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
-
-                                       $watchersChunks = array_chunk( $watchers, $wgUpdateRowsPerQuery );
-                                       foreach ( $watchersChunks as $watchersChunk ) {
-                                               $dbw->update( 'watchlist',
-                                                       [ /* SET */
-                                                               'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
-                                                       ], [ /* WHERE - TODO Use wl_id T130067 */
-                                                               'wl_user' => $watchersChunk,
-                                                               'wl_namespace' => $target->getNamespace(),
-                                                               'wl_title' => $target->getDBkey(),
-                                                       ], $fname
-                                               );
-                                               if ( count( $watchersChunks ) > 1 ) {
-                                                       $factory->commitAndWaitForReplication(
-                                                               __METHOD__, $ticket, [ 'domain' => $dbw->getDomainID() ]
-                                                       );
-                                               }
-                                       }
-                                       $this->uncacheLinkTarget( $target );
-                               },
-                               DeferredUpdates::POSTSEND,
-                               $dbw
-                       );
-               }
-
-               return $watchers;
-       }
-
-       /**
-        * Reset the notification timestamp of this entry
-        *
-        * @param User $user
-        * @param Title $title
-        * @param string $force Whether to force the write query to be executed even if the
-        *    page is not watched or the notification timestamp is already NULL.
-        *    'force' in order to force
-        * @param int $oldid The revision id being viewed. If not given or 0, latest revision is assumed.
-        *
-        * @return bool success
-        */
-       public function resetNotificationTimestamp( User $user, Title $title, $force = '', $oldid = 0 ) {
-               // Only loggedin user can have a watchlist
-               if ( $this->readOnlyMode->isReadOnly() || $user->isAnon() ) {
-                       return false;
-               }
-
-               $item = null;
-               if ( $force != 'force' ) {
-                       $item = $this->loadWatchedItem( $user, $title );
-                       if ( !$item || $item->getNotificationTimestamp() === null ) {
-                               return false;
-                       }
-               }
-
-               // If the page is watched by the user (or may be watched), update the timestamp
-               $job = new ActivityUpdateJob(
-                       $title,
-                       [
-                               'type'      => 'updateWatchlistNotification',
-                               'userid'    => $user->getId(),
-                               'notifTime' => $this->getNotificationTimestamp( $user, $title, $item, $force, $oldid ),
-                               'curTime'   => time()
-                       ]
-               );
-
-               // Try to run this post-send
-               // Calls DeferredUpdates::addCallableUpdate in normal operation
-               call_user_func(
-                       $this->deferredUpdatesAddCallableUpdateCallback,
-                       function () use ( $job ) {
-                               $job->run();
-                       }
-               );
-
-               $this->uncache( $user, $title );
-
-               return true;
-       }
-
-       private function getNotificationTimestamp( User $user, Title $title, $item, $force, $oldid ) {
-               if ( !$oldid ) {
-                       // No oldid given, assuming latest revision; clear the timestamp.
-                       return null;
-               }
-
-               if ( !$title->getNextRevisionID( $oldid ) ) {
-                       // Oldid given and is the latest revision for this title; clear the timestamp.
-                       return null;
-               }
-
-               if ( $item === null ) {
-                       $item = $this->loadWatchedItem( $user, $title );
-               }
-
-               if ( !$item ) {
-                       // This can only happen if $force is enabled.
-                       return null;
-               }
-
-               // Oldid given and isn't the latest; update the timestamp.
-               // This will result in no further notification emails being sent!
-               // Calls Revision::getTimestampFromId in normal operation
-               $notificationTimestamp = call_user_func(
-                       $this->revisionGetTimestampFromIdCallback,
-                       $title,
-                       $oldid
-               );
-
-               // We need to go one second to the future because of various strict comparisons
-               // throughout the codebase
-               $ts = new MWTimestamp( $notificationTimestamp );
-               $ts->timestamp->add( new DateInterval( 'PT1S' ) );
-               $notificationTimestamp = $ts->getTimestamp( TS_MW );
-
-               if ( $notificationTimestamp < $item->getNotificationTimestamp() ) {
-                       if ( $force != 'force' ) {
-                               return false;
-                       } else {
-                               // This is a little silly…
-                               return $item->getNotificationTimestamp();
-                       }
-               }
-
-               return $notificationTimestamp;
-       }
-
-       /**
-        * @param User $user
-        * @param int $unreadLimit
-        *
-        * @return int|bool The number of unread notifications
-        *                  true if greater than or equal to $unreadLimit
-        */
-       public function countUnreadNotifications( User $user, $unreadLimit = null ) {
-               $queryOptions = [];
-               if ( $unreadLimit !== null ) {
-                       $unreadLimit = (int)$unreadLimit;
-                       $queryOptions['LIMIT'] = $unreadLimit;
-               }
-
-               $dbr = $this->getConnectionRef( DB_REPLICA );
-               $rowCount = $dbr->selectRowCount(
-                       'watchlist',
-                       '1',
-                       [
-                               'wl_user' => $user->getId(),
-                               'wl_notificationtimestamp IS NOT NULL',
-                       ],
-                       __METHOD__,
-                       $queryOptions
-               );
-
-               if ( !isset( $unreadLimit ) ) {
-                       return $rowCount;
-               }
-
-               if ( $rowCount >= $unreadLimit ) {
-                       return true;
-               }
-
-               return $rowCount;
-       }
-
-       /**
-        * Check if the given title already is watched by the user, and if so
-        * add a watch for the new title.
-        *
-        * To be used for page renames and such.
-        *
-        * @param LinkTarget $oldTarget
-        * @param LinkTarget $newTarget
-        */
-       public function duplicateAllAssociatedEntries( LinkTarget $oldTarget, LinkTarget $newTarget ) {
-               $oldTarget = Title::newFromLinkTarget( $oldTarget );
-               $newTarget = Title::newFromLinkTarget( $newTarget );
-
-               $this->duplicateEntry( $oldTarget->getSubjectPage(), $newTarget->getSubjectPage() );
-               $this->duplicateEntry( $oldTarget->getTalkPage(), $newTarget->getTalkPage() );
-       }
-
-       /**
-        * Check if the given title already is watched by the user, and if so
-        * add a watch for the new title.
-        *
-        * To be used for page renames and such.
-        * This must be called separately for Subject and Talk pages
-        *
-        * @param LinkTarget $oldTarget
-        * @param LinkTarget $newTarget
-        */
-       public function duplicateEntry( LinkTarget $oldTarget, LinkTarget $newTarget ) {
-               $dbw = $this->getConnectionRef( DB_MASTER );
-
-               $result = $dbw->select(
-                       'watchlist',
-                       [ 'wl_user', 'wl_notificationtimestamp' ],
-                       [
-                               'wl_namespace' => $oldTarget->getNamespace(),
-                               'wl_title' => $oldTarget->getDBkey(),
-                       ],
-                       __METHOD__,
-                       [ 'FOR UPDATE' ]
-               );
-
-               $newNamespace = $newTarget->getNamespace();
-               $newDBkey = $newTarget->getDBkey();
-
-               # Construct array to replace into the watchlist
-               $values = [];
-               foreach ( $result as $row ) {
-                       $values[] = [
-                               'wl_user' => $row->wl_user,
-                               'wl_namespace' => $newNamespace,
-                               'wl_title' => $newDBkey,
-                               'wl_notificationtimestamp' => $row->wl_notificationtimestamp,
-                       ];
-               }
-
-               if ( !empty( $values ) ) {
-                       # Perform replace
-                       # Note that multi-row replace is very efficient for MySQL but may be inefficient for
-                       # some other DBMSes, mostly due to poor simulation by us
-                       $dbw->replace(
-                               'watchlist',
-                               [ [ 'wl_user', 'wl_namespace', 'wl_title' ] ],
-                               $values,
-                               __METHOD__
-                       );
-               }
-       }
-
-}
index fcb4af4..ea42e24 100644 (file)
        "api-help-permissions-granted-to": "Uděleno {{PLURAL:$1|skupině|skupinám}}: $2",
        "api-help-right-apihighlimits": "Používání vyšších limitů v API dotazech (pomalé dotazy: $1, rychlé dotazy: $2). Limity pro pomalé dotazy se vztahují i na vícehodnotové parametry.",
        "api-help-open-in-apisandbox": "<small>[otevřít v pískovišti]</small>",
+       "apierror-mustbeloggedin": "Abyste mohli $1, musíte být přihlášeni.",
        "apierror-nosuchsection-what": "$2 neobsahuje sekci $1.",
        "apierror-sectionsnotsupported-what": "$1 nepodporuje sekce.",
        "apierror-timeout": "Server neodpověděl v očekávaném čase.",
index 0410ddf..a2dc344 100644 (file)
        "apihelp-import-param-xml": "업로드한 XML 파일.",
        "apihelp-linkaccount-summary": "서드파티 제공자의 계정을 현재 사용자와 연결합니다.",
        "apihelp-login-summary": "로그인한 다음 인증 쿠키를 가져옵니다.",
+       "apihelp-login-extended-description": "이 동작은 [[Special:BotPasswords|특수:BotPasswords]]와 함께 사용해야만 합니다. 주 계정 로그인을 위해 사용하는 것은 권장되지 않으며 경고 없이 실패할 수 있습니다. 주 계정에 안전하게 로그인하려면 <kbd>[[Special:ApiHelp/clientlogin|action=clientlogin]]</kbd>을 사용하십시오.",
        "apihelp-login-param-name": "사용자 이름.",
        "apihelp-login-param-password": "비밀번호.",
        "apihelp-login-param-domain": "도메인 (선택).",
index 1c8877c..2e89ea3 100644 (file)
        "apihelp-options-example-complex": "Tilbakestill alle innstillinger, og sett så <kbd>skin</kbd> og <kbd>nickname</kbd>.",
        "apihelp-paraminfo-summary": "Hent informasjon om API-moduler.",
        "apihelp-paraminfo-param-helpformat": "Format for hjelpestrenger.",
+       "apihelp-parse-param-prop": "Hvilke informasjonsdeler som skal hentes:",
+       "apihelp-parse-paramvalue-prop-categorieshtml": "Gir HTML-versjonen av kategoriene.",
+       "apihelp-parse-paramvalue-prop-headitems": "Gir elementer som skal puttes i <code>&lt;head&gt;</code>-taggen til siden.",
+       "apihelp-patrol-summary": "Patruljer en side eller revisjon.",
        "apihelp-query+allfileusages-paramvalue-prop-title": "Legger til filens tittel.",
        "apihelp-query+allfileusages-param-limit": "Hvor mange elementer som skal returneres totalt.",
        "apihelp-query+allfileusages-param-dir": "Retningen det skal listes opp i.",
index 8c1f8dc..c633431 100644 (file)
@@ -102,7 +102,7 @@ class MWException extends Exception {
                } else {
                        $logId = WebRequest::getRequestId();
                        $type = static::class;
-                       return "<div class=\"errorbox\">" .
+                       return Html::errorBox(
                        '[' . $logId . '] ' .
                        gmdate( 'Y-m-d H:i:s' ) . ": " .
                        $this->msg( "internalerror-fatal-exception",
@@ -110,7 +110,7 @@ class MWException extends Exception {
                                $type,
                                $logId,
                                MWExceptionHandler::getURL( $this )
-                       ) . "</div>\n" .
+                       ) ) .
                        "<!-- Set \$wgShowExceptionDetails = true; " .
                        "at the bottom of LocalSettings.php to show detailed " .
                        "debugging information. -->";
index 4d6095c..0925091 100644 (file)
        "config-missing-db-host": "\"{{int:config-db-host}}\"-rentzako balioa sartu behar duzu.",
        "config-missing-db-server-oracle": "\"{{int:config-db-host-oracle}}\"-rentzako balioa sartu behar duzu.",
        "config-invalid-db-server-oracle": "\"$1\" TNS datu basea baliogabea.\nErabili \"TNS izena\" edo \"Konektagarritasun erraza\" katea ([http://docs.oracle.com/cd/E11882_01/network.112/e10836/naming.htm Oracle Naming Methods]).",
+       "config-invalid-db-name": "Datu-basearen izen okerra \"$1\"\nErabil ezazu ASCII letrak bakarrik (a-z, A-Z), zenbakiak (09), behe-gidoiak (_) eta gidoiak (-)",
+       "config-invalid-db-prefix": "Datu-basearen aurrizki okerra \"$1\"\nErabil ezazu ASCII letrak bakarrik (a-z, A-Z) behe-gidoiak (_) eta gidoiak (-)",
        "config-connection-error": "$1\n\nHost-a, erabiltzaile izena eta pasahitza egiaztatu eta saiatu berriro.",
+       "config-invalid-schema": "MediaWikiko eskema okerra \"$1\"\nErabil ezazu ASCII letrak bakarrik (a-z, A-Z) behe-gidoiak (_).",
        "config-db-sys-create-oracle": "Instalatzaileak bakarrik jasaten du SYSBDA kontu bat erabiltzaile kontu berri bat sortzeko.",
        "config-db-sys-user-exists-oracle": "$1 erabiltzaile kontua dagoeneko existitzen da. SYSDBA kontu berri bat sortzeko erabili daiteke soilik!",
        "config-postgres-old": "PostgreSQL $1 edo berriagoa behar da. Zuk $2 badaukazu.",
index f61c139..21558f7 100644 (file)
  * @since 1.22
  */
 class HashRing {
-       /** @var Array (location => weight) */
+       /** @var array (location => weight) */
        protected $sourceMap = [];
-       /** @var Array (location => (start, end)) */
+       /** @var array (location => (start, end)) */
        protected $ring = [];
 
        /** @var HashRing|null */
        protected $liveRing;
-       /** @var Array (location => UNIX timestamp) */
+       /** @var array (location => UNIX timestamp) */
        protected $ejectionExpiries = [];
        /** @var int UNIX timestamp */
        protected $ejectionNextExpiry = INF;
index df189af..c9dc273 100644 (file)
@@ -590,7 +590,7 @@ class Article implements Page {
                                                        $outputPage->setRobotPolicy( 'noindex,nofollow' );
 
                                                        $errortext = $error->getWikiText( false, 'view-pool-error' );
-                                                       $outputPage->addWikiText( '<div class="errorbox">' . $errortext . '</div>' );
+                                                       $outputPage->addWikiText( Html::errorBox( $errortext ) );
                                                }
                                                # Connection or timeout error
                                                return;
index ee8d841..1ad1ab0 100644 (file)
@@ -96,12 +96,9 @@ class SkinFallbackTemplate extends BaseTemplate {
         * warning message and page content.
         */
        public function execute() {
-               $this->html( 'headelement' ) ?>
-
-               <div class="warningbox">
-                       <?php echo $this->buildHelpfulInformationMessage() ?>
-               </div>
-
+               $this->html( 'headelement' );
+               echo Html::warningBox( $this->buildHelpfulInformationMessage() );
+       ?>
                <form action="<?php $this->text( 'wgScript' ) ?>">
                        <input type="hidden" name="title" value="<?php $this->text( 'searchtitle' ) ?>" />
                        <h3><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h3>
index 476c452..eb0f0aa 100644 (file)
@@ -451,9 +451,8 @@ class SpecialEditTags extends UnlistedSpecialPage {
         */
        protected function failure( $status ) {
                $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
-               $this->getOutput()->addWikiText( '<div class="errorbox">' .
-                       $status->getWikiText( 'tags-edit-failure' ) .
-                       '</div>'
+               $this->getOutput()->addWikiText(
+                       Html::errorBox( $status->getWikiText( 'tags-edit-failure' ) )
                );
                $this->showForm();
        }
index 46d7cf7..02d6d00 100644 (file)
@@ -235,18 +235,18 @@ class MovePageForm extends UnlistedSpecialPage {
                }
 
                if ( count( $err ) ) {
-                       $out->addHTML( "<div class='errorbox'>\n" );
                        $action_desc = $this->msg( 'action-move' )->plain();
-                       $out->addWikiMsg( 'permissionserrorstext-withaction', count( $err ), $action_desc );
+                       $errMsgHtml = $this->msg( 'permissionserrorstext-withaction',
+                               count( $err ), $action_desc )->parseAsBlock();
 
                        if ( count( $err ) == 1 ) {
                                $errMsg = $err[0];
                                $errMsgName = array_shift( $errMsg );
 
                                if ( $errMsgName == 'hookaborted' ) {
-                                       $out->addHTML( "<p>{$errMsg[0]}</p>\n" );
+                                       $errMsgHtml .= "<p>{$errMsg[0]}</p>\n";
                                } else {
-                                       $out->addWikiMsgArray( $errMsgName, $errMsg );
+                                       $errMsgHtml .= $this->msg( $errMsgName, $errMsg )->parseAsBlock();
                                }
                        } else {
                                $errStr = [];
@@ -260,9 +260,9 @@ class MovePageForm extends UnlistedSpecialPage {
                                        }
                                }
 
-                               $out->addHTML( '<ul><li>' . implode( "</li>\n<li>", $errStr ) . "</li></ul>\n" );
+                               $errMsgHtml .= '<ul><li>' . implode( "</li>\n<li>", $errStr ) . "</li></ul>\n";
                        }
-                       $out->addHTML( "</div>\n" );
+                       $out->addHTML( Html::errorBox( $errMsgHtml ) );
                }
 
                if ( $this->oldTitle->isProtected( 'move' ) ) {
index 99880de..358a309 100644 (file)
@@ -62,8 +62,9 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges {
                $outputPage = $this->getOutput();
                $title = Title::newFromText( $target );
                if ( !$title || $title->isExternal() ) {
-                       $outputPage->addHTML( '<div class="errorbox">' . $this->msg( 'allpagesbadtitle' )
-                                       ->parse() . '</div>' );
+                       $outputPage->addHTML(
+                               Html::errorBox( $this->msg( 'allpagesbadtitle' )->parse() )
+                       );
 
                        return false;
                }
index 3e89686..964a261 100644 (file)
@@ -74,7 +74,7 @@ class SpecialResetTokens extends FormSpecialPage {
 
        public function onSuccess() {
                $this->getOutput()->wrapWikiMsg(
-                       "<div class='successbox'>\n$1\n</div>",
+                       Html::successBox( '$1' ),
                        'resettokens-done'
                );
        }
index e1d4dd1..8edebf2 100644 (file)
@@ -636,9 +636,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
        protected function failure( $status ) {
                // Messages: revdelete-failure, logdelete-failure
                $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
-               $this->getOutput()->addWikiText( '<div class="errorbox">' .
-                       $status->getWikiText( $this->typeLabels['failure'] ) .
-                       '</div>'
+               $this->getOutput()->addWikiText(
+                       Html::errorBox(
+                               $status->getWikiText( $this->typeLabels['failure'] )
+                       )
                );
                $this->showForm();
        }
index 09210e4..b3a58cb 100644 (file)
@@ -365,16 +365,12 @@ class SpecialSearch extends SpecialPage {
                if ( $hasErrors ) {
                        list( $error, $warning ) = $textStatus->splitByErrorType();
                        if ( $error->getErrors() ) {
-                               $out->addHTML( Html::rawElement(
-                                       'div',
-                                       [ 'class' => 'errorbox' ],
+                               $out->addHTML( Html::errorBox(
                                        $error->getHTML( 'search-error' )
                                ) );
                        }
                        if ( $warning->getErrors() ) {
-                               $out->addHTML( Html::rawElement(
-                                       'div',
-                                       [ 'class' => 'warningbox' ],
+                               $out->addHTML( Html::warningBox(
                                        $warning->getHTML( 'search-warning' )
                                ) );
                        }
diff --git a/includes/watcheditem/WatchedItem.php b/includes/watcheditem/WatchedItem.php
new file mode 100644 (file)
index 0000000..bfd1d61
--- /dev/null
@@ -0,0 +1,200 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Watchlist
+ */
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Linker\LinkTarget;
+
+/**
+ * Representation of a pair of user and title for watchlist entries.
+ *
+ * @author Tim Starling
+ * @author Addshore
+ *
+ * @ingroup Watchlist
+ */
+class WatchedItem {
+
+       /**
+        * @deprecated since 1.27, see User::IGNORE_USER_RIGHTS
+        */
+       const IGNORE_USER_RIGHTS = User::IGNORE_USER_RIGHTS;
+
+       /**
+        * @deprecated since 1.27, see User::CHECK_USER_RIGHTS
+        */
+       const CHECK_USER_RIGHTS = User::CHECK_USER_RIGHTS;
+
+       /**
+        * @deprecated Internal class use only
+        */
+       const DEPRECATED_USAGE_TIMESTAMP = -100;
+
+       /**
+        * @var bool
+        * @deprecated Internal class use only
+        */
+       public $checkRights = User::CHECK_USER_RIGHTS;
+
+       /**
+        * @var Title
+        * @deprecated Internal class use only
+        */
+       private $title;
+
+       /**
+        * @var LinkTarget
+        */
+       private $linkTarget;
+
+       /**
+        * @var User
+        */
+       private $user;
+
+       /**
+        * @var null|string the value of the wl_notificationtimestamp field
+        */
+       private $notificationTimestamp;
+
+       /**
+        * @param User $user
+        * @param LinkTarget $linkTarget
+        * @param null|string $notificationTimestamp the value of the wl_notificationtimestamp field
+        * @param bool|null $checkRights DO NOT USE - used internally for backward compatibility
+        */
+       public function __construct(
+               User $user,
+               LinkTarget $linkTarget,
+               $notificationTimestamp,
+               $checkRights = null
+       ) {
+               $this->user = $user;
+               $this->linkTarget = $linkTarget;
+               $this->notificationTimestamp = $notificationTimestamp;
+               if ( $checkRights !== null ) {
+                       $this->checkRights = $checkRights;
+               }
+       }
+
+       /**
+        * @return User
+        */
+       public function getUser() {
+               return $this->user;
+       }
+
+       /**
+        * @return LinkTarget
+        */
+       public function getLinkTarget() {
+               return $this->linkTarget;
+       }
+
+       /**
+        * Get the notification timestamp of this entry.
+        *
+        * @return bool|null|string
+        */
+       public function getNotificationTimestamp() {
+               // Back compat for objects constructed using self::fromUserTitle
+               if ( $this->notificationTimestamp === self::DEPRECATED_USAGE_TIMESTAMP ) {
+                       // wfDeprecated( __METHOD__, '1.27' );
+                       if ( $this->checkRights && !$this->user->isAllowed( 'viewmywatchlist' ) ) {
+                               return false;
+                       }
+                       $item = MediaWikiServices::getInstance()->getWatchedItemStore()
+                               ->loadWatchedItem( $this->user, $this->linkTarget );
+                       if ( $item ) {
+                               $this->notificationTimestamp = $item->getNotificationTimestamp();
+                       } else {
+                               $this->notificationTimestamp = false;
+                       }
+               }
+               return $this->notificationTimestamp;
+       }
+
+       /**
+        * Back compat pre 1.27 with the WatchedItemStore introduction
+        * @todo remove in 1.28/9
+        * -------------------------------------------------
+        */
+
+       /**
+        * @return Title
+        * @deprecated Internal class use only
+        */
+       public function getTitle() {
+               if ( !$this->title ) {
+                       $this->title = Title::newFromLinkTarget( $this->linkTarget );
+               }
+               return $this->title;
+       }
+
+       /**
+        * @deprecated since 1.27 Use the constructor, WatchedItemStore::getWatchedItem()
+        *             or WatchedItemStore::loadWatchedItem()
+        */
+       public static function fromUserTitle( $user, $title, $checkRights = User::CHECK_USER_RIGHTS ) {
+               wfDeprecated( __METHOD__, '1.27' );
+               return new self( $user, $title, self::DEPRECATED_USAGE_TIMESTAMP, (bool)$checkRights );
+       }
+
+       /**
+        * @deprecated since 1.27 Use User::addWatch()
+        * @return bool
+        */
+       public function addWatch() {
+               wfDeprecated( __METHOD__, '1.27' );
+               $this->user->addWatch( $this->getTitle(), $this->checkRights );
+               return true;
+       }
+
+       /**
+        * @deprecated since 1.27 Use User::removeWatch()
+        * @return bool
+        */
+       public function removeWatch() {
+               wfDeprecated( __METHOD__, '1.27' );
+               if ( $this->checkRights && !$this->user->isAllowed( 'editmywatchlist' ) ) {
+                       return false;
+               }
+               $this->user->removeWatch( $this->getTitle(), $this->checkRights );
+               return true;
+       }
+
+       /**
+        * @deprecated since 1.27 Use User::isWatched()
+        * @return bool
+        */
+       public function isWatched() {
+               wfDeprecated( __METHOD__, '1.27' );
+               return $this->user->isWatched( $this->getTitle(), $this->checkRights );
+       }
+
+       /**
+        * @deprecated since 1.27 Use WatchedItemStore::duplicateAllAssociatedEntries()
+        */
+       public static function duplicateEntries( Title $oldTitle, Title $newTitle ) {
+               wfDeprecated( __METHOD__, '1.27' );
+               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+               $store->duplicateAllAssociatedEntries( $oldTitle, $newTitle );
+       }
+
+}
diff --git a/includes/watcheditem/WatchedItemQueryService.php b/includes/watcheditem/WatchedItemQueryService.php
new file mode 100644 (file)
index 0000000..d0f45be
--- /dev/null
@@ -0,0 +1,684 @@
+<?php
+
+use Wikimedia\Rdbms\IDatabase;
+use MediaWiki\Linker\LinkTarget;
+use Wikimedia\Assert\Assert;
+use Wikimedia\Rdbms\LoadBalancer;
+
+/**
+ * Class performing complex database queries related to WatchedItems.
+ *
+ * @since 1.28
+ *
+ * @file
+ * @ingroup Watchlist
+ *
+ * @license GNU GPL v2+
+ */
+class WatchedItemQueryService {
+
+       const DIR_OLDER = 'older';
+       const DIR_NEWER = 'newer';
+
+       const INCLUDE_FLAGS = 'flags';
+       const INCLUDE_USER = 'user';
+       const INCLUDE_USER_ID = 'userid';
+       const INCLUDE_COMMENT = 'comment';
+       const INCLUDE_PATROL_INFO = 'patrol';
+       const INCLUDE_SIZES = 'sizes';
+       const INCLUDE_LOG_INFO = 'loginfo';
+
+       // FILTER_* constants are part of public API (are used in ApiQueryWatchlist and
+       // ApiQueryWatchlistRaw classes) and should not be changed.
+       // Changing values of those constants will result in a breaking change in the API
+       const FILTER_MINOR = 'minor';
+       const FILTER_NOT_MINOR = '!minor';
+       const FILTER_BOT = 'bot';
+       const FILTER_NOT_BOT = '!bot';
+       const FILTER_ANON = 'anon';
+       const FILTER_NOT_ANON = '!anon';
+       const FILTER_PATROLLED = 'patrolled';
+       const FILTER_NOT_PATROLLED = '!patrolled';
+       const FILTER_UNREAD = 'unread';
+       const FILTER_NOT_UNREAD = '!unread';
+       const FILTER_CHANGED = 'changed';
+       const FILTER_NOT_CHANGED = '!changed';
+
+       const SORT_ASC = 'ASC';
+       const SORT_DESC = 'DESC';
+
+       /**
+        * @var LoadBalancer
+        */
+       private $loadBalancer;
+
+       /** @var WatchedItemQueryServiceExtension[]|null */
+       private $extensions = null;
+
+       /**
+        * @var CommentStore|null */
+       private $commentStore = null;
+
+       public function __construct( LoadBalancer $loadBalancer ) {
+               $this->loadBalancer = $loadBalancer;
+       }
+
+       /**
+        * @return WatchedItemQueryServiceExtension[]
+        */
+       private function getExtensions() {
+               if ( $this->extensions === null ) {
+                       $this->extensions = [];
+                       Hooks::run( 'WatchedItemQueryServiceExtensions', [ &$this->extensions, $this ] );
+               }
+               return $this->extensions;
+       }
+
+       /**
+        * @return IDatabase
+        * @throws MWException
+        */
+       private function getConnection() {
+               return $this->loadBalancer->getConnectionRef( DB_REPLICA, [ 'watchlist' ] );
+       }
+
+       private function getCommentStore() {
+               if ( !$this->commentStore ) {
+                       $this->commentStore = new CommentStore( 'rc_comment' );
+               }
+               return $this->commentStore;
+       }
+
+       /**
+        * @param User $user
+        * @param array $options Allowed keys:
+        *        'includeFields'       => string[] RecentChange fields to be included in the result,
+        *                                 self::INCLUDE_* constants should be used
+        *        'filters'             => string[] optional filters to narrow down resulted items
+        *        'namespaceIds'        => int[] optional namespace IDs to filter by
+        *                                 (defaults to all namespaces)
+        *        'allRevisions'        => bool return multiple revisions of the same page if true,
+        *                                 only the most recent if false (default)
+        *        'rcTypes'             => int[] which types of RecentChanges to include
+        *                                 (defaults to all types), allowed values: RC_EDIT, RC_NEW,
+        *                                 RC_LOG, RC_EXTERNAL, RC_CATEGORIZE
+        *        'onlyByUser'          => string only list changes by a specified user
+        *        'notByUser'           => string do not incluide changes by a specified user
+        *        'dir'                 => string in which direction to enumerate, accepted values:
+        *                                 - DIR_OLDER list newest first
+        *                                 - DIR_NEWER list oldest first
+        *        'start'               => string (format accepted by wfTimestamp) requires 'dir' option,
+        *                                 timestamp to start enumerating from
+        *        'end'                 => string (format accepted by wfTimestamp) requires 'dir' option,
+        *                                 timestamp to end enumerating
+        *        'watchlistOwner'      => User user whose watchlist items should be listed if different
+        *                                 than the one specified with $user param,
+        *                                 requires 'watchlistOwnerToken' option
+        *        'watchlistOwnerToken' => string a watchlist token used to access another user's
+        *                                 watchlist, used with 'watchlistOwnerToken' option
+        *        'limit'               => int maximum numbers of items to return
+        *        'usedInGenerator'     => bool include only RecentChange id field required by the
+        *                                 generator ('rc_cur_id' or 'rc_this_oldid') if true, or all
+        *                                 id fields ('rc_cur_id', 'rc_this_oldid', 'rc_last_oldid')
+        *                                 if false (default)
+        * @param array|null &$startFrom Continuation value: [ string $rcTimestamp, int $rcId ]
+        * @return array of pairs ( WatchedItem $watchedItem, string[] $recentChangeInfo ),
+        *         where $recentChangeInfo contains the following keys:
+        *         - 'rc_id',
+        *         - 'rc_namespace',
+        *         - 'rc_title',
+        *         - 'rc_timestamp',
+        *         - 'rc_type',
+        *         - 'rc_deleted',
+        *         Additional keys could be added by specifying the 'includeFields' option
+        */
+       public function getWatchedItemsWithRecentChangeInfo(
+               User $user, array $options = [], &$startFrom = null
+       ) {
+               $options += [
+                       'includeFields' => [],
+                       'namespaceIds' => [],
+                       'filters' => [],
+                       'allRevisions' => false,
+                       'usedInGenerator' => false
+               ];
+
+               Assert::parameter(
+                       !isset( $options['rcTypes'] )
+                               || !array_diff( $options['rcTypes'], [ RC_EDIT, RC_NEW, RC_LOG, RC_EXTERNAL, RC_CATEGORIZE ] ),
+                       '$options[\'rcTypes\']',
+                       'must be an array containing only: RC_EDIT, RC_NEW, RC_LOG, RC_EXTERNAL and/or RC_CATEGORIZE'
+               );
+               Assert::parameter(
+                       !isset( $options['dir'] ) || in_array( $options['dir'], [ self::DIR_OLDER, self::DIR_NEWER ] ),
+                       '$options[\'dir\']',
+                       'must be DIR_OLDER or DIR_NEWER'
+               );
+               Assert::parameter(
+                       !isset( $options['start'] ) && !isset( $options['end'] ) && $startFrom === null
+                               || isset( $options['dir'] ),
+                       '$options[\'dir\']',
+                       'must be provided when providing the "start" or "end" options or the $startFrom parameter'
+               );
+               Assert::parameter(
+                       !isset( $options['startFrom'] ),
+                       '$options[\'startFrom\']',
+                       'must not be provided, use $startFrom instead'
+               );
+               Assert::parameter(
+                       !isset( $startFrom ) || ( is_array( $startFrom ) && count( $startFrom ) === 2 ),
+                       '$startFrom',
+                       'must be a two-element array'
+               );
+               if ( array_key_exists( 'watchlistOwner', $options ) ) {
+                       Assert::parameterType(
+                               User::class,
+                               $options['watchlistOwner'],
+                               '$options[\'watchlistOwner\']'
+                       );
+                       Assert::parameter(
+                               isset( $options['watchlistOwnerToken'] ),
+                               '$options[\'watchlistOwnerToken\']',
+                               'must be provided when providing watchlistOwner option'
+                       );
+               }
+
+               $db = $this->getConnection();
+
+               $tables = $this->getWatchedItemsWithRCInfoQueryTables( $options );
+               $fields = $this->getWatchedItemsWithRCInfoQueryFields( $options );
+               $conds = $this->getWatchedItemsWithRCInfoQueryConds( $db, $user, $options );
+               $dbOptions = $this->getWatchedItemsWithRCInfoQueryDbOptions( $options );
+               $joinConds = $this->getWatchedItemsWithRCInfoQueryJoinConds( $options );
+
+               if ( $startFrom !== null ) {
+                       $conds[] = $this->getStartFromConds( $db, $options, $startFrom );
+               }
+
+               foreach ( $this->getExtensions() as $extension ) {
+                       $extension->modifyWatchedItemsWithRCInfoQuery(
+                               $user, $options, $db,
+                               $tables,
+                               $fields,
+                               $conds,
+                               $dbOptions,
+                               $joinConds
+                       );
+               }
+
+               $res = $db->select(
+                       $tables,
+                       $fields,
+                       $conds,
+                       __METHOD__,
+                       $dbOptions,
+                       $joinConds
+               );
+
+               $limit = isset( $dbOptions['LIMIT'] ) ? $dbOptions['LIMIT'] : INF;
+               $items = [];
+               $startFrom = null;
+               foreach ( $res as $row ) {
+                       if ( --$limit <= 0 ) {
+                               $startFrom = [ $row->rc_timestamp, $row->rc_id ];
+                               break;
+                       }
+
+                       $items[] = [
+                               new WatchedItem(
+                                       $user,
+                                       new TitleValue( (int)$row->rc_namespace, $row->rc_title ),
+                                       $row->wl_notificationtimestamp
+                               ),
+                               $this->getRecentChangeFieldsFromRow( $row )
+                       ];
+               }
+
+               foreach ( $this->getExtensions() as $extension ) {
+                       $extension->modifyWatchedItemsWithRCInfo( $user, $options, $db, $items, $res, $startFrom );
+               }
+
+               return $items;
+       }
+
+       /**
+        * For simple listing of user's watchlist items, see WatchedItemStore::getWatchedItemsForUser
+        *
+        * @param User $user
+        * @param array $options Allowed keys:
+        *        'sort'         => string optional sorting by namespace ID and title
+        *                          one of the self::SORT_* constants
+        *        'namespaceIds' => int[] optional namespace IDs to filter by (defaults to all namespaces)
+        *        'limit'        => int maximum number of items to return
+        *        'filter'       => string optional filter, one of the self::FILTER_* contants
+        *        'from'         => LinkTarget requires 'sort' key, only return items starting from
+        *                          those related to the link target
+        *        'until'        => LinkTarget requires 'sort' key, only return items until
+        *                          those related to the link target
+        *        'startFrom'    => LinkTarget requires 'sort' key, only return items starting from
+        *                          those related to the link target, allows to skip some link targets
+        *                          specified using the form option
+        * @return WatchedItem[]
+        */
+       public function getWatchedItemsForUser( User $user, array $options = [] ) {
+               if ( $user->isAnon() ) {
+                       // TODO: should this just return an empty array or rather complain loud at this point
+                       // as e.g. ApiBase::getWatchlistUser does?
+                       return [];
+               }
+
+               $options += [ 'namespaceIds' => [] ];
+
+               Assert::parameter(
+                       !isset( $options['sort'] ) || in_array( $options['sort'], [ self::SORT_ASC, self::SORT_DESC ] ),
+                       '$options[\'sort\']',
+                       'must be SORT_ASC or SORT_DESC'
+               );
+               Assert::parameter(
+                       !isset( $options['filter'] ) || in_array(
+                               $options['filter'], [ self::FILTER_CHANGED, self::FILTER_NOT_CHANGED ]
+                       ),
+                       '$options[\'filter\']',
+                       'must be FILTER_CHANGED or FILTER_NOT_CHANGED'
+               );
+               Assert::parameter(
+                       !isset( $options['from'] ) && !isset( $options['until'] ) && !isset( $options['startFrom'] )
+                       || isset( $options['sort'] ),
+                       '$options[\'sort\']',
+                       'must be provided if any of "from", "until", "startFrom" options is provided'
+               );
+
+               $db = $this->getConnection();
+
+               $conds = $this->getWatchedItemsForUserQueryConds( $db, $user, $options );
+               $dbOptions = $this->getWatchedItemsForUserQueryDbOptions( $options );
+
+               $res = $db->select(
+                       'watchlist',
+                       [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                       $conds,
+                       __METHOD__,
+                       $dbOptions
+               );
+
+               $watchedItems = [];
+               foreach ( $res as $row ) {
+                       // todo these could all be cached at some point?
+                       $watchedItems[] = new WatchedItem(
+                               $user,
+                               new TitleValue( (int)$row->wl_namespace, $row->wl_title ),
+                               $row->wl_notificationtimestamp
+                       );
+               }
+
+               return $watchedItems;
+       }
+
+       private function getRecentChangeFieldsFromRow( stdClass $row ) {
+               // This can be simplified to single array_filter call filtering by key value,
+               // once we stop supporting PHP 5.5
+               $allFields = get_object_vars( $row );
+               $rcKeys = array_filter(
+                       array_keys( $allFields ),
+                       function ( $key ) {
+                               return substr( $key, 0, 3 ) === 'rc_';
+                       }
+               );
+               return array_intersect_key( $allFields, array_flip( $rcKeys ) );
+       }
+
+       private function getWatchedItemsWithRCInfoQueryTables( array $options ) {
+               $tables = [ 'recentchanges', 'watchlist' ];
+               if ( !$options['allRevisions'] ) {
+                       $tables[] = 'page';
+               }
+               if ( in_array( self::INCLUDE_COMMENT, $options['includeFields'] ) ) {
+                       $tables += $this->getCommentStore()->getJoin()['tables'];
+               }
+               return $tables;
+       }
+
+       private function getWatchedItemsWithRCInfoQueryFields( array $options ) {
+               $fields = [
+                       'rc_id',
+                       'rc_namespace',
+                       'rc_title',
+                       'rc_timestamp',
+                       'rc_type',
+                       'rc_deleted',
+                       'wl_notificationtimestamp'
+               ];
+
+               $rcIdFields = [
+                       'rc_cur_id',
+                       'rc_this_oldid',
+                       'rc_last_oldid',
+               ];
+               if ( $options['usedInGenerator'] ) {
+                       if ( $options['allRevisions'] ) {
+                               $rcIdFields = [ 'rc_this_oldid' ];
+                       } else {
+                               $rcIdFields = [ 'rc_cur_id' ];
+                       }
+               }
+               $fields = array_merge( $fields, $rcIdFields );
+
+               if ( in_array( self::INCLUDE_FLAGS, $options['includeFields'] ) ) {
+                       $fields = array_merge( $fields, [ 'rc_type', 'rc_minor', 'rc_bot' ] );
+               }
+               if ( in_array( self::INCLUDE_USER, $options['includeFields'] ) ) {
+                       $fields[] = 'rc_user_text';
+               }
+               if ( in_array( self::INCLUDE_USER_ID, $options['includeFields'] ) ) {
+                       $fields[] = 'rc_user';
+               }
+               if ( in_array( self::INCLUDE_COMMENT, $options['includeFields'] ) ) {
+                       $fields += $this->getCommentStore()->getJoin()['fields'];
+               }
+               if ( in_array( self::INCLUDE_PATROL_INFO, $options['includeFields'] ) ) {
+                       $fields = array_merge( $fields, [ 'rc_patrolled', 'rc_log_type' ] );
+               }
+               if ( in_array( self::INCLUDE_SIZES, $options['includeFields'] ) ) {
+                       $fields = array_merge( $fields, [ 'rc_old_len', 'rc_new_len' ] );
+               }
+               if ( in_array( self::INCLUDE_LOG_INFO, $options['includeFields'] ) ) {
+                       $fields = array_merge( $fields, [ 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ] );
+               }
+
+               return $fields;
+       }
+
+       private function getWatchedItemsWithRCInfoQueryConds(
+               IDatabase $db,
+               User $user,
+               array $options
+       ) {
+               $watchlistOwnerId = $this->getWatchlistOwnerId( $user, $options );
+               $conds = [ 'wl_user' => $watchlistOwnerId ];
+
+               if ( !$options['allRevisions'] ) {
+                       $conds[] = $db->makeList(
+                               [ 'rc_this_oldid=page_latest', 'rc_type=' . RC_LOG ],
+                               LIST_OR
+                       );
+               }
+
+               if ( $options['namespaceIds'] ) {
+                       $conds['wl_namespace'] = array_map( 'intval', $options['namespaceIds'] );
+               }
+
+               if ( array_key_exists( 'rcTypes', $options ) ) {
+                       $conds['rc_type'] = array_map( 'intval', $options['rcTypes'] );
+               }
+
+               $conds = array_merge(
+                       $conds,
+                       $this->getWatchedItemsWithRCInfoQueryFilterConds( $user, $options )
+               );
+
+               $conds = array_merge( $conds, $this->getStartEndConds( $db, $options ) );
+
+               if ( !isset( $options['start'] ) && !isset( $options['end'] ) ) {
+                       if ( $db->getType() === 'mysql' ) {
+                               // This is an index optimization for mysql
+                               $conds[] = 'rc_timestamp > ' . $db->addQuotes( '' );
+                       }
+               }
+
+               $conds = array_merge( $conds, $this->getUserRelatedConds( $db, $user, $options ) );
+
+               $deletedPageLogCond = $this->getExtraDeletedPageLogEntryRelatedCond( $db, $user );
+               if ( $deletedPageLogCond ) {
+                       $conds[] = $deletedPageLogCond;
+               }
+
+               return $conds;
+       }
+
+       private function getWatchlistOwnerId( User $user, array $options ) {
+               if ( array_key_exists( 'watchlistOwner', $options ) ) {
+                       /** @var User $watchlistOwner */
+                       $watchlistOwner = $options['watchlistOwner'];
+                       $ownersToken = $watchlistOwner->getOption( 'watchlisttoken' );
+                       $token = $options['watchlistOwnerToken'];
+                       if ( $ownersToken == '' || !hash_equals( $ownersToken, $token ) ) {
+                               throw ApiUsageException::newWithMessage( null, 'apierror-bad-watchlist-token', 'bad_wltoken' );
+                       }
+                       return $watchlistOwner->getId();
+               }
+               return $user->getId();
+       }
+
+       private function getWatchedItemsWithRCInfoQueryFilterConds( User $user, array $options ) {
+               $conds = [];
+
+               if ( in_array( self::FILTER_MINOR, $options['filters'] ) ) {
+                       $conds[] = 'rc_minor != 0';
+               } elseif ( in_array( self::FILTER_NOT_MINOR, $options['filters'] ) ) {
+                       $conds[] = 'rc_minor = 0';
+               }
+
+               if ( in_array( self::FILTER_BOT, $options['filters'] ) ) {
+                       $conds[] = 'rc_bot != 0';
+               } elseif ( in_array( self::FILTER_NOT_BOT, $options['filters'] ) ) {
+                       $conds[] = 'rc_bot = 0';
+               }
+
+               if ( in_array( self::FILTER_ANON, $options['filters'] ) ) {
+                       $conds[] = 'rc_user = 0';
+               } elseif ( in_array( self::FILTER_NOT_ANON, $options['filters'] ) ) {
+                       $conds[] = 'rc_user != 0';
+               }
+
+               if ( $user->useRCPatrol() || $user->useNPPatrol() ) {
+                       // TODO: not sure if this should simply ignore patrolled filters if user does not have the patrol
+                       // right, or maybe rather fail loud at this point, same as e.g. ApiQueryWatchlist does?
+                       if ( in_array( self::FILTER_PATROLLED, $options['filters'] ) ) {
+                               $conds[] = 'rc_patrolled != 0';
+                       } elseif ( in_array( self::FILTER_NOT_PATROLLED, $options['filters'] ) ) {
+                               $conds[] = 'rc_patrolled = 0';
+                       }
+               }
+
+               if ( in_array( self::FILTER_UNREAD, $options['filters'] ) ) {
+                       $conds[] = 'rc_timestamp >= wl_notificationtimestamp';
+               } elseif ( in_array( self::FILTER_NOT_UNREAD, $options['filters'] ) ) {
+                       // TODO: should this be changed to use Database::makeList?
+                       $conds[] = 'wl_notificationtimestamp IS NULL OR rc_timestamp < wl_notificationtimestamp';
+               }
+
+               return $conds;
+       }
+
+       private function getStartEndConds( IDatabase $db, array $options ) {
+               if ( !isset( $options['start'] ) && !isset( $options['end'] ) ) {
+                       return [];
+               }
+
+               $conds = [];
+
+               if ( isset( $options['start'] ) ) {
+                       $after = $options['dir'] === self::DIR_OLDER ? '<=' : '>=';
+                       $conds[] = 'rc_timestamp ' . $after . ' ' .
+                               $db->addQuotes( $db->timestamp( $options['start'] ) );
+               }
+               if ( isset( $options['end'] ) ) {
+                       $before = $options['dir'] === self::DIR_OLDER ? '>=' : '<=';
+                       $conds[] = 'rc_timestamp ' . $before . ' ' .
+                               $db->addQuotes( $db->timestamp( $options['end'] ) );
+               }
+
+               return $conds;
+       }
+
+       private function getUserRelatedConds( IDatabase $db, User $user, array $options ) {
+               if ( !array_key_exists( 'onlyByUser', $options ) && !array_key_exists( 'notByUser', $options ) ) {
+                       return [];
+               }
+
+               $conds = [];
+
+               if ( array_key_exists( 'onlyByUser', $options ) ) {
+                       $conds['rc_user_text'] = $options['onlyByUser'];
+               } elseif ( array_key_exists( 'notByUser', $options ) ) {
+                       $conds[] = 'rc_user_text != ' . $db->addQuotes( $options['notByUser'] );
+               }
+
+               // Avoid brute force searches (T19342)
+               $bitmask = 0;
+               if ( !$user->isAllowed( 'deletedhistory' ) ) {
+                       $bitmask = Revision::DELETED_USER;
+               } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
+                       $bitmask = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
+               }
+               if ( $bitmask ) {
+                       $conds[] = $db->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask";
+               }
+
+               return $conds;
+       }
+
+       private function getExtraDeletedPageLogEntryRelatedCond( IDatabase $db, User $user ) {
+               // LogPage::DELETED_ACTION hides the affected page, too. So hide those
+               // entirely from the watchlist, or someone could guess the title.
+               $bitmask = 0;
+               if ( !$user->isAllowed( 'deletedhistory' ) ) {
+                       $bitmask = LogPage::DELETED_ACTION;
+               } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
+                       $bitmask = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED;
+               }
+               if ( $bitmask ) {
+                       return $db->makeList( [
+                               'rc_type != ' . RC_LOG,
+                               $db->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask",
+                       ], LIST_OR );
+               }
+               return '';
+       }
+
+       private function getStartFromConds( IDatabase $db, array $options, array $startFrom ) {
+               $op = $options['dir'] === self::DIR_OLDER ? '<' : '>';
+               list( $rcTimestamp, $rcId ) = $startFrom;
+               $rcTimestamp = $db->addQuotes( $db->timestamp( $rcTimestamp ) );
+               $rcId = (int)$rcId;
+               return $db->makeList(
+                       [
+                               "rc_timestamp $op $rcTimestamp",
+                               $db->makeList(
+                                       [
+                                               "rc_timestamp = $rcTimestamp",
+                                               "rc_id $op= $rcId"
+                                       ],
+                                       LIST_AND
+                               )
+                       ],
+                       LIST_OR
+               );
+       }
+
+       private function getWatchedItemsForUserQueryConds( IDatabase $db, User $user, array $options ) {
+               $conds = [ 'wl_user' => $user->getId() ];
+               if ( $options['namespaceIds'] ) {
+                       $conds['wl_namespace'] = array_map( 'intval', $options['namespaceIds'] );
+               }
+               if ( isset( $options['filter'] ) ) {
+                       $filter = $options['filter'];
+                       if ( $filter === self::FILTER_CHANGED ) {
+                               $conds[] = 'wl_notificationtimestamp IS NOT NULL';
+                       } else {
+                               $conds[] = 'wl_notificationtimestamp IS NULL';
+                       }
+               }
+
+               if ( isset( $options['from'] ) ) {
+                       $op = $options['sort'] === self::SORT_ASC ? '>' : '<';
+                       $conds[] = $this->getFromUntilTargetConds( $db, $options['from'], $op );
+               }
+               if ( isset( $options['until'] ) ) {
+                       $op = $options['sort'] === self::SORT_ASC ? '<' : '>';
+                       $conds[] = $this->getFromUntilTargetConds( $db, $options['until'], $op );
+               }
+               if ( isset( $options['startFrom'] ) ) {
+                       $op = $options['sort'] === self::SORT_ASC ? '>' : '<';
+                       $conds[] = $this->getFromUntilTargetConds( $db, $options['startFrom'], $op );
+               }
+
+               return $conds;
+       }
+
+       /**
+        * Creates a query condition part for getting only items before or after the given link target
+        * (while ordering using $sort mode)
+        *
+        * @param IDatabase $db
+        * @param LinkTarget $target
+        * @param string $op comparison operator to use in the conditions
+        * @return string
+        */
+       private function getFromUntilTargetConds( IDatabase $db, LinkTarget $target, $op ) {
+               return $db->makeList(
+                       [
+                               "wl_namespace $op " . $target->getNamespace(),
+                               $db->makeList(
+                                       [
+                                               'wl_namespace = ' . $target->getNamespace(),
+                                               "wl_title $op= " . $db->addQuotes( $target->getDBkey() )
+                                       ],
+                                       LIST_AND
+                               )
+                       ],
+                       LIST_OR
+               );
+       }
+
+       private function getWatchedItemsWithRCInfoQueryDbOptions( array $options ) {
+               $dbOptions = [];
+
+               if ( array_key_exists( 'dir', $options ) ) {
+                       $sort = $options['dir'] === self::DIR_OLDER ? ' DESC' : '';
+                       $dbOptions['ORDER BY'] = [ 'rc_timestamp' . $sort, 'rc_id' . $sort ];
+               }
+
+               if ( array_key_exists( 'limit', $options ) ) {
+                       $dbOptions['LIMIT'] = (int)$options['limit'] + 1;
+               }
+
+               return $dbOptions;
+       }
+
+       private function getWatchedItemsForUserQueryDbOptions( array $options ) {
+               $dbOptions = [];
+               if ( array_key_exists( 'sort', $options ) ) {
+                       $dbOptions['ORDER BY'] = [
+                               "wl_namespace {$options['sort']}",
+                               "wl_title {$options['sort']}"
+                       ];
+                       if ( count( $options['namespaceIds'] ) === 1 ) {
+                               $dbOptions['ORDER BY'] = "wl_title {$options['sort']}";
+                       }
+               }
+               if ( array_key_exists( 'limit', $options ) ) {
+                       $dbOptions['LIMIT'] = (int)$options['limit'];
+               }
+               return $dbOptions;
+       }
+
+       private function getWatchedItemsWithRCInfoQueryJoinConds( array $options ) {
+               $joinConds = [
+                       'watchlist' => [ 'INNER JOIN',
+                               [
+                                       'wl_namespace=rc_namespace',
+                                       'wl_title=rc_title'
+                               ]
+                       ]
+               ];
+               if ( !$options['allRevisions'] ) {
+                       $joinConds['page'] = [ 'LEFT JOIN', 'rc_cur_id=page_id' ];
+               }
+               if ( in_array( self::INCLUDE_COMMENT, $options['includeFields'] ) ) {
+                       $joinConds += $this->getCommentStore()->getJoin()['joins'];
+               }
+               return $joinConds;
+       }
+
+}
diff --git a/includes/watcheditem/WatchedItemQueryServiceExtension.php b/includes/watcheditem/WatchedItemQueryServiceExtension.php
new file mode 100644 (file)
index 0000000..93d5033
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\IDatabase;
+
+/**
+ * Extension mechanism for WatchedItemQueryService
+ *
+ * @since 1.29
+ *
+ * @file
+ * @ingroup Watchlist
+ *
+ * @license GNU GPL v2+
+ */
+interface WatchedItemQueryServiceExtension {
+
+       /**
+        * Modify the WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
+        * query before it's made.
+        *
+        * @warning Any joins added *must* join on a unique key of the target table
+        *  unless you really know what you're doing.
+        * @param User $user
+        * @param array $options Options from
+        *  WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
+        * @param IDatabase $db Database connection being used for the query
+        * @param array &$tables Tables for Database::select()
+        * @param array &$fields Fields for Database::select()
+        * @param array &$conds Conditions for Database::select()
+        * @param array &$dbOptions Options for Database::select()
+        * @param array &$joinConds Join conditions for Database::select()
+        */
+       public function modifyWatchedItemsWithRCInfoQuery( User $user, array $options, IDatabase $db,
+               array &$tables, array &$fields, array &$conds, array &$dbOptions, array &$joinConds
+       );
+
+       /**
+        * Modify the results from WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
+        * before they're returned.
+        *
+        * @param User $user
+        * @param array $options Options from
+        *  WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
+        * @param IDatabase $db Database connection being used for the query
+        * @param array &$items array of pairs ( WatchedItem $watchedItem, string[] $recentChangeInfo ).
+        *  May be truncated if necessary, in which case $startFrom must be updated.
+        * @param ResultWrapper|bool $res Database query result
+        * @param array|null &$startFrom Continuation value. If you truncate $items, set this to
+        *  [ $recentChangeInfo['rc_timestamp'], $recentChangeInfo['rc_id'] ] from the first item
+        *  removed.
+        */
+       public function modifyWatchedItemsWithRCInfo( User $user, array $options, IDatabase $db,
+               array &$items, $res, &$startFrom
+       );
+
+}
diff --git a/includes/watcheditem/WatchedItemStore.php b/includes/watcheditem/WatchedItemStore.php
new file mode 100644 (file)
index 0000000..60d8b76
--- /dev/null
@@ -0,0 +1,986 @@
+<?php
+
+use Wikimedia\Rdbms\IDatabase;
+use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
+use MediaWiki\Linker\LinkTarget;
+use MediaWiki\MediaWikiServices;
+use Wikimedia\Assert\Assert;
+use Wikimedia\ScopedCallback;
+use Wikimedia\Rdbms\LoadBalancer;
+use Wikimedia\Rdbms\DBUnexpectedError;
+
+/**
+ * Storage layer class for WatchedItems.
+ * Database interaction.
+ *
+ * Uses database because this uses User::isAnon
+ *
+ * @group Database
+ *
+ * @author Addshore
+ * @since 1.27
+ */
+class WatchedItemStore implements StatsdAwareInterface {
+
+       const SORT_DESC = 'DESC';
+       const SORT_ASC = 'ASC';
+
+       /**
+        * @var LoadBalancer
+        */
+       private $loadBalancer;
+
+       /**
+        * @var ReadOnlyMode
+        */
+       private $readOnlyMode;
+
+       /**
+        * @var HashBagOStuff
+        */
+       private $cache;
+
+       /**
+        * @var array[] Looks like $cacheIndex[Namespace ID][Target DB Key][User Id] => 'key'
+        * The index is needed so that on mass changes all relevant items can be un-cached.
+        * For example: Clearing a users watchlist of all items or updating notification timestamps
+        *              for all users watching a single target.
+        */
+       private $cacheIndex = [];
+
+       /**
+        * @var callable|null
+        */
+       private $deferredUpdatesAddCallableUpdateCallback;
+
+       /**
+        * @var callable|null
+        */
+       private $revisionGetTimestampFromIdCallback;
+
+       /**
+        * @var StatsdDataFactoryInterface
+        */
+       private $stats;
+
+       /**
+        * @param LoadBalancer $loadBalancer
+        * @param HashBagOStuff $cache
+        * @param ReadOnlyMode $readOnlyMode
+        */
+       public function __construct(
+               LoadBalancer $loadBalancer,
+               HashBagOStuff $cache,
+               ReadOnlyMode $readOnlyMode
+       ) {
+               $this->loadBalancer = $loadBalancer;
+               $this->cache = $cache;
+               $this->readOnlyMode = $readOnlyMode;
+               $this->stats = new NullStatsdDataFactory();
+               $this->deferredUpdatesAddCallableUpdateCallback = [ 'DeferredUpdates', 'addCallableUpdate' ];
+               $this->revisionGetTimestampFromIdCallback = [ 'Revision', 'getTimestampFromId' ];
+       }
+
+       public function setStatsdDataFactory( StatsdDataFactoryInterface $stats ) {
+               $this->stats = $stats;
+       }
+
+       /**
+        * Overrides the DeferredUpdates::addCallableUpdate callback
+        * This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
+        *
+        * @param callable $callback
+        *
+        * @see DeferredUpdates::addCallableUpdate for callback signiture
+        *
+        * @return ScopedCallback to reset the overridden value
+        * @throws MWException
+        */
+       public function overrideDeferredUpdatesAddCallableUpdateCallback( callable $callback ) {
+               if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
+                       throw new MWException(
+                               'Cannot override DeferredUpdates::addCallableUpdate callback in operation.'
+                       );
+               }
+               $previousValue = $this->deferredUpdatesAddCallableUpdateCallback;
+               $this->deferredUpdatesAddCallableUpdateCallback = $callback;
+               return new ScopedCallback( function () use ( $previousValue ) {
+                       $this->deferredUpdatesAddCallableUpdateCallback = $previousValue;
+               } );
+       }
+
+       /**
+        * Overrides the Revision::getTimestampFromId callback
+        * This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
+        *
+        * @param callable $callback
+        * @see Revision::getTimestampFromId for callback signiture
+        *
+        * @return ScopedCallback to reset the overridden value
+        * @throws MWException
+        */
+       public function overrideRevisionGetTimestampFromIdCallback( callable $callback ) {
+               if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
+                       throw new MWException(
+                               'Cannot override Revision::getTimestampFromId callback in operation.'
+                       );
+               }
+               $previousValue = $this->revisionGetTimestampFromIdCallback;
+               $this->revisionGetTimestampFromIdCallback = $callback;
+               return new ScopedCallback( function () use ( $previousValue ) {
+                       $this->revisionGetTimestampFromIdCallback = $previousValue;
+               } );
+       }
+
+       private function getCacheKey( User $user, LinkTarget $target ) {
+               return $this->cache->makeKey(
+                       (string)$target->getNamespace(),
+                       $target->getDBkey(),
+                       (string)$user->getId()
+               );
+       }
+
+       private function cache( WatchedItem $item ) {
+               $user = $item->getUser();
+               $target = $item->getLinkTarget();
+               $key = $this->getCacheKey( $user, $target );
+               $this->cache->set( $key, $item );
+               $this->cacheIndex[$target->getNamespace()][$target->getDBkey()][$user->getId()] = $key;
+               $this->stats->increment( 'WatchedItemStore.cache' );
+       }
+
+       private function uncache( User $user, LinkTarget $target ) {
+               $this->cache->delete( $this->getCacheKey( $user, $target ) );
+               unset( $this->cacheIndex[$target->getNamespace()][$target->getDBkey()][$user->getId()] );
+               $this->stats->increment( 'WatchedItemStore.uncache' );
+       }
+
+       private function uncacheLinkTarget( LinkTarget $target ) {
+               $this->stats->increment( 'WatchedItemStore.uncacheLinkTarget' );
+               if ( !isset( $this->cacheIndex[$target->getNamespace()][$target->getDBkey()] ) ) {
+                       return;
+               }
+               foreach ( $this->cacheIndex[$target->getNamespace()][$target->getDBkey()] as $key ) {
+                       $this->stats->increment( 'WatchedItemStore.uncacheLinkTarget.items' );
+                       $this->cache->delete( $key );
+               }
+       }
+
+       private function uncacheUser( User $user ) {
+               $this->stats->increment( 'WatchedItemStore.uncacheUser' );
+               foreach ( $this->cacheIndex as $ns => $dbKeyArray ) {
+                       foreach ( $dbKeyArray as $dbKey => $userArray ) {
+                               if ( isset( $userArray[$user->getId()] ) ) {
+                                       $this->stats->increment( 'WatchedItemStore.uncacheUser.items' );
+                                       $this->cache->delete( $userArray[$user->getId()] );
+                               }
+                       }
+               }
+       }
+
+       /**
+        * @param User $user
+        * @param LinkTarget $target
+        *
+        * @return WatchedItem|false
+        */
+       private function getCached( User $user, LinkTarget $target ) {
+               return $this->cache->get( $this->getCacheKey( $user, $target ) );
+       }
+
+       /**
+        * Return an array of conditions to select or update the appropriate database
+        * row.
+        *
+        * @param User $user
+        * @param LinkTarget $target
+        *
+        * @return array
+        */
+       private function dbCond( User $user, LinkTarget $target ) {
+               return [
+                       'wl_user' => $user->getId(),
+                       'wl_namespace' => $target->getNamespace(),
+                       'wl_title' => $target->getDBkey(),
+               ];
+       }
+
+       /**
+        * @param int $dbIndex DB_MASTER or DB_REPLICA
+        *
+        * @return IDatabase
+        * @throws MWException
+        */
+       private function getConnectionRef( $dbIndex ) {
+               return $this->loadBalancer->getConnectionRef( $dbIndex, [ 'watchlist' ] );
+       }
+
+       /**
+        * Count the number of individual items that are watched by the user.
+        * If a subject and corresponding talk page are watched this will return 2.
+        *
+        * @param User $user
+        *
+        * @return int
+        */
+       public function countWatchedItems( User $user ) {
+               $dbr = $this->getConnectionRef( DB_REPLICA );
+               $return = (int)$dbr->selectField(
+                       'watchlist',
+                       'COUNT(*)',
+                       [
+                               'wl_user' => $user->getId()
+                       ],
+                       __METHOD__
+               );
+
+               return $return;
+       }
+
+       /**
+        * @param LinkTarget $target
+        *
+        * @return int
+        */
+       public function countWatchers( LinkTarget $target ) {
+               $dbr = $this->getConnectionRef( DB_REPLICA );
+               $return = (int)$dbr->selectField(
+                       'watchlist',
+                       'COUNT(*)',
+                       [
+                               'wl_namespace' => $target->getNamespace(),
+                               'wl_title' => $target->getDBkey(),
+                       ],
+                       __METHOD__
+               );
+
+               return $return;
+       }
+
+       /**
+        * Number of page watchers who also visited a "recent" edit
+        *
+        * @param LinkTarget $target
+        * @param mixed $threshold timestamp accepted by wfTimestamp
+        *
+        * @return int
+        * @throws DBUnexpectedError
+        * @throws MWException
+        */
+       public function countVisitingWatchers( LinkTarget $target, $threshold ) {
+               $dbr = $this->getConnectionRef( DB_REPLICA );
+               $visitingWatchers = (int)$dbr->selectField(
+                       'watchlist',
+                       'COUNT(*)',
+                       [
+                               'wl_namespace' => $target->getNamespace(),
+                               'wl_title' => $target->getDBkey(),
+                               'wl_notificationtimestamp >= ' .
+                               $dbr->addQuotes( $dbr->timestamp( $threshold ) ) .
+                               ' OR wl_notificationtimestamp IS NULL'
+                       ],
+                       __METHOD__
+               );
+
+               return $visitingWatchers;
+       }
+
+       /**
+        * @param LinkTarget[] $targets
+        * @param array $options Allowed keys:
+        *        'minimumWatchers' => int
+        *
+        * @return array multi dimensional like $return[$namespaceId][$titleString] = int $watchers
+        *         All targets will be present in the result. 0 either means no watchers or the number
+        *         of watchers was below the minimumWatchers option if passed.
+        */
+       public function countWatchersMultiple( array $targets, array $options = [] ) {
+               $dbOptions = [ 'GROUP BY' => [ 'wl_namespace', 'wl_title' ] ];
+
+               $dbr = $this->getConnectionRef( DB_REPLICA );
+
+               if ( array_key_exists( 'minimumWatchers', $options ) ) {
+                       $dbOptions['HAVING'] = 'COUNT(*) >= ' . (int)$options['minimumWatchers'];
+               }
+
+               $lb = new LinkBatch( $targets );
+               $res = $dbr->select(
+                       'watchlist',
+                       [ 'wl_title', 'wl_namespace', 'watchers' => 'COUNT(*)' ],
+                       [ $lb->constructSet( 'wl', $dbr ) ],
+                       __METHOD__,
+                       $dbOptions
+               );
+
+               $watchCounts = [];
+               foreach ( $targets as $linkTarget ) {
+                       $watchCounts[$linkTarget->getNamespace()][$linkTarget->getDBkey()] = 0;
+               }
+
+               foreach ( $res as $row ) {
+                       $watchCounts[$row->wl_namespace][$row->wl_title] = (int)$row->watchers;
+               }
+
+               return $watchCounts;
+       }
+
+       /**
+        * Number of watchers of each page who have visited recent edits to that page
+        *
+        * @param array $targetsWithVisitThresholds array of pairs (LinkTarget $target, mixed $threshold),
+        *        $threshold is:
+        *        - a timestamp of the recent edit if $target exists (format accepted by wfTimestamp)
+        *        - null if $target doesn't exist
+        * @param int|null $minimumWatchers
+        * @return array multi-dimensional like $return[$namespaceId][$titleString] = $watchers,
+        *         where $watchers is an int:
+        *         - if the page exists, number of users watching who have visited the page recently
+        *         - if the page doesn't exist, number of users that have the page on their watchlist
+        *         - 0 means there are no visiting watchers or their number is below the minimumWatchers
+        *         option (if passed).
+        */
+       public function countVisitingWatchersMultiple(
+               array $targetsWithVisitThresholds,
+               $minimumWatchers = null
+       ) {
+               $dbr = $this->getConnectionRef( DB_REPLICA );
+
+               $conds = $this->getVisitingWatchersCondition( $dbr, $targetsWithVisitThresholds );
+
+               $dbOptions = [ 'GROUP BY' => [ 'wl_namespace', 'wl_title' ] ];
+               if ( $minimumWatchers !== null ) {
+                       $dbOptions['HAVING'] = 'COUNT(*) >= ' . (int)$minimumWatchers;
+               }
+               $res = $dbr->select(
+                       'watchlist',
+                       [ 'wl_namespace', 'wl_title', 'watchers' => 'COUNT(*)' ],
+                       $conds,
+                       __METHOD__,
+                       $dbOptions
+               );
+
+               $watcherCounts = [];
+               foreach ( $targetsWithVisitThresholds as list( $target ) ) {
+                       /* @var LinkTarget $target */
+                       $watcherCounts[$target->getNamespace()][$target->getDBkey()] = 0;
+               }
+
+               foreach ( $res as $row ) {
+                       $watcherCounts[$row->wl_namespace][$row->wl_title] = (int)$row->watchers;
+               }
+
+               return $watcherCounts;
+       }
+
+       /**
+        * Generates condition for the query used in a batch count visiting watchers.
+        *
+        * @param IDatabase $db
+        * @param array $targetsWithVisitThresholds array of pairs (LinkTarget, last visit threshold)
+        * @return string
+        */
+       private function getVisitingWatchersCondition(
+               IDatabase $db,
+               array $targetsWithVisitThresholds
+       ) {
+               $missingTargets = [];
+               $namespaceConds = [];
+               foreach ( $targetsWithVisitThresholds as list( $target, $threshold ) ) {
+                       if ( $threshold === null ) {
+                               $missingTargets[] = $target;
+                               continue;
+                       }
+                       /* @var LinkTarget $target */
+                       $namespaceConds[$target->getNamespace()][] = $db->makeList( [
+                               'wl_title = ' . $db->addQuotes( $target->getDBkey() ),
+                               $db->makeList( [
+                                       'wl_notificationtimestamp >= ' . $db->addQuotes( $db->timestamp( $threshold ) ),
+                                       'wl_notificationtimestamp IS NULL'
+                               ], LIST_OR )
+                       ], LIST_AND );
+               }
+
+               $conds = [];
+               foreach ( $namespaceConds as $namespace => $pageConds ) {
+                       $conds[] = $db->makeList( [
+                               'wl_namespace = ' . $namespace,
+                               '(' . $db->makeList( $pageConds, LIST_OR ) . ')'
+                       ], LIST_AND );
+               }
+
+               if ( $missingTargets ) {
+                       $lb = new LinkBatch( $missingTargets );
+                       $conds[] = $lb->constructSet( 'wl', $db );
+               }
+
+               return $db->makeList( $conds, LIST_OR );
+       }
+
+       /**
+        * Get an item (may be cached)
+        *
+        * @param User $user
+        * @param LinkTarget $target
+        *
+        * @return WatchedItem|false
+        */
+       public function getWatchedItem( User $user, LinkTarget $target ) {
+               if ( $user->isAnon() ) {
+                       return false;
+               }
+
+               $cached = $this->getCached( $user, $target );
+               if ( $cached ) {
+                       $this->stats->increment( 'WatchedItemStore.getWatchedItem.cached' );
+                       return $cached;
+               }
+               $this->stats->increment( 'WatchedItemStore.getWatchedItem.load' );
+               return $this->loadWatchedItem( $user, $target );
+       }
+
+       /**
+        * Loads an item from the db
+        *
+        * @param User $user
+        * @param LinkTarget $target
+        *
+        * @return WatchedItem|false
+        */
+       public function loadWatchedItem( User $user, LinkTarget $target ) {
+               // Only loggedin user can have a watchlist
+               if ( $user->isAnon() ) {
+                       return false;
+               }
+
+               $dbr = $this->getConnectionRef( DB_REPLICA );
+               $row = $dbr->selectRow(
+                       'watchlist',
+                       'wl_notificationtimestamp',
+                       $this->dbCond( $user, $target ),
+                       __METHOD__
+               );
+
+               if ( !$row ) {
+                       return false;
+               }
+
+               $item = new WatchedItem(
+                       $user,
+                       $target,
+                       wfTimestampOrNull( TS_MW, $row->wl_notificationtimestamp )
+               );
+               $this->cache( $item );
+
+               return $item;
+       }
+
+       /**
+        * @param User $user
+        * @param array $options Allowed keys:
+        *        'forWrite' => bool defaults to false
+        *        'sort' => string optional sorting by namespace ID and title
+        *                     one of the self::SORT_* constants
+        *
+        * @return WatchedItem[]
+        */
+       public function getWatchedItemsForUser( User $user, array $options = [] ) {
+               $options += [ 'forWrite' => false ];
+
+               $dbOptions = [];
+               if ( array_key_exists( 'sort', $options ) ) {
+                       Assert::parameter(
+                               ( in_array( $options['sort'], [ self::SORT_ASC, self::SORT_DESC ] ) ),
+                               '$options[\'sort\']',
+                               'must be SORT_ASC or SORT_DESC'
+                       );
+                       $dbOptions['ORDER BY'] = [
+                               "wl_namespace {$options['sort']}",
+                               "wl_title {$options['sort']}"
+                       ];
+               }
+               $db = $this->getConnectionRef( $options['forWrite'] ? DB_MASTER : DB_REPLICA );
+
+               $res = $db->select(
+                       'watchlist',
+                       [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                       [ 'wl_user' => $user->getId() ],
+                       __METHOD__,
+                       $dbOptions
+               );
+
+               $watchedItems = [];
+               foreach ( $res as $row ) {
+                       // @todo: Should we add these to the process cache?
+                       $watchedItems[] = new WatchedItem(
+                               $user,
+                               new TitleValue( (int)$row->wl_namespace, $row->wl_title ),
+                               $row->wl_notificationtimestamp
+                       );
+               }
+
+               return $watchedItems;
+       }
+
+       /**
+        * Must be called separately for Subject & Talk namespaces
+        *
+        * @param User $user
+        * @param LinkTarget $target
+        *
+        * @return bool
+        */
+       public function isWatched( User $user, LinkTarget $target ) {
+               return (bool)$this->getWatchedItem( $user, $target );
+       }
+
+       /**
+        * @param User $user
+        * @param LinkTarget[] $targets
+        *
+        * @return array multi-dimensional like $return[$namespaceId][$titleString] = $timestamp,
+        *         where $timestamp is:
+        *         - string|null value of wl_notificationtimestamp,
+        *         - false if $target is not watched by $user.
+        */
+       public function getNotificationTimestampsBatch( User $user, array $targets ) {
+               $timestamps = [];
+               foreach ( $targets as $target ) {
+                       $timestamps[$target->getNamespace()][$target->getDBkey()] = false;
+               }
+
+               if ( $user->isAnon() ) {
+                       return $timestamps;
+               }
+
+               $targetsToLoad = [];
+               foreach ( $targets as $target ) {
+                       $cachedItem = $this->getCached( $user, $target );
+                       if ( $cachedItem ) {
+                               $timestamps[$target->getNamespace()][$target->getDBkey()] =
+                                       $cachedItem->getNotificationTimestamp();
+                       } else {
+                               $targetsToLoad[] = $target;
+                       }
+               }
+
+               if ( !$targetsToLoad ) {
+                       return $timestamps;
+               }
+
+               $dbr = $this->getConnectionRef( DB_REPLICA );
+
+               $lb = new LinkBatch( $targetsToLoad );
+               $res = $dbr->select(
+                       'watchlist',
+                       [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                       [
+                               $lb->constructSet( 'wl', $dbr ),
+                               'wl_user' => $user->getId(),
+                       ],
+                       __METHOD__
+               );
+
+               foreach ( $res as $row ) {
+                       $timestamps[$row->wl_namespace][$row->wl_title] =
+                               wfTimestampOrNull( TS_MW, $row->wl_notificationtimestamp );
+               }
+
+               return $timestamps;
+       }
+
+       /**
+        * Must be called separately for Subject & Talk namespaces
+        *
+        * @param User $user
+        * @param LinkTarget $target
+        */
+       public function addWatch( User $user, LinkTarget $target ) {
+               $this->addWatchBatchForUser( $user, [ $target ] );
+       }
+
+       /**
+        * @param User $user
+        * @param LinkTarget[] $targets
+        *
+        * @return bool success
+        */
+       public function addWatchBatchForUser( User $user, array $targets ) {
+               if ( $this->readOnlyMode->isReadOnly() ) {
+                       return false;
+               }
+               // Only loggedin user can have a watchlist
+               if ( $user->isAnon() ) {
+                       return false;
+               }
+
+               if ( !$targets ) {
+                       return true;
+               }
+
+               $rows = [];
+               $items = [];
+               foreach ( $targets as $target ) {
+                       $rows[] = [
+                               'wl_user' => $user->getId(),
+                               'wl_namespace' => $target->getNamespace(),
+                               'wl_title' => $target->getDBkey(),
+                               'wl_notificationtimestamp' => null,
+                       ];
+                       $items[] = new WatchedItem(
+                               $user,
+                               $target,
+                               null
+                       );
+                       $this->uncache( $user, $target );
+               }
+
+               $dbw = $this->getConnectionRef( DB_MASTER );
+               foreach ( array_chunk( $rows, 100 ) as $toInsert ) {
+                       // Use INSERT IGNORE to avoid overwriting the notification timestamp
+                       // if there's already an entry for this page
+                       $dbw->insert( 'watchlist', $toInsert, __METHOD__, 'IGNORE' );
+               }
+               // Update process cache to ensure skin doesn't claim that the current
+               // page is unwatched in the response of action=watch itself (T28292).
+               // This would otherwise be re-queried from a slave by isWatched().
+               foreach ( $items as $item ) {
+                       $this->cache( $item );
+               }
+
+               return true;
+       }
+
+       /**
+        * Removes the an entry for the User watching the LinkTarget
+        * Must be called separately for Subject & Talk namespaces
+        *
+        * @param User $user
+        * @param LinkTarget $target
+        *
+        * @return bool success
+        * @throws DBUnexpectedError
+        * @throws MWException
+        */
+       public function removeWatch( User $user, LinkTarget $target ) {
+               // Only logged in user can have a watchlist
+               if ( $this->readOnlyMode->isReadOnly() || $user->isAnon() ) {
+                       return false;
+               }
+
+               $this->uncache( $user, $target );
+
+               $dbw = $this->getConnectionRef( DB_MASTER );
+               $dbw->delete( 'watchlist',
+                       [
+                               'wl_user' => $user->getId(),
+                               'wl_namespace' => $target->getNamespace(),
+                               'wl_title' => $target->getDBkey(),
+                       ], __METHOD__
+               );
+               $success = (bool)$dbw->affectedRows();
+
+               return $success;
+       }
+
+       /**
+        * @param User $user The user to set the timestamp for
+        * @param string|null $timestamp Set the update timestamp to this value
+        * @param LinkTarget[] $targets List of targets to update. Default to all targets
+        *
+        * @return bool success
+        */
+       public function setNotificationTimestampsForUser( User $user, $timestamp, array $targets = [] ) {
+               // Only loggedin user can have a watchlist
+               if ( $user->isAnon() ) {
+                       return false;
+               }
+
+               $dbw = $this->getConnectionRef( DB_MASTER );
+
+               $conds = [ 'wl_user' => $user->getId() ];
+               if ( $targets ) {
+                       $batch = new LinkBatch( $targets );
+                       $conds[] = $batch->constructSet( 'wl', $dbw );
+               }
+
+               if ( $timestamp !== null ) {
+                       $timestamp = $dbw->timestamp( $timestamp );
+               }
+
+               $success = $dbw->update(
+                       'watchlist',
+                       [ 'wl_notificationtimestamp' => $timestamp ],
+                       $conds,
+                       __METHOD__
+               );
+
+               $this->uncacheUser( $user );
+
+               return $success;
+       }
+
+       /**
+        * @param User $editor The editor that triggered the update. Their notification
+        *  timestamp will not be updated(they have already seen it)
+        * @param LinkTarget $target The target to update timestamps for
+        * @param string $timestamp Set the update timestamp to this value
+        *
+        * @return int[] Array of user IDs the timestamp has been updated for
+        */
+       public function updateNotificationTimestamp( User $editor, LinkTarget $target, $timestamp ) {
+               $dbw = $this->getConnectionRef( DB_MASTER );
+               $uids = $dbw->selectFieldValues(
+                       'watchlist',
+                       'wl_user',
+                       [
+                               'wl_user != ' . intval( $editor->getId() ),
+                               'wl_namespace' => $target->getNamespace(),
+                               'wl_title' => $target->getDBkey(),
+                               'wl_notificationtimestamp IS NULL',
+                       ],
+                       __METHOD__
+               );
+
+               $watchers = array_map( 'intval', $uids );
+               if ( $watchers ) {
+                       // Update wl_notificationtimestamp for all watching users except the editor
+                       $fname = __METHOD__;
+                       DeferredUpdates::addCallableUpdate(
+                               function () use ( $timestamp, $watchers, $target, $fname ) {
+                                       global $wgUpdateRowsPerQuery;
+
+                                       $dbw = $this->getConnectionRef( DB_MASTER );
+                                       $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+                                       $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
+
+                                       $watchersChunks = array_chunk( $watchers, $wgUpdateRowsPerQuery );
+                                       foreach ( $watchersChunks as $watchersChunk ) {
+                                               $dbw->update( 'watchlist',
+                                                       [ /* SET */
+                                                               'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
+                                                       ], [ /* WHERE - TODO Use wl_id T130067 */
+                                                               'wl_user' => $watchersChunk,
+                                                               'wl_namespace' => $target->getNamespace(),
+                                                               'wl_title' => $target->getDBkey(),
+                                                       ], $fname
+                                               );
+                                               if ( count( $watchersChunks ) > 1 ) {
+                                                       $factory->commitAndWaitForReplication(
+                                                               __METHOD__, $ticket, [ 'domain' => $dbw->getDomainID() ]
+                                                       );
+                                               }
+                                       }
+                                       $this->uncacheLinkTarget( $target );
+                               },
+                               DeferredUpdates::POSTSEND,
+                               $dbw
+                       );
+               }
+
+               return $watchers;
+       }
+
+       /**
+        * Reset the notification timestamp of this entry
+        *
+        * @param User $user
+        * @param Title $title
+        * @param string $force Whether to force the write query to be executed even if the
+        *    page is not watched or the notification timestamp is already NULL.
+        *    'force' in order to force
+        * @param int $oldid The revision id being viewed. If not given or 0, latest revision is assumed.
+        *
+        * @return bool success
+        */
+       public function resetNotificationTimestamp( User $user, Title $title, $force = '', $oldid = 0 ) {
+               // Only loggedin user can have a watchlist
+               if ( $this->readOnlyMode->isReadOnly() || $user->isAnon() ) {
+                       return false;
+               }
+
+               $item = null;
+               if ( $force != 'force' ) {
+                       $item = $this->loadWatchedItem( $user, $title );
+                       if ( !$item || $item->getNotificationTimestamp() === null ) {
+                               return false;
+                       }
+               }
+
+               // If the page is watched by the user (or may be watched), update the timestamp
+               $job = new ActivityUpdateJob(
+                       $title,
+                       [
+                               'type'      => 'updateWatchlistNotification',
+                               'userid'    => $user->getId(),
+                               'notifTime' => $this->getNotificationTimestamp( $user, $title, $item, $force, $oldid ),
+                               'curTime'   => time()
+                       ]
+               );
+
+               // Try to run this post-send
+               // Calls DeferredUpdates::addCallableUpdate in normal operation
+               call_user_func(
+                       $this->deferredUpdatesAddCallableUpdateCallback,
+                       function () use ( $job ) {
+                               $job->run();
+                       }
+               );
+
+               $this->uncache( $user, $title );
+
+               return true;
+       }
+
+       private function getNotificationTimestamp( User $user, Title $title, $item, $force, $oldid ) {
+               if ( !$oldid ) {
+                       // No oldid given, assuming latest revision; clear the timestamp.
+                       return null;
+               }
+
+               if ( !$title->getNextRevisionID( $oldid ) ) {
+                       // Oldid given and is the latest revision for this title; clear the timestamp.
+                       return null;
+               }
+
+               if ( $item === null ) {
+                       $item = $this->loadWatchedItem( $user, $title );
+               }
+
+               if ( !$item ) {
+                       // This can only happen if $force is enabled.
+                       return null;
+               }
+
+               // Oldid given and isn't the latest; update the timestamp.
+               // This will result in no further notification emails being sent!
+               // Calls Revision::getTimestampFromId in normal operation
+               $notificationTimestamp = call_user_func(
+                       $this->revisionGetTimestampFromIdCallback,
+                       $title,
+                       $oldid
+               );
+
+               // We need to go one second to the future because of various strict comparisons
+               // throughout the codebase
+               $ts = new MWTimestamp( $notificationTimestamp );
+               $ts->timestamp->add( new DateInterval( 'PT1S' ) );
+               $notificationTimestamp = $ts->getTimestamp( TS_MW );
+
+               if ( $notificationTimestamp < $item->getNotificationTimestamp() ) {
+                       if ( $force != 'force' ) {
+                               return false;
+                       } else {
+                               // This is a little silly…
+                               return $item->getNotificationTimestamp();
+                       }
+               }
+
+               return $notificationTimestamp;
+       }
+
+       /**
+        * @param User $user
+        * @param int $unreadLimit
+        *
+        * @return int|bool The number of unread notifications
+        *                  true if greater than or equal to $unreadLimit
+        */
+       public function countUnreadNotifications( User $user, $unreadLimit = null ) {
+               $queryOptions = [];
+               if ( $unreadLimit !== null ) {
+                       $unreadLimit = (int)$unreadLimit;
+                       $queryOptions['LIMIT'] = $unreadLimit;
+               }
+
+               $dbr = $this->getConnectionRef( DB_REPLICA );
+               $rowCount = $dbr->selectRowCount(
+                       'watchlist',
+                       '1',
+                       [
+                               'wl_user' => $user->getId(),
+                               'wl_notificationtimestamp IS NOT NULL',
+                       ],
+                       __METHOD__,
+                       $queryOptions
+               );
+
+               if ( !isset( $unreadLimit ) ) {
+                       return $rowCount;
+               }
+
+               if ( $rowCount >= $unreadLimit ) {
+                       return true;
+               }
+
+               return $rowCount;
+       }
+
+       /**
+        * Check if the given title already is watched by the user, and if so
+        * add a watch for the new title.
+        *
+        * To be used for page renames and such.
+        *
+        * @param LinkTarget $oldTarget
+        * @param LinkTarget $newTarget
+        */
+       public function duplicateAllAssociatedEntries( LinkTarget $oldTarget, LinkTarget $newTarget ) {
+               $oldTarget = Title::newFromLinkTarget( $oldTarget );
+               $newTarget = Title::newFromLinkTarget( $newTarget );
+
+               $this->duplicateEntry( $oldTarget->getSubjectPage(), $newTarget->getSubjectPage() );
+               $this->duplicateEntry( $oldTarget->getTalkPage(), $newTarget->getTalkPage() );
+       }
+
+       /**
+        * Check if the given title already is watched by the user, and if so
+        * add a watch for the new title.
+        *
+        * To be used for page renames and such.
+        * This must be called separately for Subject and Talk pages
+        *
+        * @param LinkTarget $oldTarget
+        * @param LinkTarget $newTarget
+        */
+       public function duplicateEntry( LinkTarget $oldTarget, LinkTarget $newTarget ) {
+               $dbw = $this->getConnectionRef( DB_MASTER );
+
+               $result = $dbw->select(
+                       'watchlist',
+                       [ 'wl_user', 'wl_notificationtimestamp' ],
+                       [
+                               'wl_namespace' => $oldTarget->getNamespace(),
+                               'wl_title' => $oldTarget->getDBkey(),
+                       ],
+                       __METHOD__,
+                       [ 'FOR UPDATE' ]
+               );
+
+               $newNamespace = $newTarget->getNamespace();
+               $newDBkey = $newTarget->getDBkey();
+
+               # Construct array to replace into the watchlist
+               $values = [];
+               foreach ( $result as $row ) {
+                       $values[] = [
+                               'wl_user' => $row->wl_user,
+                               'wl_namespace' => $newNamespace,
+                               'wl_title' => $newDBkey,
+                               'wl_notificationtimestamp' => $row->wl_notificationtimestamp,
+                       ];
+               }
+
+               if ( !empty( $values ) ) {
+                       # Perform replace
+                       # Note that multi-row replace is very efficient for MySQL but may be inefficient for
+                       # some other DBMSes, mostly due to poor simulation by us
+                       $dbw->replace(
+                               'watchlist',
+                               [ [ 'wl_user', 'wl_namespace', 'wl_title' ] ],
+                               $values,
+                               __METHOD__
+                       );
+               }
+       }
+
+}
index cb59739..eaa685c 100644 (file)
        "title-invalid-interwiki": "milungucay a kasabelih satangahan yamalyilu la’cus pisaungay i satangahan a milakuid Wiki masasiket.",
        "title-invalid-talk-namespace": "milungucay a kasabelih satangahan nimicaliw hakay inayi’ay a sasukamu belih",
        "title-invalid-characters": "milungucay a kasabelih satangahan yamalyilu la’cusay a tatebanan-nisulitan: \"$1\".",
+       "title-invalid-magic-tilde": "milunguc tu kasabelih satangahan izaw ku la’cusay a kaliwaza masalaing bacu  (<nowiki>~~~</nowiki>)",
        "title-invalid-too-long": "namilungucay a kasabelih satangahan mangasiw, satangahan pisaungay UTF-8 sakababalic a bang gu amana mangasiw $1 {{PLURAL:$1|wyiyincu}}.",
        "title-invalid-leading-colon": "milungucay a kasabelih  satangahan yamalyilu la’cusay a mahaw-bacu i lalingatuan.",
        "perfcachedts": "isasa’ay u saduba’ kalunasulitan, sazikuz misabaluh tuki sa u $1. saduba’ kalunasulitan sayadah sa kapah misuped  {{PLURAL:$4|1 ku heci|$4 ku heci}}.",
        "viewyourtext": "kapah kisu miciwsace atu kopi ilabu’ tina kasabelih <strong> kisu mikawaway-kalumyiti </strong> yuensma-kodo.",
        "namespaceprotected": "inayi’ ku tungus kisu mikawaway-kalumyiti <strong>$1</strong> pangangananay a salaedan a kasabelih.",
        "customcssprotected": "inayi’ ku tungus kisu mikawaway-kalumyiti tina CSS kasabelih, zayhan tina kasabelih yamalyilu ku zuma misaungayay teked a setin.",
+       "customjsprotected": "kisu sa inayi’ ku tungus mikawaway-kalumyiti tina JavaScript kasabelih, zayhan tina kasabelih yamalyilu tu zuma misaungayay nu teked a setin.",
        "mycustomcssprotected": "inayi’ tungus mikawaway-kalumyiti tina CSS kasabelih.",
        "mycustomjsprotected": "inayi’ tungus kisu mikawaway-kalumyiti tina JavaScript kasabelih.",
        "myprivateinfoprotected": "inayi’ tungus kisu mikawaway-kalumyiti cesyun nu misu.",
        "noemail": "misaungayay \"$1\" inayi’ imyiyo(email) puenengan nasulitan.",
        "noemailcreate": "maydih kisu nipabeli cacay kapahay a imyiyo(email) puenengan.",
        "passwordsent": "misaungayay \"$1\" a baluhay mima mapatahkal tu i saayaway a imyiyo(email) puenengan, kapihalhal henay maala tu tigami miliyaw patalabu aca",
+       "blocked-mailpassword": "numisu a IP puenengan malangat tu caay kahasa mikawaway-kalumyiti, satezep tu namakay tini IP puenengan a mima panukasan sasahicaan a mitena’ patahtah.",
        "mailerror": "pabahel imyiyo(email) mungangaw: $1",
        "emailauthenticated": "imyiyo(email) puenengan nu misu malucek tu i $2 $3.",
        "emailnotauthenticated": "imyiyo(email) puenengan mu misu caay henay malucek, cayhenay patigami kisu isasa’ay a sasahicaan a imyiyo(email).",
        "userpage-userdoesnotexist-view": "misaungayay canghaw \"$1\" caay henay mapangangan.",
        "blocked-notice-logextract": "tina misaungayay malangat tu ayza.\nisasa’ay ku capi demiad malangatay a nasulitan apabeli miazih tu tatenga’ay:",
        "clearyourcache": "<strong> azihen:</strong>izikuzay misuped kisu kanca palawpes saazihay-sakaluk kabilil-miala ngay maazih sabaluhay sumad.\n* <strong>Firefox / Safari:</strong> pecec <em>Shift</em> sa sapecec <em> miliyaw lisimeten </em>, saca pecec <em>Ctrl-F5</em> saca <em>Ctrl-R</em> (Mac sa ku <em>⌘-R</em>) \n* <strong>Google Chrome:</strong> pecec <em>Ctrl-Shift-R</em> (Mac sa ku <em>⌘-Shift-R</em>) \n* <strong>Internet Explorer:</strong> pecec <em>Ctrl</em> sa sapecec <em> miliyaw lisimeten </em>, saca pecec <em>Ctrl-F5</em>\n* <strong>Opera:</strong> taayaw <em> pili’  →  setin </em> (i Mac ku <em>Opera →  setin tu kanamuhan </em>) nazikuzan sa katukuh aca <em> midimut kasikazan & kazahkezan → palawpes azih  kalunasulitan → kabilil-miala tuway a zunga atu tangan </em>",
+       "usercsspreview": "<strong>mipataayaway miazih tunu misu misaungayay CSS kisu ayza, CSS caay henay misuped!</strong>",
        "userjspreview": "strong>imhini pataayaway miazih kisu numisuay misaungayay a JavaScript.\nJavaScript caay henay misuped!</strong>",
        "sitecsspreview": "<strong>imhini kisu ayza i pataayaway miazih tina CSS, CSS caay henay suped!</strong>",
        "sitejspreview": "<strong> mipataayaway miazih tina JavaScript kisu ayza, JavaScript caay henay misuped!</strong>",
        "permissionserrorstext-withaction": "namakay isasaay {{PLURAL:$1|mahicaay}}, inayi’ kisu situngus miteka $2 miteka tuway misaungay:",
        "recreate-moveddeleted-warn": "<strong> patalaw: imahini kisu miliyaw patizeng nasawniay masipuay tu kasabelih. </strong>\n\nkanca kisu mizateng palalid mikawaway-kalumyiti tina bilih haw?\nitini nipabeli masipu atu milimad nasulitan nazipa’an sapiazih tu tatenga’ay",
        "moveddeleted-notice": "kina kasabelih masipu tu.\nisasa nipabeli kina kasabelihay a masipu atu milimad nasulitan nakawawan, taneng miazih tu tatenga’ay.",
+       "moveddeleted-notice-recent": "ahicanaca, tina a kasabelih ayaw sahenay masipu tu (caay sungaliw 24 a tuki).\nisasa’ sa nipabeli tina kasabelih a masipu atu milimad nasulitan nazipa’an sapihica miazih tu tatenga’ay.",
        "log-fulllog": "ciwsace leku nasulitan-nazipa’an",
        "edit-hook-aborted": "mikawaway-kalumyiti masatezep tuway nay Hook.\nzumasatu caay patukil inayi’ amahicahica buhci tu kamu.",
        "edit-gone-missing": "la’cus misabaluh kasabelih.\nkya kasabelih hakay masipu tuway.",
        "rev-deleted-user": "(misipu misaungayay a kalungangan tuway)",
        "rev-deleted-event": "(masipu tu nasulitan-nazipa’an nu paazih tu sulit)",
        "rev-deleted-user-contribs": "[misaungayay a kalungangan saca IP puenengan masipu tuway - madimut paanin piazihan-tu-sulit a mikawaway-kalumyiti]",
+       "rev-deleted-no-diff": "zayhan kasabelih u cacay masumad nu ayaway mapa <strong>masipu</strong>, la’cus kisu miciwsace tu kasasizuma.",
        "rev-delundel": "misumad ku maazihay",
        "rev-showdeleted": "paazih",
        "revisiondelete": "masipu/palawpes misipu masumad nu ayaway",
        "revdelete-nooldid-title": "la’cusay a pamutekan masumad nu ayaway",
+       "revdelete-nooldid-text": "inayi’ matuzu’ay kisu amahicahica tu amisaungay tina sasahicaan pamutekan masumad nu ayaway nu ayaway, saca  matuzu’ay sumad inayi’ay, saca kisu mitanam midimut ayza a sumad",
        "revdelete-no-file": "matuzu’ay a tangan inayi’ tu.",
        "revdelete-show-file-submit": "hang",
        "revdelete-selected-text": "mapili’ tuway [[:$2]] tebanay{{PLURAL:$1|cacayay|yadahay}} masumad nu ayaway",
        "rcfilters-filter-logactions-label": "saungay a nasulitan nazipa’an",
        "rcfilters-filter-logactions-description": "mikuwan saungay, patizeng canghaw, misipu kasabelih, patapabaw...",
        "rcfilters-hideminor-conflicts-typeofchange": "izaw ku zumaay misumad nikalahizaan la’cus matuzu’ay mala \"mikilulay\", sisa tina sakacucek nu misapili’ atu isasa’ay a sumad nikalahizaan sakacucek nu misapili’ sasula’cus: $1",
+       "rcfilters-typeofchange-conflicts-hideminor": "tina misumad nikalahizaan sakacucek nu misapili’ atu \"mikilulay mikawaway-kalumyiti\" sakacucek nu misapili’sasula’cus, uzuma misumad nikalahizaan la’cus matuzu’ay ku \"mikilulay\"",
        "rcfilters-filtergroup-lastRevision": "sabaluhay masumad",
        "rcnotefrom": "isasa’ay a {{PLURAL:$5|ku}}nay <strong>$3 $4</strong> a sumad  (sayadah paazih <strong>$1</strong>).",
        "rclistfrom": "paazih nay $3 $2 baluhayay a sumad katukuh ayza",
        "largefileserver": "tina tangan hacica-tabaki mangsiw sefu-kikay setin a mahasaay a subal.",
        "emptyfile": "patapabaway tu tangan nu misu nayay ilabu.\nhakay u tangan a kalungangan mungangaw ku sulitan.\nkapikinsa maydih kisu patapabaw tu nayaay a tangan.",
        "windows-nonascii-filename": "tina Wiki caay midama pisaungay sazumaay bacu a tangan kalungangan.",
+       "fileexists-no-change": "patapabaway a tangan atu ayza baziyong a <strong>[[:$1]]</strong> tada malecad.",
        "file-exists-duplicate": "tina tangan masaliyaw isasa’ay a {{PLURAL:$1|cacay|yadah}} tangan",
        "uploadwarning": "patapabaw patalaw",
        "uploadwarning-text": "pisumad isasa’ay a tangan sapuelac atu mitanam aca.",
        "http-curl-error": "imahini miala URL sa mungangaw: $1",
        "http-bad-status": "miteka HTTP milunguc izaw tu ku munday: $1 $2",
        "upload-curl-error6": "la’cus misiket tu calay-zazan(wanglu) ta URL",
+       "upload-curl-error6-text": "la’cus misiket tu calay-zazan(wanglu) ta matuzu’ay nu URL.\nkapiliyaw miteka mikinsa URL u tatenga’ay tu haw, nika malucekay tu calay-kakacawan(wangcan) kapah ku pisaungay.",
        "upload-curl-error28": "patapabaw mautang",
        "upload-curl-error28-text": "calay-kakacawan(wangcan) mangasiw patukil a tukiay kelec. \npikinsa kya calay-kakacawan(wangcan) malecek saungay haw? pihanhan henay pitaneng aca.\npatahkal nizateng tisuwan kapah kisu i caay makalahay a tuki mitanam misiket tu calay-zazan(wanglu).",
        "license": "sapabeli tu kinli a cedang",
        "wantedpages": "maydihay a kasabelih",
        "wantedpages-badtitle": "kyu i lecapuay a satangahan la’cus: $1",
        "wantedfiles": "maydihay a tangan",
+       "wantedfiletext-cat-noforeign": "isasa’ay a tangan mapasaungay tu uyzasa inayi’ay. tina a dada’ silabas kakaiyan tu, kasabelih sipakabit ilabu’ nika inayi’ay a tangan mapalaylay i [[:$1]]",
        "wantedtemplates": "maydihay a taazihan mitudung",
        "mostlinked": "masasiket sayadahay a kasabelih",
        "mostlinkedcategories": "masasiket sayadahay a kakuniza",
        "undeleteinvert": "kabelihan mipili’",
        "undeletecomment": "mahicaay:",
        "cannotundelete": "liyad saca hamin a palawpes  misipu mungangaw:\n$1",
+       "undelete-header": "kapiazih tu tatenga’ay [[Special:Log/delete|masipu nasulitan nazipa’an]] palalitemuh tu kawaw capi demiad masipuay kasabelih.",
        "undelete-search-title": "mikilim masipuay a kasabelih",
        "undelete-search-prefix": "paazih kasabelih miteka nay:",
        "undelete-search-submit": "kilim",
        "lockdbsuccesssub": "malahci pamutek sulu nu nasulitan tuway",
        "unlockdbsuccesssub": "misipu pamutek tu sulu nu kalunasulitan tuway",
        "lockdbsuccesstext": "mamutek tu ku nasulitan-sulu. <br />\namana kapawan anu mahemin midiput pahezek [[Special:UnlockDB| mihulak pamutek ]] nasulitan-sulu.",
+       "lockfilenotwritable": "inayi’ tungus suliten nasulitan-sulu pamutek tu tangan.\ncalay-belih(wangyi) sefu-kikay maydih tu tangan a suliten tungus u azihen atu mihulak pamutek nasulitan-sulu.",
        "databaselocked": "pamutek tuway ku kalunasulitan-sulu",
        "databasenotlocked": "caay pamutek henay ku kalunasulitan-sulu",
        "lockedbyandtime": "(nay {{GENDER:$1|$1}} i $2 a $3)",
        "creditspage": "kasabelih kasakumi nu misayingaay",
        "nocredits": "tina kasabelih inayi’ kasakumi nu misayingaay cesyun.",
        "spamprotectiontitle": "misapili’ a cengse nu babakahen a sulit",
+       "spamprotectiontext": "misulitan a sulit lacul nu misu mapasatezepan misuped tu tatuni’ palatuh misebsebay a cengse, hakay zayhan misu a lacul yamalyilu tu malangat ku hekal masasiket.",
        "spamprotectionmatch": "isasa’ay a lacul mateka’ babakahen a sulit sebseb cengse:$1",
        "spambot_username": "misadimel MediaWiki babakahen a sulit",
        "spam_reverting": "patiku tayza caay yamalyilu $1 masasiket a sabaluhay masumad nu ayaway",
index d9fa9b0..9abf0be 100644 (file)
        "recentchanges-label-plusminus": "صفحه‌نین اؤلچوسو بایت میقداری ایله تعیین ائدیلیر",
        "recentchanges-legend-heading": "<strong>قیسالتمالار:</strong>",
        "recentchanges-legend-newpage": "{{int:recentchanges-label-newpage}} (بیرده [[Special:NewPages|یئنی صفحه‌لرین لیستینه]] باخین)",
+       "rcfilters-other-review-tools": "داها یوخلاما آلتلری",
+       "rcfilters-savedqueries-defaultlabel": "ذخیره اوْلونموش فیلترلر",
        "rcnotefrom": "آشاغی داکی دَییشیک لرده <strong>$3, $4</strong> (دن <strong>$1</strong> {{PLURAL:$5|چان گوستریلیب|چان گوستریلیب دیر}}).",
        "rclistfrom": "$3 $2 واختیندان باشلایاراق یئنی دییشیکلری گؤستر",
        "rcshowhideminor": "کیچیک دَییشیکلری $1",
index 309e431..1e4226c 100644 (file)
        "uploadstash-exception": "Не магу захаваць загрузку ў сховішчы ($1): «$2».",
        "uploadstash-bad-path": "Шлях не існуе.",
        "uploadstash-bad-path-invalid": "Шлях не зьяўляецца слушным.",
+       "uploadstash-bad-path-unknown-type": "Невядомы тып «$1».",
+       "uploadstash-bad-path-unrecognized-thumb-name": "Невядомая назва мініятуры.",
+       "uploadstash-bad-path-no-handler": "Ня знойдзены апрацоўнік для mime-тыпу $1 файлу $2.",
+       "uploadstash-bad-path-bad-format": "Ключ «$1» мае няслушны фармат.",
        "invalid-chunk-offset": "Няслушнае зрушэньне фрагмэнту",
        "img-auth-accessdenied": "Доступ забаронены",
        "img-auth-nopathinfo": "Адсутнічае PATH_INFO.\nВаш сэрвэр не ўстаноўлены на пропуск гэтай інфармацыі.\nМагчма, ён працуе праз CGI і не падтрымлівае img_auth.\nГлядзіце https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization.",
index 6c39836..b49efdb 100644 (file)
        "action-applychangetags": "আপনার পরিবর্তনগুলোর সাথে ট্যাগ সংযোজন করুন",
        "action-changetags": "নির্দিষ্ট সংস্করণ এবং লগ ভুক্তিগুলিতে যথেচ্ছভাবে ট্যাগ সংযোজন ও অপসারণ করা",
        "action-deletechangetags": "ডাটাবেজ থেকে ট্যাগ অপসরণ করার",
-       "action-purge": "এই পাতা হালনাগাদ করার",
+       "action-purge": "এই পাতাটি শোধন করুন",
        "nchanges": "$1টি {{PLURAL:$1|পরিবর্তন}}",
        "enhancedrc-since-last-visit": "{{PLURAL:$1|সর্বশেষ প্রদর্শনের পর}} $1টি",
        "enhancedrc-history": "ইতিহাস",
index 99f31db..80ecf13 100644 (file)
        "timezoneregion-indian": "Oceà Índic",
        "timezoneregion-pacific": "Oceà Pacífic",
        "allowemail": "Permet que altres usuaris m'enviïn missatges per correu electrònic",
+       "email-blacklist-label": "Prohibeix a aquests usuaris que m'enviïn correus electrònics:",
        "prefs-searchoptions": "Cerca",
        "prefs-namespaces": "Espais de noms",
        "default": "per defecte",
        "rcfilters-filtergroup-lastRevision": "Darreres revisions",
        "rcfilters-filter-lastrevision-label": "Darrera revisió",
        "rcfilters-filter-lastrevision-description": "El canvi més recent a una pàgina.",
-       "rcfilters-filter-previousrevision-label": "Revisions anteriors",
+       "rcfilters-filter-previousrevision-label": "No la darrera revisió",
        "rcfilters-filter-previousrevision-description": "Tots els canvis que no són «la darrera revisió».",
        "rcfilters-filter-excluded": "Exclòs",
        "rcfilters-exclude-button-off": "Exclou els seleccionats",
        "listfiles_size": "Mida (octets)",
        "listfiles_description": "Descripció",
        "listfiles_count": "Versions",
-       "listfiles-show-all": "Inclou versions antigues de les imatges",
+       "listfiles-show-all": "Inclou versions antigues dels fitxers",
        "listfiles-latestversion": "Versió actual",
        "listfiles-latestversion-yes": "Sí",
        "listfiles-latestversion-no": "No",
        "pageswithprop-text": "Aquesta pàgina llista les pàgines que utilitzen una propietat de pàgina en particular.",
        "pageswithprop-prop": "Nom de la propietat:",
        "pageswithprop-reverse": "Ordena en invers",
+       "pageswithprop-sortbyvalue": "Ordena pel valor de la propietat",
        "pageswithprop-submit": "Vés",
        "pageswithprop-prophidden-long": "valor de propietat text llarg ocult ($1)",
        "pageswithprop-prophidden-binary": "valor de propietat binària oculta ($1)",
        "enotif_lastdiff": "Per a visualitzar aquest canvi, consulteu $1",
        "enotif_anon_editor": "usuari anònim $1",
        "enotif_body": "Benvolgut/uda $WATCHINGUSERNAME,\n\n$PAGEINTRO $NEWPAGE\n\nResum de l'editor: $PAGESUMMARY $PAGEMINOREDIT\n\nContacteu amb l'editor:\ncorreu: $PAGEEDITOR_EMAIL\nwiki: $PAGEEDITOR_WIKI\n\nNo rebreu més notificacions en cas de més activitat a menys que visiteu aquesta pàgina havent iniciat sessió.\nTambé podeu canviar el mode de notificació de les pàgines que vigileu en la vostra llista de seguiment.\n\nEl servei de notificacions del projecte {{SITENAME}}\n\n--\nPer a canviar les opcions de notificació per correu electrònic aneu a\n{{canonicalurl:{{#special:Preferences}}}}\n\nPer a canviar les opcions de la vostra llista de seguiment aneu a\n{{canonicalurl:{{#special:EditWatchlist}}}}\n\nPer eliminar la pàgina de la vostra llista de seguiment aneu a\n$UNWATCHURL\n\nSuggeriments i ajuda:\n$HELPPAGE",
+       "enotif_minoredit": "Aquesta és una modificació menor",
        "created": "creada",
        "changed": "modificada",
        "deletepage": "Elimina la pàgina",
        "undelete-search-title": "Cerca de pàgines esborrades",
        "undelete-search-box": "Cerca pàgines esborrades",
        "undelete-search-prefix": "Mostra pàgines que comencin:",
+       "undelete-search-full": "Mostra títols de pàgines que continguin:",
        "undelete-search-submit": "Cerca",
        "undelete-no-results": "Amb aquest criteri de cerca, no s'ha trobat cap pàgina a l'arxiu de supressions",
        "undelete-filename-mismatch": "No es pot revertir l'eliminació de la revisió de fitxer amb marca horària $1: no coincideix el nom de fitxer",
        "compare-title-not-exists": "El títol que heu especificat no existeix.",
        "compare-revision-not-exists": "La revisió que heu especificat no existeix.",
        "diff-form": "Diferències",
+       "permanentlink-revid": "ID de la revisó",
+       "permanentlink-submit": "Vés a la revisió",
        "dberr-problems": "Ho sentim. Aquest lloc web està experimentant dificultats tècniques.",
        "dberr-again": "Intenteu esperar uns minuts i tornar a carregar.",
        "dberr-info": "(No es pot accedir a la base de dades: $1)",
index cddd35e..8b9746e 100644 (file)
        "rcfilters-savedqueries-apply-and-setdefault-label": "Vytvořit výchozí filtr",
        "rcfilters-savedqueries-cancel-label": "Zrušit",
        "rcfilters-savedqueries-add-new-title": "Uložit současné nastavení filtrů",
+       "rcfilters-savedqueries-already-saved": "Tyto filtry jsou již uloženy.",
        "rcfilters-restore-default-filters": "Obnovit výchozí filtry",
        "rcfilters-clear-all-filters": "Zrušit všechny filtry",
        "rcfilters-show-new-changes": "Zobrazit nejnovější změny",
        "uploadstash-refresh": "Aktualizovat seznam souborů",
        "uploadstash-thumbnail": "zobrazit náhled",
        "uploadstash-exception": "Načtený soubor se nepodařilo uložit do skrýše ($1): „$2“.",
+       "uploadstash-bad-path": "Cesta neexistuje.",
+       "uploadstash-bad-path-invalid": "Cesta není platná.",
+       "uploadstash-bad-path-unknown-type": "Neznámý typ „$1“.",
+       "uploadstash-file-not-found-no-thumb": "Nepodařilo se získat náhled.",
+       "uploadstash-file-not-found-no-remote-thumb": "Načtení náhledu se nepodařilo: $1\nURL = $2",
+       "uploadstash-file-too-large": "Nelze poskytnout soubor větší než $1 bajtů.",
+       "uploadstash-not-logged-in": "Není přihlášen žádný uživatel, soubory musí patřit uživatelům.",
+       "uploadstash-wrong-owner": "Tento soubor ($1) nepatří aktuálnímu uživateli.",
+       "uploadstash-no-such-key": "Uvedený klíč ($1) neexistuje, nelze odebrat.",
+       "uploadstash-zero-length": "Soubor má nulovou délku.",
        "invalid-chunk-offset": "Neplatný posun bloku",
        "img-auth-accessdenied": "Přístup odepřen",
        "img-auth-nopathinfo": "Chybí PATH_INFO.\nVáš server není nastaven tak, aby tuto informaci poskytoval.\nMožná funguje pomocí CGI a img_auth na něm nemůže fungovat.\nVizte https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization.",
index 8275d2c..de6d8bd 100644 (file)
        "tog-numberheadings": "Überschriften automatisch nummerieren",
        "tog-showtoolbar": "Bearbeiten-Werkzeugleiste anzeigen",
        "tog-editondblclick": "Seiten mit Doppelklick bearbeiten",
-       "tog-editsectiononrightclick": "Einzelne Abschnitte per Rechtsklick bearbeiten",
+       "tog-editsectiononrightclick": "Einzelne Abschnitte per Rechtsklick auf die Überschrift bearbeiten",
        "tog-watchcreations": "Selbst erstellte Seiten und hochgeladene Dateien automatisch beobachten",
        "tog-watchdefault": "Selbst geänderte Seiten und Dateien automatisch beobachten",
        "tog-watchmoves": "Selbst verschobene Seiten und Dateien automatisch beobachten",
        "rcfilters-savedqueries-apply-and-setdefault-label": "Standardfilter erstellen",
        "rcfilters-savedqueries-cancel-label": "Abbrechen",
        "rcfilters-savedqueries-add-new-title": "Aktuelle Filtereinstellungen speichern",
-       "rcfilters-savedqueries-already-saved": "Diese Filter sind bereits gespeichert",
+       "rcfilters-savedqueries-already-saved": "Diese Filter sind bereits gespeichert. Ändere deine Einstellungen, um einen neuen Gespeicherten Filter zu erstellen.",
        "rcfilters-restore-default-filters": "Standardfilter wiederherstellen",
        "rcfilters-clear-all-filters": "Alle Filter löschen",
        "rcfilters-show-new-changes": "Neueste Änderungen ansehen",
index b463d95..dc5d97d 100644 (file)
        "rcfilters-savedqueries-apply-and-setdefault-label": "Create default filter",
        "rcfilters-savedqueries-cancel-label": "Cancel",
        "rcfilters-savedqueries-add-new-title": "Save current filter settings",
-       "rcfilters-savedqueries-already-saved": "These filters are already saved",
+       "rcfilters-savedqueries-already-saved": "These filters are already saved. Change your settings to create a new Saved Filter.",
        "rcfilters-restore-default-filters": "Restore default filters",
        "rcfilters-clear-all-filters": "Clear all filters",
        "rcfilters-show-new-changes": "View newest changes",
        "magiclink-tracking-pmid-desc": "This page uses PMID magic links. See [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Magic_links mediawiki.org] on how to migrate.",
        "magiclink-tracking-isbn": "Pages using ISBN magic links",
        "magiclink-tracking-isbn-desc": "This page uses ISBN magic links. See [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Magic_links mediawiki.org] on how to migrate.",
-       "rfcurl": "//tools.ietf.org/html/rfc$1",
+       "rfcurl": "https://tools.ietf.org/html/rfc$1",
        "pubmedurl": "//www.ncbi.nlm.nih.gov/pubmed/$1?dopt=Abstract",
        "specialloguserlabel": "Performer:",
        "speciallogtitlelabel": "Target (title or {{ns:user}}:username for user):",
index ce275c8..fad42a0 100644 (file)
        "readonly": "Andmebaas lukustatud",
        "enterlockreason": "Sisesta lukustamise põhjus ning juurdepääsu taastamise ligikaudne aeg",
        "readonlytext": "Andmebaas on praegu lukustatud. Uusi sissekandeid ja muid muudatusi ei saa teha. Tõenäoliselt toimub andmebaasi plaanipärane hooldus, mille järel tavaline olukord taastub.\nSüsteemiadministraator, kes andmebaasi lukustas, andis järgmise selgituse: $1",
-       "missing-article": "Andmebaas ei leidnud küsitud lehekülje \"$1\" $2 teksti.\n\nPõhjuseks võib olla võrdlus- või ajaloolink kustutatud leheküljele.\n\nKui tegemist ei ole nimetatud olukorraga, võib tegu olla ka süsteemi veaga.\nSellisel juhul tuleks teavitada [[Special:ListUsers/sysop|administraatorit]], edastades talle ka käesoleva lehe internetiaadressi.",
+       "missing-article": "Andmebaasist ei leidnud päritud lehekülje \"$1\" $2 teksti.\n\nPõhjuseks võib olla võrdlus- või ajaloolink kustutatud leheküljele.\n\nKui asi ei ole selles, võib tegu olla süsteemi veaga.\nPalun teata sellest [[Special:ListUsers/sysop|administraatorile]], edastades ka lehekülje internetiaadressi.",
        "missingarticle-rev": "(redaktsioon: $1)",
        "missingarticle-diff": "(redaktsioonid: $1, $2)",
        "readonly_lag": "Andmebaas on automaatselt lukustatud, seniks kuni sekundaarsed andmebaasiserverid on primaarserveriga samal järjel.",
        "password-login-forbidden": "Selle kasutajanime ja parooli kasutamine on keelatud.",
        "mailmypassword": "Lähtesta parool",
        "passwordremindertitle": "{{SITENAME}} – ajutine parool",
-       "passwordremindertext": "Keegi IP-aadressiga $1, tõenäoliselt sa ise, palus, et talle saadetaks {{GRAMMAR:elative|{{SITENAME}}}} uus parool ($4). Kasutaja \"$2\" ajutiseks paroolis seati \"$3\". Kui soovid tõepoolest uut parooli, pead sisse logima ja uue parooli valima. Ajutine parool aegub {{PLURAL:$5|ühe päeva|$5 päeva}} pärast.\n\nKui uut parooli palus keegi teine või sulle meenus vana parool ja sa ei soovi seda enam muuta, võid käesolevat teadet eirata ning jätkata endise parooli kasutamist.",
+       "passwordremindertext": "Keegi IP-aadressiga $1, tõenäoliselt sa ise, palus, et talle\nsaadetaks {{GRAMMAR:elative|{{SITENAME}}}} uus parool ($4).\nKasutaja \"$2\" ajutiseks paroolis seati \"$3\". Kui soovid tõepoolest\nuut parooli, pead sisse logima ja uue parooli valima.\nAjutine parool aegub {{PLURAL:$5|ühe|$5}} päeva pärast.\n\nKui uut parooli palus keegi teine või sulle meenus vana parool\nja sa ei soovi seda enam muuta, võid seda teadet eirata ning\njätkata senise parooli kasutamist.",
        "noemail": "Kasutaja $1 e-posti aadressi meil kahjuks pole.",
        "noemailcreate": "Pead sisestama korrektse e-posti aadressi",
        "passwordsent": "Uus parool on saadetud kasutaja $1 registreeritud e-postiaadressil.\nPärast parooli saamist logige palun sisse.",
        "accountcreated": "Konto loodud",
        "accountcreatedtext": "Kasutaja [[{{ns:User}}:$1|$1]] ([[{{ns:User talk}}:$1|talk]]) konto on loodud.",
        "createaccount-title": "{{GRAMMAR:illative|{{SITENAME}}}} konto loomine",
-       "createaccount-text": "Keegi on loonud {{GRAMMAR:illative|{{SITENAME}}}} ($4) sinu e-posti aadressile vastava kasutajatunnuse \"$2\". Parooliks seati \"$3\". Logi sisse ja muuda oma parool.\n\nKui kasutajakonto loomine on eksitus, võid käesolevat sõnumit lihtsalt eirata.",
+       "createaccount-text": "Keegi on loonud {{GRAMMAR:illative|{{SITENAME}}}} ($4) sinu e-posti aadressile vastava kasutajatunnuse \"$2\". Parooliks seati \"$3\". Peaksid sisse logima ja parooli muutma.\n\nKui kasutajakonto loomine oli eksitus, võid seda sõnumit lihtsalt eirata.",
        "login-throttled": "Oled lühikese aja jooksul proovinud liiga palju kordi sisse logida.\nPalun oota $1, enne kui uuesti proovid.",
        "login-abort-generic": "Sisselogimine ebaõnnestus – Katkestatud",
        "login-migrated-generic": "Sinu konto on migreeritud ja sinu kasutajanime pole enam selles vikis.",
        "anonpreviewwarning": "''Sa pole sisse logitud. Selle lehe redigeerimislogisse salvestatakse su IP-aadress.''",
        "missingsummary": "'''Meeldetuletus:''' Sa ei ole lisanud muudatuse resümeed.\nKui vajutad uuesti salvestamise nupule, salvestatakse muudatus ilma resümeeta.",
        "selfredirect": "<strong>Hoiatus:</strong> Suunad selle lehekülje iseeneda juurde.\nVõimalik, et oled määranud ümbersuunamise jaoks vale sihtleheküljeks või redigeerid vale lehekülge.\nÜmbersuunamine luuakse sellest hoolimata, kui klõpsad uuesti \"$1\".",
-       "missingcommenttext": "Palun sisesta siit allapoole kommentaar.",
+       "missingcommenttext": "Palun sisesta kommentaar.",
        "missingcommentheader": "<strong>Meeldetuletus:</strong> Sa pole kirjutanud kommentaarile teemat.\nKui klõpsad uuesti \"$1\", salvestatakse su kommentaar ilma teemata.",
        "summary-preview": "Resümee eelvaade:",
        "subject-preview": "Resümee eelvaade:",
        "newarticle": "(Uus)",
        "newarticletext": "Lehekülge, kuhu link sind suunas, pole veel.\nEt lehekülg luua, alusta allolevas kastis kirjutamist (lisateave [$1 juhendist]).\nKui sattusid siia kogemata, klõpsa brauseri ''tagasi''-nupule.",
        "anontalkpagetext": "----''See on anonüümse kasutaja arutelulehekülg. See kasutaja pole kontot loonud või ei kasuta seda. Sellepärast tuleb meil kasutaja tuvastamiseks kasutada tema IP-aadressi. Sellist IP-aadressi võib kasutada mitu kasutajat. Kui oled osutatud IP-aadressi kasutaja ning leiad, et siinsed kommentaarid ei puutu kuidagi sinusse, [[Special:CreateAccount|loo palun kasutajakonto]] või [[Special:UserLogin|logi sisse]], et sind edaspidi teiste anonüümsete kasutajatega segi ei aetaks.''",
-       "noarticletext": "Käesoleval leheküljel hetkel teksti ei ole.\nVõid [[Special:Search/{{PAGENAME}}|otsida pealkirjaks olevat fraasi]] teistelt lehtedelt,\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} uurida asjassepuutuvaid logisid] või [{{fullurl:{{FULLPAGENAME}}|action=edit}} puuduva lehekülje ise luua]</span>.",
+       "noarticletext": "Siin leheküljel puudub praegu tekst.\nSaad [[Special:Search/{{PAGENAME}}|otsida pealkirjateksti]] teistelt lehekülgedelt,\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} uurida asjassepuutuvaid logisid]\nvõi [{{fullurl:{{FULLPAGENAME}}|action=edit}} puuduva lehekülje luua]</span>.",
        "noarticletext-nopermission": "Sellel leheküljel pole praegu teksti.\nSaad [[Special:Search/{{PAGENAME}}|otsida selle lehekülje pealkirja]] teistelt lehekülgedelt või <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} otsida seonduvatest logidest]</span>, aga sul pole õigust seda lehekülge alustada.",
        "missing-revision": "Lehekülje \"{{FULLPAGENAME}}\" redaktsiooni $1 pole.\n\nHarilikult tähendab see seda, et sind siia juhatanud link on vananenud ja siin asunud lehekülg on kustutatud.\nÜksikasjad leiad [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} kustutamislogist].",
        "userpage-userdoesnotexist": "Kasutajakontot \"<nowiki>$1</nowiki>\" pole olemas.\nPalun mõtle järele, kas soovid seda lehte luua või muuta.",
        "recentchanges-legend": "Viimaste muudatuste seaded",
        "recentchanges-summary": "Jälgi sellel leheküljel viimaseid muudatusi.",
        "recentchanges-noresult": "Selles ajavahemikus pole tehtud neile kriteeriumitele vastavaid muudatusi.",
+       "recentchanges-timeout": "See otsing aegus. Võid proovida teisi otsiparameetreid.",
+       "recentchanges-network": "Tehnilise tõrke tõttu ei õnnestunud tulemusi laadida. Palun proovi lehekülge värskendada.",
        "recentchanges-feed-description": "Jälgi vikisse tehtud viimaseid muudatusi.",
        "recentchanges-label-newpage": "Uus lehekülg",
        "recentchanges-label-minor": "Pisiparandus",
        "rcfilters-days-show-hours": "$1 {{PLURAL:$1|tund|tundi}}",
        "rcfilters-highlighted-filters-list": "Esile tõstetud: $1",
        "rcfilters-quickfilters": "Salvestatud filtrid",
-       "rcfilters-quickfilters-placeholder-title": "Linke pole veel salvestatud",
+       "rcfilters-quickfilters-placeholder-title": "Filtreid pole veel salvestatud",
        "rcfilters-quickfilters-placeholder-description": "Et filtri sätted salvestada ja et neid hiljem uuesti kasutada, klõpsa alloleva aktiivsete filtrite loendi juures järjehoidjaikooni.",
        "rcfilters-savedqueries-defaultlabel": "Salvestatud filtrid",
        "rcfilters-savedqueries-rename": "Nimeta ümber",
        "rcfilters-savedqueries-apply-and-setdefault-label": "Koosta vaikefilter",
        "rcfilters-savedqueries-cancel-label": "Loobu",
        "rcfilters-savedqueries-add-new-title": "Salvesta filtri praegused sätted",
+       "rcfilters-savedqueries-already-saved": "Need filtrid on juba salvestatud",
        "rcfilters-restore-default-filters": "Taasta vaikefiltrid",
        "rcfilters-clear-all-filters": "Eemalda kõik filtrid",
        "rcfilters-show-new-changes": "Vaata uusimaid muudatusi",
-       "rcfilters-search-placeholder": "Filtri viimaseid muudatusi (sirvi või alusta tippimist)",
+       "rcfilters-search-placeholder": "Filtri muudatusi (kasuta menüüd või otsi filtri nime)",
        "rcfilters-invalid-filter": "Vigane filter",
        "rcfilters-empty-filter": "Aktiivsed filtrid puuduvad. Näidatakse kogu kaastööd.",
        "rcfilters-filterlist-title": "Filtrid",
        "rcfilters-tag-prefix-namespace-inverted": "<strong>:mitte</strong> $1",
        "rcfilters-exclude-button-off": "Jäta valitud välja",
        "rcfilters-exclude-button-on": "Valitud välja jäetud",
-       "rcfilters-view-advanced-filters-label": "Täpsemad filtrid",
        "rcfilters-view-tags": "Märgistatud muudatused",
        "rcfilters-view-namespaces-tooltip": "Filtri tulemusi nimeruumide lõikes",
        "rcfilters-view-tags-tooltip": "Filtri tulemusi muudatusmärgiste lõikes",
        "rcfilters-view-return-to-default-tooltip": "Naase filtri peamenüüsse",
+       "rcfilters-view-tags-help-icon-tooltip": "Uuri veel märgistatud muudatuste kohta",
        "rcfilters-liveupdates-button": "Uuendused reaalajas",
        "rcfilters-liveupdates-button-title-on": "Lülita reaalajas uuendamine välja",
        "rcfilters-liveupdates-button-title-off": "Näita uusi muudatusi kohe nende tegemise järel",
        "uploaded-script-svg": "Üleslaaditud SVG-failist leiti skriptitav element \"$1\".",
        "uploaded-hostile-svg": "Üleslaaditud SVG-faili laadielemendist leiti ebaturvaline CSS.",
        "uploaded-event-handler-on-svg": "Sündmuse halduse atribuutide <code>$1=\"$2\"</code> seadmine pole SVG-failis lubatud.",
-       "uploaded-href-attribute-svg": "SVG-failis on lubatud href-atribuudiga viidata ainult sihtkohta skeemiga http:// või https://. Leiti <code>&lt;$1 $2=\"$3\"&gt;</code>.",
+       "uploaded-href-attribute-svg": "Element <a> saab href-atribuudi väärtuses linkida ainult sihtobjektile data: (manusfail), http:// või https:// või fragmendile (#, sama-dokument).  Teistes elementides, nagu <image>, on lubatud ainult data: ja fragment. Proovi SVG-faili eksportimisel faile manustada. Leiti <code>&lt;$1 $2=\"$3\"&gt;</code>.",
        "uploaded-href-unsafe-target-svg": "Üleslaaditud SVG-failist leiti href, mis viitab ebaturvalistele andmetele: URI sihtkoht <code>&lt;$1 $2=\"$3\"&gt;</code>.",
        "uploaded-animate-svg": "Üleslaaditud SVG-failist leiti silt \"animate\", mis võib href-i muuta, kasutades from-atribuuti <code>&lt;$1 $2=\"$3\"&gt;</code>.",
        "uploaded-setting-event-handler-svg": "Sündmuse halduse atribuutide seadmine on keelatud, üleslaaditud SVG-failist leiti <code>&lt;$1 $2=\"$3\"&gt;</code>.",
        "uploadstash-refresh": "Värskenda faililoendit",
        "uploadstash-thumbnail": "vaata pisipilti",
        "uploadstash-exception": "Üleslaaditavat faili ei õnnestunud peithoidlas talletada ($1): \"$2\".",
+       "uploadstash-bad-path": "Teed pole olemas.",
+       "uploadstash-bad-path-invalid": "Tee pole sobiv.",
+       "uploadstash-bad-path-unknown-type": "Tundmatu tüüp \"$1\".",
+       "uploadstash-bad-path-unrecognized-thumb-name": "Tundmatu pisipildi nimi.",
+       "uploadstash-bad-path-no-handler": "Faili $2 MIME tüübile $1 ei leitud töötlejat.",
+       "uploadstash-bad-path-bad-format": "Võti \"$1\" pole sobivas vormingus.",
+       "uploadstash-file-not-found": "Peithoidlas ei leidu võtit \"$1\".",
+       "uploadstash-file-not-found-no-thumb": "Pisipilti ei õnnestu hankida.",
+       "uploadstash-file-not-found-no-local-path": "Mastaabitud elemendi kohalikku teed ei leitud.",
+       "uploadstash-file-not-found-no-object": "Pisipildi kohalikku failiobjekti ei õnnestunud luua.",
+       "uploadstash-file-not-found-no-remote-thumb": "Pisipilti ei õnnestunud hankida: $1\nURL = $2",
+       "uploadstash-file-not-found-missing-content-type": "Sisutüübi päis puudub.",
+       "uploadstash-file-not-found-not-exists": "Ei õnnestunud leida teed või faili ennast.",
+       "uploadstash-file-too-large": "$1 baidist suuremat faili ei saa töödelda.",
+       "uploadstash-not-logged-in": "Ükski kasutaja pole sisse logitud, fail peab kuuluma kasutajatele.",
+       "uploadstash-wrong-owner": "See fail ($1) ei kuulu praegusele kasutajale.",
+       "uploadstash-no-such-key": "Puudub selline võti ($1), ei saa eemaldada.",
+       "uploadstash-no-extension": "Faililaiend puudub.",
+       "uploadstash-zero-length": "Faili suurus on tühiväärtusega.",
        "invalid-chunk-offset": "Tüki vigane nihe",
        "img-auth-accessdenied": "Juurdepääs keelatud",
        "img-auth-nopathinfo": "PATH_INFO puudub.\nSinu server pole seadistatud seda teavet edastama.\nSee võib olla CGI-põhine ja ei toeta img_auth-i.\nVaata lehekülge https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization.",
        "apihelp": "API abi",
        "apihelp-no-such-module": "Moodulit \"$1\" ei leitud.",
        "apisandbox": "API liivakast",
+       "apisandbox-jsonly": "API liivakasti kasutamine nõuab JavaScripti.",
        "apisandbox-api-disabled": "API on selles võrgukohas keelatud.",
        "apisandbox-intro": "Kasuta seda lehekülge <strong>MediaWiki API</strong> katsetamiseks.\nÜksikasjad API kasutamise kohta leiad [[mw:API:Main page|API dokumentatsioonist]]. Näide: [https://www.mediawiki.org/wiki/API#A_simple_example esilehe sisu hankimine]. Vali toiming, et näha veel näiteid.\n\nPane tähele, et kuigi siin on liivakast, võivad siin leheküljel tehtud toimingud vikit muuta.",
+       "apisandbox-fullscreen": "Laienda paneel",
+       "apisandbox-fullscreen-tooltip": "Laienda liivakastipaneel brauseriakna suuruseks",
+       "apisandbox-unfullscreen": "Näita lehekülge",
+       "apisandbox-unfullscreen-tooltip": "Vähenda liivakastipaneeli, nii et MediaWiki navigeerimislingid on nähtaval",
        "apisandbox-submit": "Tee päring",
        "apisandbox-reset": "Puhasta",
+       "apisandbox-retry": "Proovi uuesti",
+       "apisandbox-loading": "API mooduli \"$1\" teabe laadimine...",
+       "apisandbox-load-error": "API mooduli \"$1\" teabe laadimisel esines tõrge: $2",
+       "apisandbox-no-parameters": "Sellel API moodulil pole parameetreid.",
+       "apisandbox-helpurls": "Abilingid",
        "apisandbox-examples": "Näited",
+       "apisandbox-dynamic-parameters": "Lisaparameetrid",
+       "apisandbox-dynamic-parameters-add-label": "Lisa parameeter:",
+       "apisandbox-dynamic-parameters-add-placeholder": "Parameetri nimi",
+       "apisandbox-dynamic-error-exists": "Parameeter nimega \"$1\" on juba olemas.",
+       "apisandbox-deprecated-parameters": "Vananenud parameetrid",
+       "apisandbox-fetch-token": "Hangi luba automaatselt",
+       "apisandbox-submit-invalid-fields-title": "Mõned väljad on vigased",
+       "apisandbox-submit-invalid-fields-message": "Palun paranda märgitud väljad ja proovi uuesti.",
        "apisandbox-results": "Tulemused",
+       "apisandbox-sending-request": "API päringu saatmine...",
+       "apisandbox-loading-results": "API tulemuste laekumine...",
+       "apisandbox-results-error": "API päringu vastuse laadimisel esines tõrge: $1.",
+       "apisandbox-results-login-suppressed": "See päring tehti välja logitud kasutajaga, mida saab kasutada selleks, et hiilida mööda brauseri sama päritolu turvafunktsioonist. Pane tähele, et sellise päringuga ei töötle API liivakast automaatset luba õigesti. Palun sisesta luba käsitsi.",
+       "apisandbox-request-selectformat-label": "Näita päringu andmeid nii:",
+       "apisandbox-request-format-url-label": "URL-päringusõne",
        "apisandbox-request-url-label": "Päringu URL:",
+       "apisandbox-request-json-label": "Päringu JSON:",
        "apisandbox-request-time": "Päringuaeg: {{PLURAL:$1|$1 ms}}",
        "booksources": "Raamatuotsimine",
        "booksources-search-legend": "Raamatuotsimine",
        "protect-expiring": "aegumistähtaeg $1 (UTC)",
        "protect-expiring-local": "aegumistähtaeg $1",
        "protect-expiry-indefinite": "tähtajatu",
-       "protect-cascade": "Kaitse lehekülgi, mis on lülitatud käesoleva lehekülje koosseisu (kaskaadkaitse)",
+       "protect-cascade": "Kaitse lehekülgi, mis on siinse lehekülje koosseisus (kaskaadkaitse)",
        "protect-cantedit": "Sa ei saa lehekülje kaitsetaset muuta, sest sul puudub lehekülje redigeerimise õigus.",
        "protect-othertime": "Muu aeg:",
        "protect-othertime-op": "muu aeg",
        "ipb_blocked_as_range": "Tõrge: IP-aadressi $1 pole eraldi blokeeritud ja blokeeringut ei saa eemaldada.\nSee kuulub aga blokeeritud IP-vahemikku $2, mille blokeeringut saab eemaldada.",
        "ip_range_invalid": "Vigane IP-vahemik.",
        "ip_range_toolarge": "Suuremad aadressiblokid kui /$1 pole lubatud.",
+       "ip_range_exceeded": "See IP-aadressivahemik ületab maksimumvahemikku. Lubatud vahemik: /$1.",
+       "ip_range_toolow": "IP-aadressivahemikud on sisuliselt keelatud.",
        "proxyblocker": "Proksiblokeerija",
        "proxyblockreason": "Sinu IP-aadress on blokeeritud, sest see on avatud proksi. Palun võta ühendust oma internetiteenuse pakkujaga või tehnilise toega ja teata neile sellest probleemist.",
        "sorbsreason": "Sinu IP-aadress on {{GRAMMAR:genitive|{{SITENAME}}}} kasutatavas DNS-põhises mustas nimekirjas märgitud kui avatud proksi.",
index 4df5481..a0dc4c3 100644 (file)
@@ -61,7 +61,8 @@
                        "AzorAhai",
                        "Yoosef Pooranvary",
                        "DEXi",
-                       "Obzord"
+                       "Obzord",
+                       "Alp Er Tunqa"
                ]
        },
        "tog-underline": "خط کشیدن زیر پیوندها:",
        "rcfilters-savedqueries-apply-and-setdefault-label": "ایجاد پالایه پیش‌فرض",
        "rcfilters-savedqueries-cancel-label": "لغو",
        "rcfilters-savedqueries-add-new-title": "ذخیره تنظیمات کنونی پالایه",
+       "rcfilters-savedqueries-already-saved": "این پالایه‌ها اکنون ذخیره شده‌اند",
        "rcfilters-restore-default-filters": "بازگردانی پالایه‌های پیش‌فرض",
        "rcfilters-clear-all-filters": "پاک‌کردن تمام پالایه‌ها",
        "rcfilters-show-new-changes": "دیدن جدیدترین تغییرات",
        "uploadstash-refresh": "تازه کردن فهرست پرونده‌ها",
        "uploadstash-thumbnail": "نمایش بندانگشتی",
        "uploadstash-exception": "ناتوان از ذخیره کردن بارگذاری در نهانگاه ($1): ''$2''.",
+       "uploadstash-bad-path": "مسر وجود ندارد.",
+       "uploadstash-bad-path-invalid": "مسیر معتبر نیست.",
+       "uploadstash-bad-path-unknown-type": "گونهٔ ناشناختهٔ \"$1\".",
+       "uploadstash-bad-path-unrecognized-thumb-name": "بندانگشتی نامعلوم.",
+       "uploadstash-bad-path-no-handler": "برای نمایش $1 پروندهٔ $2 اجراکننده‌ای یافت نشد.",
+       "uploadstash-bad-path-bad-format": "کلید «$1» ساختار درستی ندارد.",
+       "uploadstash-file-not-found": "کلید «$1» در انبار یافت نشد.",
+       "uploadstash-file-not-found-no-thumb": "امکان گرفتن بندانگشتی نیست.",
+       "uploadstash-file-not-found-no-local-path": "مسیر محلی برای آیتم مقایس‌شده وجود ندارد.",
+       "uploadstash-file-not-found-no-object": "امکان ساخت شیء پروندهٔ محلی برای بندانگشتی وجود ندارد.",
+       "uploadstash-file-not-found-no-remote-thumb": "دریافت بندانگشتی با مشکل مواجه شد:$1\nنشانی = $2",
+       "uploadstash-file-not-found-missing-content-type": "سرآیند نوع-محتوی یافت نشد.",
+       "uploadstash-file-not-found-not-exists": "امکان یافتن مسیر نیست، یا فایل ساده نیست.",
+       "uploadstash-file-too-large": "امکان ذخیرهٔ پرونده بیش از $1 بایت نیست.",
+       "uploadstash-not-logged-in": "هیچ کاربری به سامانه وارد نشده‌است، پرونده باید متعلق به یک کاربر باشد.",
+       "uploadstash-wrong-owner": "این پرونده ($1) به این کاربر تعلق ندارد.",
+       "uploadstash-no-such-key": "امکان حذف کلید ($1) نیست.",
+       "uploadstash-no-extension": "افزونه نیست.",
+       "uploadstash-zero-length": "اندازهٔ پرونده صفر است.",
        "invalid-chunk-offset": "جابجایی نامعتبر قطعه",
        "img-auth-accessdenied": "منع دسترسی",
        "img-auth-nopathinfo": "PATH_INFO موجود نیست.\nسرور شما برای ردکردن این مقدار تنظیم نشده‌است.\nممکن است مبتنی بر سی‌جی‌آی باشد و از img_auth پشتیبانی نکند.\nhttps://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization را ببینید.",
index d15abb3..6f3a711 100644 (file)
                        "DePlusJean",
                        "Pierpao",
                        "Vexthedorito",
-                       "Djiboun"
+                       "Djiboun",
+                       "Pols12"
                ]
        },
        "tog-underline": "Soulignement des liens :",
        "tog-watchuploads": "Ajouter les nouveaux fichiers que j’importe à ma liste de suivi",
        "tog-watchrollback": "Ajouter à ma liste de suivi les pages sur lesquelles j’ai effectué une révocation",
        "tog-minordefault": "Marquer toutes mes modifications comme étant mineures par défaut",
-       "tog-previewontop": "Afficher la prévisualisation au dessus de la zone d’édition",
+       "tog-previewontop": "Afficher la prévisualisation au-dessus de la zone de modification",
        "tog-previewonfirst": "Afficher la prévisualisation lors de la première modification",
        "tog-enotifwatchlistpages": "M’avertir par courriel lorsqu’une page ou un fichier de ma liste de suivi est modifié",
        "tog-enotifusertalkpages": "M’avertir par courriel lorsque ma page de discussion est modifiée",
        "underline-always": "Toujours",
        "underline-never": "Jamais",
        "underline-default": "Valeur par défaut du thème ou du navigateur",
-       "editfont-style": "Style de police de la zone d’édition :",
+       "editfont-style": "Style de police de la zone de modification :",
        "editfont-monospace": "Police à chasse fixe",
        "editfont-sansserif": "Police sans-serif",
        "editfont-serif": "Police serif",
        "autoredircomment": "Page redirigée vers [[$1]]",
        "autosumm-new": "Page créée avec « $1 »",
        "autosumm-newblank": "Page vide créée",
-       "size-bytes": "$1&nbsp;o",
+       "size-bytes": "$1 {{PLURAL:$1|octet|octets}}",
        "size-kilobytes": "$1&nbsp;Kio",
        "size-megabytes": "$1&nbsp;Mio",
        "size-gigabytes": "$1&nbsp;Gio",
        "feedback-close": "Terminé",
        "feedback-external-bug-report-button": "Signaler un bogue technique",
        "feedback-dialog-title": "Soumettre un commentaire",
-       "feedback-dialog-intro": "Vous pouvez utiliser le simple formulaire ci-dessous pour faire parvenir vos commentaires. Votre commentaire sera ajouté à la page « $1 », ainsi que votre nom d’utilisateur.",
+       "feedback-dialog-intro": "Vous pouvez utiliser le simple formulaire ci-dessous pour faire parvenir votre commentaire. Il sera ajouté à la page « $1 », avec votre nom d’utilisateur.",
        "feedback-error1": "Erreur : résultat de l'API non reconnu",
        "feedback-error2": "Erreur : la modification a échoué",
        "feedback-error3": "Erreur : aucune réponse de l'API",
        "default-skin-not-found-row-disabled": "* <code>$1</code> / $2 (<strong>désactivé</strong>)",
        "mediastatistics": "Statistiques sur les médias",
        "mediastatistics-summary": "Statistiques sur les types de fichiers téléversés. Elles ne prennent en compte que la version la plus récente des fichiers. Les versions anciennes ou supprimées sont exclues.",
+       "mediastatistics-nfiles": "$1 ($2 %)",
        "mediastatistics-nbytes": "{{PLURAL:$1|$1 octet|$1 octets}} ($2 ; $3%)",
        "mediastatistics-bytespertype": "Taille totale de fichiers pour cette section : {{PLURAL:$1|$1 octet|$1 octets}} ($2 ; $3%).",
        "mediastatistics-allbytes": "Taille totale pour tous les fichiers : {{PLURAL:$1|$1 octet|$1 octets}} ($2).",
        "authprovider-confirmlink-message": "D’après vos dernières tentatives de connexion, les comptes suivants peuvent être liés à votre compte wiki. Les lier vous permettra de se connecter via ces comptes. Veuillez sélectionner lesquels doivent être liés.",
        "authprovider-confirmlink-request-label": "Comptes qui doivent être liés",
        "authprovider-confirmlink-success-line": "$1 : Liés avec succès.",
+       "authprovider-confirmlink-failed-line": "$1 : $2",
        "authprovider-confirmlink-failed": "La liaison du compte n’a pas bien réussi : $1",
        "authprovider-confirmlink-ok-help": "Continuer après l’affichage des messages d’échec de liaison.",
        "authprovider-resetpass-skip-label": "Sauter",
index d03fe22..e956dcc 100644 (file)
        "bad_image_list": "Is é seo a leanas an formáid:\n\nNíl ach míreanna liosta amháin (línte ag tosú le *) san áireamh.\nIs riachtanach gur nasc do dhrochchomhad é an chéad nasc ar líne.\nIs eisceachtaí iad na naisc eile ar an líne céanna, .i. leathanaigh gur féidir an comhad a bheith orthu go hinlíne.",
        "metadata": "Meiteasonraí",
        "metadata-help": "Tá breis eolais sa comhad seo, curtha, is dócha, as ceamara digiteach ná scanóir a chruthaigh ná a digitigh é.\nMá tá an comhad mionathraithe as an bunleagan, b'fhéidir nach mbeidh ceann de na sonraí fágtha sa comhad atá athruithe.",
-       "metadata-expand": "Taispeáin sonraí síneadh",
+       "metadata-expand": "Taispeáin sonraí sínte",
        "metadata-collapse": "Folaigh sonraí síneadh",
        "metadata-fields": "Beidh na meiteasonraí EXIF seo a leanas dá dtaispeáint ar an leathanach íomhá nuair atá an clár meiteasonraí ceilte.\nBeidh na cinn eile ceilte de réir réamhshocraithe.\n* make\n* model\n* datetimeoriginal\n* exposuretime\n* fnumber\n* isospeedratings\n* focallength\n* artist\n* copyright\n* imagedescription\n* gpslatitude\n* gpslongitude\n* gpsaltitude",
        "exif-imagewidth": "Leithead",
index 51286cd..e8ae8e4 100644 (file)
        "rcfilters-savedqueries-apply-and-setdefault-label": "Crear filtro por defecto",
        "rcfilters-savedqueries-cancel-label": "Cancelar",
        "rcfilters-savedqueries-add-new-title": "Gardar a configuración do filtro actual",
+       "rcfilters-savedqueries-already-saved": "Estes filtro xa están gardados",
        "rcfilters-restore-default-filters": "Restaurar os filtros por defecto",
        "rcfilters-clear-all-filters": "Borrar todos os filtros",
        "rcfilters-show-new-changes": "Mostrar os cambios máis recentes",
index 6584a3d..7744632 100644 (file)
        "rcfilters-restore-default-filters": "Alapértelmezett szűrők visszaállítása",
        "rcfilters-clear-all-filters": "Összes szűrő kikapcsolása",
        "rcfilters-show-new-changes": "Legfrissebb változtatások megtekintése",
-       "rcfilters-search-placeholder": "Friss változtatások szűrése (böngéssz vagy kezdj el gépelni)",
+       "rcfilters-search-placeholder": "Változtatások szűrése (használd a menüt vagy keress szűrőkre)",
        "rcfilters-invalid-filter": "Érvénytelen szűrő",
        "rcfilters-empty-filter": "Nincs aktív szűrő. Minden közreműködés látható.",
        "rcfilters-filterlist-title": "Szűrők",
index 7cae851..5587cc0 100644 (file)
        "welcomecreation-msg": "Akun panjenengan wis kacipta. Aja lali nata konfigurasi [[Special:Preferences|preferensi {{SITENAME}}]] panjenengan.",
        "yourname": "Jeneng panganggo:",
        "userlogin-yourname": "Jeneng panganggo",
-       "userlogin-yourname-ph": "Isinen jeneng panganggoné panjenengan",
+       "userlogin-yourname-ph": "Isi jeneng-panganggo panjenengan",
        "createacct-another-username-ph": "Isi jeneng panganggo",
        "yourpassword": "Tembung wadi:",
        "userlogin-yourpassword": "Tembung wadi",
        "createacct-yourpassword-ph": "Isi tembung wadi",
        "yourpasswordagain": "Tik manèh tembung wadiné:",
        "createacct-yourpasswordagain": "Konfirmasi tembung wadi",
-       "createacct-yourpasswordagain-ph": "Lebokaké manèh tembung wadiné",
+       "createacct-yourpasswordagain-ph": "Isi manèh tembung wadi mau",
        "userlogin-remembermypassword": "Gawé supaya panggah mlebu log",
        "userlogin-signwithsecure": "Nganggo koneksi aman",
        "cannotlogin-title": "Ora bisa mlebu log",
        "userlogin-createanother": "Gawé akun liya",
        "createacct-emailrequired": "Alamat layang-èl",
        "createacct-emailoptional": "Alamat layang-èl (manasuka)",
-       "createacct-email-ph": "Isinen layang-èlé panjenengan",
+       "createacct-email-ph": "Isi layang-èl panjenengan",
        "createacct-another-email-ph": "Isi alamat layang-èl",
-       "createaccountmail": "Anggonen tembung wadi sembarang sauntara lan kirimen iku menyang alamat layang-èl sing dikarepaké",
+       "createaccountmail": "Nganggo tembung wadi sauntara sing dikirimaké menyang alamat layang-èl",
        "createacct-realname": "Jeneng asli (manasuka)",
        "createacct-reason": "Alesan",
        "createacct-reason-ph": "Alesané panjenengan nggawé akun liya",
        "resetpass-abort-generic": "Ngowahi tembung wadi kawurungaké déning èkstènsi.",
        "passwordreset": "Balèni gawé tembung wadi",
        "passwordreset-text-one": "Lengkapana formulir iki kanggo nampa tembung sandhi sementara lewat layang elektronik.",
-       "passwordreset-text-many": "{{PLURAL:$1|Isinen salah sijine kotak ing ngisor iki kanggo nampa tembung sandhi sementara lewat layang elektronik.}}",
+       "passwordreset-text-many": "{{PLURAL:$1|Isi salah siji babagan ing ngisor iki supaya bisa nampa tembung wadi sauntara lumantar layang-èl.}}",
        "passwordreset-disabled": "Setèl ulang tembung wadi dipatèni ing wiki iki.",
        "passwordreset-emaildisabled": "Fitur layang elektronik wis dipateni ing wiki iki.",
        "passwordreset-username": "Jeneng panganggo:",
        "passwordreset-emailsentemail": "Yèn layang èlèktronik iki nggayut akuning sampéyan, layang kanggo salin tembung wadi bakal dikirim.",
        "passwordreset-emailsentusername": "Manawa ana alamat layang-èl sing ana gayutané karo jeneng panganggo iki, layang-èl kanggo nyetèl ulang tembung wadi bakal dikirim.",
        "changeemail": "Owah utawa busak alamat layang-èl",
-       "changeemail-header": "Isinen formulir iki saperlu salin alamat layang-èlé panjenengan. Manawa panjenengan péngin ngilangi gegayutané alamat layang-èl saka akuné panjenengan, kosongaké waé babagan layang-èl anyar nalika ngirim formuliré.",
+       "changeemail-header": "Isi formulir iki saperlu salin alamat layang-èl panjenengan. Manawa panjenengan péngin ngilangi gegayutané alamat layang-èl saka akuné panjenengan, kosongaké waé babagan layang-èl anyar nalika ngirim formuliré.",
        "changeemail-no-info": "Sampéyan kudu mlebu log kanggo ngaksès kaca iki langsung.",
        "changeemail-oldemail": "Alamat layang-èl saiki:",
        "changeemail-newemail": "Alamat layang-èl anyar:",
        "changeemail-none": "(ora ana)",
        "changeemail-password": "Sandi {{SITENAME}} panjenengan:",
        "changeemail-submit": "Ganti layang-èl",
-       "changeemail-nochange": "Mangga isinen mawa alamat layang-èl sing anyar tur béda.",
+       "changeemail-nochange": "Mangga isi mawa alamat layang-èl sing anyar tur béda.",
        "resettokens": "Reset token",
        "resettokens-text": "Anda dapat me-reset Token yang memungkinkan akses ke data pribadi tertentu yang terkait dengan akun Anda di sini.\n\nAnda harus melakukannya jika Anda secara tidak sengaja berbagi dengan seseorang atau jika akun Anda telah disusupi.",
        "resettokens-no-tokens": "Ora ana token sing bisa direset.",
        "rcfilters-filter-lastrevision-description": "Mung owahan paling anyar marang kacané.",
        "rcfilters-filter-previousrevision-label": "Dudu révisi pungkasan",
        "rcfilters-filter-previousrevision-description": "Kabèh owahan sing dudu \"révisi pungkasan\".",
-       "rcfilters-view-advanced-filters-label": "Saringan lanjutan",
        "rcfilters-view-tags": "Besutan sing tinengeran",
        "rcfilters-view-namespaces-tooltip": "Saring kasilé miturut mandala-arané",
        "rcfilters-view-tags-tooltip": "Saring kasilé nganggo tengering besutan",
index 1f945f3..159d808 100644 (file)
        "mytalk": "Diskusyón",
        "anontalk": "Diskusyón para este adresso de IP",
        "navigation": "Navigación",
-       "and": "&#32;i",
+       "and": "&#32;y",
        "faq": "DDS",
        "actions": "Aksiones",
        "namespaces": "Espacios de nombres",
        "otherlanguages": "En otras linguas",
        "redirectedfrom": "(Redirijado de $1)",
        "redirectpagesub": "Hoja redirigida",
-       "lastmodifiedat": "Esta hoja fue trocada por la vez dalcavo en el $1, a las $2 la ora.",
+       "lastmodifiedat": "Esta hoja la vez dalcavo se trocó enel $1, a las $2 la ora.",
        "viewcount": "Este pajina fue vijitado {{PLURAL:$1|una vez|$1 vezes}}.",
        "protectedpage": "Hoja guardada",
        "jumpto": "Saltar a:",
        "tooltip-pt-login": "Te consejamos de entrar a tu cuento, portanto no sos obligado",
        "tooltip-pt-logout": "Sal de tu cuento",
        "tooltip-pt-createaccount": "Te consejamos de avrir un cuento y hazer entrada allá, portanto no sos obligado",
-       "tooltip-ca-talk": "Diskusyón encima del artíkolo",
-       "tooltip-ca-edit": "Puedes trocar esta hoja. Ma te rogamos para que eches una ojada (previsteo) antes de enrejistrarla.",
+       "tooltip-ca-talk": "Diskusyón encima del contènido desta hoja",
+       "tooltip-ca-edit": "Troca esta hoja",
        "tooltip-ca-addsection": "Ajusta un kapítolo muevo",
        "tooltip-ca-viewsource": "Esta hoja está guadrada.\nPuedes ver su manadero",
        "tooltip-ca-history": "Enderechamientos passados desta hoja",
        "tooltip-n-portal": "Encima del projeto, lo que se puede hazer y ande se topa las cosas",
        "tooltip-n-currentevents": "Jhaberes de oy día en ancho",
        "tooltip-n-recentchanges": "La lista de los trocamientos dalcavo enel viki",
-       "tooltip-n-randompage": "Carga una hoja por azardo",
+       "tooltip-n-randompage": "Avre una hoja por azardo",
        "tooltip-n-help": "Para saver mas y tomar ayudo",
-       "tooltip-t-whatlinkshere": "Una lista de todas las hojas del viki que tienen atamientos a esta hoja",
+       "tooltip-t-whatlinkshere": "La lista de todas las hojas del viki que tienen atamientos a esta hoja",
        "tooltip-t-recentchangeslinked": "Los trocamientos dalcavo en las hojas atadas a la ésta",
        "tooltip-feed-rss": "Sindicación RSS de esta hoja",
        "tooltip-feed-atom": "Canal Atomo parâ esta hoja",
        "tooltip-t-emailuser": "A este usuario, mándale una letra electrόnica (ímey)",
        "tooltip-t-upload": "Suve dosyas",
        "tooltip-t-specialpages": "La lista de todas las hojas especiales",
-       "tooltip-t-print": "La forma apropiada parâ imprimir esta hoja",
+       "tooltip-t-print": "La vista desta hoja apropiada para imprimir",
        "tooltip-t-permalink": "Atamiento permanente (fikso) a este enderechamiento de la hoja",
        "tooltip-ca-nstab-main": "Ve el artíkolo",
        "tooltip-ca-nstab-user": "Ver la hoja del usador",
        "feedback-cancel": "Anular",
        "feedback-message": "Messaje",
        "feedback-subject": "Sujeto",
-       "searchsuggest-search": "Busxca en {{SITENAME}}",
+       "searchsuggest-search": "Buxca en {{SITENAME}}",
        "duration-seconds": "$1{{PLURAL:$1|segundo|segundos}}",
        "duration-minutes": "$1{{PLURAL:$1|minuto|minutos}}",
        "duration-hours": "$1{{PLURAL:$1|ora|oras}}",
index 581e409..137a1bc 100644 (file)
@@ -15,7 +15,7 @@
        },
        "tog-underline": "خط کیشائن ژێر پیوندەل:",
        "tog-hideminor": "آشاردن دەسکاریەل گؤجەر  إژ گؤەڕیال(تغییرات) ایسە(اخیر)",
-       "tog-hidepatrolled": "دسکاریۀل گه دیار بینۀ ئژ فئرست-رزگ تغییرات اخیر بشارا",
+       "tog-hidepatrolled": "ویرایش‌های گشت‌خورده از فهرست تغییرات اخیر پنهان شود",
        "tog-newpageshidepatrolled": "وڵگۀل گه دیار بینۀ ئژ فئرست-رزگ ولگۀل تازۀ بشارا",
        "tog-hidecategorization": "فهرست بالا سی ئی صفحه",
        "tog-extendwatchlist": " کؤل رزگ-فئرست الؤن(آلشت)کریال-تغیرات نیشان دۀ،نۀ هر تنیا دؤمائنۀل",
        "tog-minordefault": "کؤڵ دسکاری بیۀل به عنؤان پئش فرض عڵامت بۀرن",
        "tog-previewontop": "پیش نمایش وهِ رئ جعبۀ نمایش نیشؤن به",
        "tog-previewonfirst": "پێش دئین وە اوەڵێن دەسکاری نیشۆن دە",
-       "tog-enotifwatchlistpages": "ئÛ\80ر Ù\88ÚµÚ¯Û\80 Û\8cا Ù¾Ø±Ø¤Ù\86دئÙ\87 Ø¦Ú\98 Ù\81ئرست-رزگ Ù¾Û\8câ\80\8cÚ¯Û\8cرÛ\8câ\80\8cÛ\80Ù\84Ù\85 Ø¯Ø³Ú©Ø§Ø±Û\8c Ø¨Û\8c Ù\86اÙ\85Ù\87 Ø¦Û\80را Ù\85Ù\87 Ú©Ù\90Ù\84Ù\91 Ú©Û\80",
-       "tog-enotifusertalkpages": "Ù\87Û\80Ù\86ئگÙ\87\88ختئ Ú¯Ù\87 Ø¦Û\80 Ù\88ÚµÚ¯Û\80 Ú¯Ù¾ Ú©Ø§Ø¨Ø±Û\8cÙ\85 ØªØºÛ\8cÛ\8cر Ú©Ø±Û\8cا Ù\86اÙ\85Ù\87 Ø¦Û\80را Ù\85Ù\87 Ú©Ù\90Ù\84 Ú©Û\80",
-       "tog-enotifminoredits": "ئÛ\80ر ØªØºÛ\8cÛ\8cرÛ\80Ù\84-آڵؤÙ\86Û\80Ù\84(Ø¢Ù\84شتÛ\80Ù\84)گؤجÛ\80رÛ\8cجÛ\8c Ø¦Û\80ر Ù\88ÚµÚ¯Û\80Ù\84 Ø¤ Ù¾Ø±Ø¤Ù\86دÛ\80Ù\84Ù\85 Ú©Ø±Û\8cا Ù\86اÙ\85Ù\87 Ø¦Û\80را Ù\85Ù\87 Ú©Ù\90Ù\84 Ú©Û\80",
+       "tog-enotifwatchlistpages": "ئÛ\95Ú¯Û\95ر Ù¾Û\95Ú\95Û\95Û\8e Û\8cا Ú¤Û\95ÚµÚ¯Û\95Û\8e Ø¦Û\95Ú\98 Ù¾Û\95Û\8eÚ¯Û\8cرÛ\8cÛ\95Ù\84Ù\85 Ú¯Ù\88Ù\88Û\95Ú\95Û\8cا(تغÛ\8cرÛ\8cاÙ\81ت)ئÛ\8cÙ\85Û\95Û\8cÙ\84Û\8e Ø¦Û\95Ú\95اÙ\86Ù\85 Ú©Ù\84 Ú©Û\95",
+       "tog-enotifusertalkpages": "Ù\87Û\95Ù\86Û\8e(Ú¤Û\95Ù\82تÛ\8e)Ù¾Û\95Ú\95Û\95Û\8e Ø¦Û\95Ú\98 Ú¤Û\95ÚµÚ¯Û\95 Ú¯Û\95Ù¾(Ù\82سÛ\95)Ú¯Ù\88Ù\88Û\95Ú\95Û\8cا Ø¦Û\8cÙ\85Û\95Ù\84Û\8e Ø¦Û\95Ú\95اÙ\86Ù\85 Ú©Ù\84 Ú©Û\95",
+       "tog-enotifminoredits": "ئÛ\95Ú\95ا Ú¯Ù\88Ù\88Û\95Ú\95اÙ\86Ù\86Û\95Ù\84(تغÛ\8cرات)Ú¯Ù\88Ù\88جÛ\95ر Ø¦Û\95 Ú¤Û\95ÚµÚ¯Û\95Ù\84/Ù¾Û\95Ú\95Û\95Ù\84 Ø¦Û\8cÙ\85Û\95Û\8cÙ\84Û\8e Ø¦Û\95Ú\95اÙ\86Ù\85 Ú©Ù\84 Ú©Û\95",
        "tog-enotifrevealaddr": "نیشانی ایمیل مه ئۀر ایمیل‌ل حاوواڵ رۀسن نیشؤن دۀ",
        "tog-shownumberswatching": "گلۀ شؤماری-شؤمار کاربۀل پی‌گیر نیشان دۀ",
        "tog-oldsig": ":امضاێ موجود ایوه",
        "tog-fancysig": "(امضا چؤی ویکی‌متن بوو(بدون پئؤن خودکار نیائن",
-       "tog-uselivepreview": "استفاده از پیش‌نمایش زنده",
+       "tog-uselivepreview": "پێش سەیرکەر بدون گرەک(نیاز)ڤە بروز رسانی ڤەڵگە",
        "tog-forceeditsummary": "هۀنئ گه-وختئ که خؤلاصۀ دسکاریم نَنیؤیسائۀ خۀؤۀ رم کۀ",
        "tog-watchlisthideown": "دسکاریۀل ووژم ئژ فئرست سئرکردن بشارآ",
        "tog-watchlisthidebots": "دسکاریۀل ربات ئژ فئرست سئرکردن بشآرا",
        "tog-watchlisthideminor": "دسکاریۀل گؤجۀر ئژ فئرست سئرکردن بشارآ",
        "tog-watchlisthideliu": "دەسکاری کاربرەل إنۆم هەتێ سیستم وە لیست پیگیریەل بشارآ",
        "tog-watchlistreloadautomatically": "Reload the watchlist automatically whenever a filter is changed (JavaScript required)",
+       "tog-watchlistunwatchlinks": "افزودن پیوندهای مستقیم خروج از پی‌گیری به فهرست پی‌گیری (جاواسکریپت ممکن است نیاز شود)",
        "tog-watchlisthideanons": "دةسکاری کاربرةل ناشنا ئة لیست نمائش بشارآ",
        "tog-watchlisthidepatrolled": "دسکاریۀل گشت خورده-سئرکریا ئژ فئرست سئرکردن بشآرا",
        "tog-watchlisthidecategorization": "نهفتن رده‌بندی صفحه‌ها",
@@ -60,7 +61,6 @@
        "underline-never": "هؤیچ وخت",
        "underline-default": "پوسته یا مِنِی کەر پیش‌فرض",
        "editfont-style": ":شئؤۀ قلم جعبهٔ دسکاری",
-       "editfont-default": "پیشفرض مِنِی کەر",
        "editfont-monospace": "قلم وە فاصلۀ ثابت",
        "editfont-sansserif": "قلم بئ گوشۀ",
        "editfont-serif": "قلم گوشۀ دار",
        "index-category": "صفحه‌های نمایه‌شده",
        "noindex-category": "صفحه‌های نمایه‌نشده",
        "broken-file-category": "صفحه‌های دارای پیوند خراب به پرونده",
+       "categoryviewer-pagedlinks": "($1) ($2)",
        "about": "دۀربارۀ",
        "article": "وەڵگە نۆم چێنە",
        "newwindow": "(واز کردن ئۀر دۀروۀچۀ جدید)",
        "faq": "پرسش‌های متداول",
        "actions": "کارۀل",
        "namespaces": "فضای نامۀل",
-       "variants": "قصۀ کِرۀل",
+       "variants": "گەپ دێەل(قسەکرەل)",
        "navigation-heading": "منوی ناوبری",
        "errorpagetitle": "خطا",
        "returnto": "بازگشت به $1",
        "redirectedfrom": "(تغییرمسیر إژ $1)",
        "redirectpagesub": "وةڵگة تغییرمسیر",
        "redirectto": ":تغییر مسیر به",
-       "lastmodifiedat": ".اێ وەڵگەآخرین گِل وە $1 سات $2 گؤەڕیائە(تغییریافته)",
+       "lastmodifiedat": "ئێ ڤەڵگەئاخرێن گِل ڤە $1 سات $2 گووەڕیائە(تغییریافته)",
        "viewcount": "إژ ئئ وةڵگة  {{PLURAL:$1|یإ گِل|$1$1چةن گِل}} بازدید بیة.",
        "protectedpage": "وەڵگە پڵۆم بیە",
        "jumpto": ":وازآ کردن/پریدن وۀ",
        "versionrequired": "نسخهٔ $1 از نرم‌افزار مدیاویکی لازم است",
        "versionrequiredtext": "برای دیدن این صفحه به نسخهٔ $1 از نرم‌افزار مدیاویکی نیاز دارید.\nبه [[Special:Version|این صفحه]] مراجعه کنید.",
        "ok": "خوو/ باشد",
+       "pagetitle": "$1 - {{SITENAME}}",
+       "pagetitle-view-mainpage": "{{SITENAME}}",
        "retrievedfrom": "إژ \"$1\" گیریائۀ",
        "youhavenewmessages": "{{PLURAL:$3|درین}}$1$2",
        "youhavenewmessagesfromusers": "{{PLURAL:$4|هؤمة}} $1 د {{PLURAL:$3|کاربةرێ تِر|$3 کاربةر}}دِرین($2).",
        "youhavenewmessagesmulti": ".پیغامةل جدیدی ئة $1 درین",
        "editsection": "دةسکاری",
        "editold": "دةسکاری",
-       "viewsourceold": "سئرکردÙ\86 Ø¨Ù\90Ù\86Ú\86Û\80Ú©/Ù\85Û\80Ù\86بÛ\80ع",
+       "viewsourceold": "بÙ\86Ú\86Û\95Ú©(Ù\85Ù\86بع) Ø¨Û\8aÙ\86(سÛ\95Û\8cرکÛ\95)",
        "editlink": "دەسکاری",
-       "viewsourcelink": "سئرکردÙ\86 Ø¨Ù\90Ù\86Ú\86Û\80Ú©/Ù\85Û\80Ù\86بÛ\80ع",
+       "viewsourcelink": "بÙ\86Ú\86Û\95Ú©(Ù\85Ù\86بع) Ø¨Û\8aÙ\86(سÛ\95Û\8cرکÛ\95)",
        "editsectionhint": "دۀسکاری بۀخش: $1",
        "toc": "محتویات",
        "showtoc": "نیشان دائن",
        "perfcached": "داده‌های زیر از حافظهٔ نهانی فراخوانی شده‌اند و ممکن است کاملاً به‌روز نباشند. حداکثر {{PLURAL:$1|یک نتیجه| $1 نتیجه}} در حافظهٔ نهانی قابل دسترس است.",
        "perfcachedts": "داده‌های زیر از حافظهٔ نهانی فراخوانی شده‌اند و آخرین بار در $1 به‌روزرسانی شدند. حداکثر {{PLURAL:$4|یک نتیجه|$4 نتیجه}} در حافظهٔ نهانی قابل دسترس است.",
        "querypage-no-updates": "امکان به‌روزرسانی این صفحه فعلاً غیرفعال شده‌است.\nاطلاعات این صفحه ممکن است به‌روز نباشد.",
-       "viewsource": "سئرکردÙ\86 Ø¨Ù\90Ù\86Ú\86Û\80Ú©/Ù\85Û\80Ù\86بÛ\80ع",
+       "viewsource": "بÙ\86Ú\86Û\95Ú©(Ù\85Ù\86بع) Ø¨Û\8aÙ\86(سÛ\95Û\8cرکÛ\95)",
        "viewsource-title": "نمایش بِنچةک ئةرا $1",
        "actionthrottled": "جلوی عمل شما گرفته شد",
        "actionthrottledtext": "به منظور جلوگیری از انتشار خرابکاری، اجازه ندارید که چنین عملی را بیش از چند بار در یک مدت زمان کوتاه انجام بدهید.\nلطفاً پس از چند دقیقه دوباره تلاش کنید.",
        "yourdomainname": ":دامنهٔ شما",
        "password-change-forbidden": ".شما نمی‌توانید گذرواژه‌ها را در این ویکی تغییر دهید",
        "externaldberror": "خطایی در ارتباط با پایگاه داده رخ داده است یا اینکه شما اجازهٔ به‌روزرسانی حساب خارجی خود را ندارید.",
-       "login": "إ نۆم هەتن سیستم",
+       "login": "ڤە نۆم هەتن",
        "login-security": "وژت معرفی‌که",
        "nav-login-createaccount": " إ نؤم هةتن سیستم/ حساوو کاربةری سازین",
        "logout": "دەرچێن|خروج",
        "badretype": "گذرواژةلێ گإ نۆیساتة چؤِی یةک نیِن",
        "usernameinprogress": ". دِرێ حساوو دؤرسة مةکإ . خواهشا صبر کةن",
        "userexists": ".نام کاربةری‌ گإ واردت کردئة قبلاً استفاده بیة\n.خواهشا نامێ تر استفادة کةن",
-       "loginerror": "خطای إ نام هةتن سیستم",
+       "loginerror": "نادوەرستی ڤە نۆم هەتن",
        "createacct-error": "خطای  حساوو کاربةری سازین",
        "createaccounterror": "نمآوو ئئ حساووة بِسازین: $1",
        "nocookiesnew": "حساوو کاربةری سازیا، اما هؤمة أ سیستم نهةتینة/نهاتینة.\n{{SITENAME}} برای ورود کاربران به سامانه از کوکی استفاده می‌کند.\nشما کوکی‌ها را از کار انداخته‌اید.\nلطفاً کوکی‌ها را به کار بیندازید، و سپس با نام کاربری و گذرواژهٔ جدیدتان به سامانه وارد شوید.",
        "suspicious-userlogout": "درخواست هؤمة ئةرا  دةرچئن إژ سیستم  رد بیة زیرا به نظر می‌رسد که این  .درخواست توسط یک مرورگر معیوب یا پروکسی میانگیر کل/ارسال بیة",
        "createacct-another-realname-tip": "نام راسکانی/واقعی دڵ بخواهیة.\nاگر آن را وارد کنید هنگام ارجاع به آثارتان و انتساب آن‌ها به شما از نام واقعی‌تان استفاده خواهد شد.",
        "pt-login": "إنۆم هەتِن.",
-       "pt-login-button": "إ نۆم هەتن سیستم",
+       "pt-login-button": "ڤە نۆم هەتن",
        "pt-login-continue-button": "ادامه سی ورود سیستم",
        "pt-createaccount": "حساووئ أرا ووژتان بِسازِن",
        "pt-userlogout": "دەرچێن|خروج",
        "resetpass-no-info": "برای دسترسی مستقیم به این صفحه شما باید به سامانه وارد شده باشید.",
        "resetpass-submit-loggedin": "تغییردائن رمز",
        "resetpass-submit-cancel": "ئآهووسانن/لغو",
-       "resetpass-wrong-oldpass": "گذرÙ\88اÚ\98Ù\87Ù\94 Ù\85Ù\88Ù\82ت Û\8cا Ø§Ø®Û\8cر Ù\86اÙ\85عتبر.\nÙ\85Ù\85Ú©Ù\86 Ø§Ø³Øª Ú©Ù\87 Ø´Ù\85ا Ù\87Ù\85Û\8cÙ\86Ú© Ú¯Ø°Ø±Ù\88اÚ\98Ù\87â\80\8cتاÙ\86 Ø±Ø§ Ø¨Ø§ Ù\85Ù\88Ù\81Ù\82Û\8cت ØªØºÛ\8cÛ\8cر Ø¯Ø§Ø¯Ù\87 Ø¨Ø§Ø´Û\8cد Û\8cا Ø¯Ø±Ø®Ù\88است Û\8cÚ© Ú¯Ø°Ø±Ù\88اÚ\98Ù\87Ù\94 Ù\85Ù\88Ù\82ت ØªØ§Ø²Ù\87 Ú©Ø±Ø¯Ù\87 Ø¨Ø§Ø´Û\8cد.",
+       "resetpass-wrong-oldpass": "گذرواژهٔ موقت یا اخیر نامعتبر.\nممکن است که شما همینک گذرواژه‌تان را تغییر داده باشید یا درخواست یک گذرواژهٔ موقت تازه کرده باشید.",
        "resetpass-recycled": "لطفاً رمز عبور خود را به چیز دیگری غیر از رمز عبور فعلی تنظیم کنید.",
        "resetpass-temp-emailed": "شما با یک کد ایمیل شدهٔ موقت وارد شده‌اید.\nبرای پایان ورود، شما باید رمز عبور جدیدی اینجا وارد کنید:",
        "resetpass-temp-password": ":رمز عبور موقت",
        "passwordreset-emailsentusername": "اگر نشانی پست الکترونیکی مرتبطی موجود باشد، یک نامه برای بازنشانی گذرواژه به آن ارسال خواهد شد.",
        "passwordreset-nocaller": "زنگ مجبور نییه به تأمین کردن",
        "passwordreset-nosuchcaller": "زنگ موجود نییه: $1",
+       "passwordreset-ignored": "به بازنشانی گذرواژه پرداخته نشد. آیا ممکن است که هيچ مهياکننده‌ای برای این کار تنظيم نشده باشد؟",
        "passwordreset-invalidemail": "آدرس ایمیل نامعتبره",
+       "passwordreset-nodata": "یک نام کاربری و یا یک آدرس ايميل، هيچکدام ارائه نشده",
        "changeemail": "تغییر یا حذف نشانی ایمیل",
        "changeemail-header": "برای تغییر ایمیلتان این فرم را کامل کنید. برای حذف ایملیتان کافی است بخش ایمیل را خالی رها کنید و فرم را ارسال کنید.",
        "changeemail-no-info": ".برای دسترسی مستقیم به این صفحه شما باید به سیستم وارد شده باشید",
        "headline_tip": "عنوان سطح ۲",
        "nowiki_sample": "متن قالب‌بندی‌نشده اینجا وارد شود",
        "nowiki_tip": "نادیده‌گرفتن قالب‌بندی ویکی",
+       "image_sample": "نموونە.jpg",
        "image_tip": "تصویر داخل متن",
+       "media_sample": "نموونە.ogg",
        "media_tip": "پیوند پرونده",
        "sig_tip": "امضای هومۀ و برچسب زۀمان",
        "hr_tip": " )خط افقی(از آن کم استفاده کنید",
        "preview": "پیش‌نمایش",
        "showpreview": "پیش‌نمایش",
        "showdiff": "گؤەڕیال(تغییرات) بۆین",
-       "blankarticle": "<strong>هوشدار:</strong> هۆمە وەڵگەتۆن سازیە پەتیە(حالیە).\nأڕ «$1» دۆِ گِل کلیک کِین ، وەڵگە بێ  نۆم جِک(محتوا) مەسازێ.",
+       "blankarticle": "<strong>ئاگاتۆ داشتوو:</strong> هۆمە ڤەڵگەتۆن سازیە پەتیە(خالیە).\nئەڕ «$1» دۆِ گِل کلیک کِین ، ڤەڵگە بێ  نۆمجِک(محتوا) مەسازێ.",
        "anoneditwarning": "<strong>هشدار:</strong> شما وارد نشده‌اید. نشانی آی‌پی شما برای عموم قابل مشاهده خواهد بود اگر هر تغییری ایجاد کنید. اگر <strong>[$1 وارد شوید]</strong> یا <strong>[$2 یک حساب کاربری بسازید]</strong>، ویرایش‌هایتان به نام کاربری‌تان نسبت داده خواهد شد، همراه با مزایای دیگر.",
        "anonpreviewwarning": "''شما به سامانه وارد نشده‌اید. ذخیره کردن باعث می‌شود که نشانی آی‌پی شما در تاریخچهٔ این صفحه ثبت گردد.''",
        "missingsummary": "'''یادآوری:''' شما خلاصهٔ ویرایش ننوشته‌اید.\nاگر دوباره دکمهٔ «$1» را فشار دهید ویرایش شما بدون آن ذخیره خواهد شد.",
        "updated": "(تازة سازی بیة)",
        "note": "'''نکته:'''",
        "previewnote": "'''به یاد داشته باشید که این فقط پیش‌نمایش است.'''\nتغییرات شما هنوز ذخیره نشده‌است!",
-       "continue-editing": "بچۆإ بةخش دةکاری",
+       "continue-editing": "بچۆ ئەڕا بەش دەسکاریکردن",
        "previewconflict": "این پیش‌نمایش منعکس‌کنندهٔ متن ناحیهٔ ویرایش متن بالایی است، به شکلی که اگر متن را ذخیره کنید نمایش خواهد یافت.",
        "session_fail_preview": "'''شرمنده! به علت از دست رفتن اطلاعات نشست کاربری نمی‌توانیم ویرایش شما را پردازش کنیم.'''\nلطفاً دوباره سعی کنید.\nاگر دوباره به همین پیام برخوردید از سامانه [[Special:UserLogout|خارج شوید]] و دوباره وارد شوید.",
        "session_fail_preview_html": "'''متأسفانه امکان ثبت ویرایش شما به خاطر از دست رفتن اطلاعات نشست کاربری وجود ندارد.'''\n\n''با توجه به این که در {{SITENAME}} امکان درج اچ‌تی‌ام‌ال خام فعال است، پیش‌نمایش صفحه پنهان شده تا امکان حملات مبتنی بر جاوااسکریپت وجود نداشته باشد.''\n\n'''اگر مطمئن هستید که این پیش‌نمایش یک ویرایش مجاز است، آن را تکرار کنید.'''\nاگر تکرار پیش‌نمایش نتیجه نداد، از سامانه [[Special:UserLogout|خارج شوید]] و دوباره وارد شوید.",
        "explainconflict": "از وقتی ویرایش این صفحه را آغاز کرده‌اید شخص دیگری آن را تغییر داده است.\nناحیهٔ متنی بالایی شامل متن صفحه به شکل کنونی آن است.\nتغییرات شما در ناحیهٔ متنی پایینی نشان داده شده‌است.\nشما باید تغییراتتان را با متن کنونی ترکیب کنید.\nبا فشردن دکمهٔ «$1» <strong>فقط</strong> متن ناحیهٔ متنی بالایی ذخیره خواهد شد.",
        "yourtext": "متن شما",
        "storedversion": "نسخهٔ ذخیره شده",
-       "nonunicodebrowser": "'''هشدار: مرورگر شما با استانداردهای یونیکد سازگار نیست.'''\nراه حلی به کار گرفته شده تا شما بتوانید صفحات را با امنیت ویرایش کنید: کاراکترهای غیر ASCII به صورت کدهایی در مبنای شانزده به شما نشان داده می‌شوند.",
        "editingold": "'''هشدار: شما در حال ویرایش نسخه‌ای قدیمی از این صفحه هستید.'''\nاگر ذخیره‌اش کنید، هر تغییری که پس از این نسخه انجام شده‌است از بین خواهد رفت.",
        "yourdiff": "تفاوت‌ها",
        "copyrightwarning": "لطفاً توجه داشته‌باشید که همهٔ مشارکت‌ها در {{SITENAME}} منتشرشده تحت $2 در نظر گرفته‌می‌شوند (برای جزئیات بیش‌تر $1 را ببینید).\nاگر نمی‌خواهید نوشته‌هایتان بی‌رحمانه ویرایش و توزیع شوند؛ بنابراین، آنها را اینجا ارائه نکنید.<br />\nشما همچنین به ما تعهد می‌کنید که خودتان این را نوشته‌اید یا آن را از یک منبع با مالکیت عمومی یا مشابه آزاد آن برداشته‌اید (برای جزئیات بیش‌تر $1 را ببینید).\n<strong>کارهای دارای حق تکثیر را بدون اجازه ارائه نکنید!</strong>",
        "yourgender": "ترجیح می‌دهید چگونه توصیف شوید؟",
        "gender-unknown": "هنگام ذکر شما، نرم‌افزار تا جای ممکن از کلمات خنثی از نظر جنسیت استفاده خواهد",
        "gender-male": "پیا",
-       "gender-female": "ژن",
+       "gender-female": "ئافرەت(ژەن)",
        "prefs-help-gender": "انجام این تنظیم اختیاری است.\nنرم‌افزار از این مقدار برای اشارهٔ صحیح به جنسیت و ذکر شما برای دیگران با استفاده از دستور زبان درست استفاده می‌کند.\nاین اطلاعات عمومی خواهند بود.",
        "email": "ایمیل",
        "prefs-help-realname": "نام واقعی اختیاری است.\nاگر وارد شده است هنگام ارجاع به آثارتان و انتساب آن‌ها به شما ممکن است از نام واقعی‌تان استفاده شود.",
        "userrights-changeable-col": "گروه‌هایی که می‌توانید تغییر دهید",
        "userrights-unchangeable-col": "گروه‌هایی که نمی‌توانید تغییر دهید",
        "userrights-conflict": "تعارض دسترسی‌های کاربری! لطفاً بررسی کنید و تغییرات را تأیید کنید.",
-       "group": "گروه:",
+       "group": "داکووکە(گروو):",
        "group-user": "کاربۀر",
        "group-autoconfirmed": "کاربران تأییدشدهٔ خودکار",
        "group-bot": "ربات‌ها",
        "rc_categories": "محدود به این رده‌ها (رده‌ها را با «|» جدا کنید):",
        "rc_categories_any": "هر کدام از منتخب‌ها",
        "rc-change-size-new": " $1دؤما تۀقیر دائن{{PLURAL:$1|بایت|بایتل}}",
-       "newsectionsummary": "/* $1 */ بةخش جدید",
+       "newsectionsummary": "/* $1 */ بەخش نوو",
        "rc-enhanced-expand": "نمایش جزئیات",
        "rc-enhanced-hide": "نهفتن جزئیات",
        "rc-old-title": "ایجادشده با عنوان اصلی «$1»",
        "recentchangeslinked-toolbox": "تغییرۀ مرتبط",
        "recentchangeslinked-title": "تغییرات مرتبط با $1",
        "recentchangeslinked-summary": "در زیر فهرستی از تغییرات اخیر صفحه‌های پیوند داده شده از این صفحه (یا اعضای رده مورد نظر) را می‌بینید.\nصفحه‌هایی که در [[Special:Watchlist|فهرست پی‌گیری‌هایتان]] باشند به صورت '''پررنگ''' نشان داده می‌شوند.",
-       "recentchangeslinked-page": ":نام وةڵگة",
+       "recentchangeslinked-page": "نۆم ڤەڵگە:",
        "recentchangeslinked-to": "نمایش تغییرات صفحه‌هایی که به صفحهٔ داده‌شده پیوند دارند",
        "recentchanges-page-added-to-category": "[[:$1]] اضاف بیە ڕِزگ",
        "recentchanges-page-added-to-category-bundled": "[[:$1]] و {{PLURAL:$2|یک صفحه|$2 صفحه}}ٔ دیگر به رده اضافه شدند",
        "fileuploadsummary": "خلاصه:",
        "filereuploadsummary": "تغییرات پرونده:",
        "filestatus": "وضعیت حق تکثیر:",
-       "filesource": ":بِنچۀک/مۀنبۀع",
+       "filesource": "بنچەک(منبع)",
        "ignorewarning": "چشم‌پوشی از هشدار و ذخیرهٔ پرونده.",
        "ignorewarnings": "چشم‌پوشی از همهٔ هشدارها",
        "minlength1": "نام پرونده دست کم باید یک حرف باشد.",
        "listgrouprights": "اختیارات گروه‌های کاربری",
        "listgrouprights-summary": "فهرست زیر شامل گروه‌های کاربری تعریف شده در این ویکی و اختیارات داده شده به آن‌ها است.\nاطلاعات بیشتر در مورد هر یک از اختیارات را در [[{{MediaWiki:Listgrouprights-helppage}}]] بیابید.",
        "listgrouprights-key": "* <span class=\"listgrouprights-granted\">اختیارات داده‌شده</span>\n* <span class=\"listgrouprights-revoked\">اختیارات گرفته‌شده</span>",
-       "listgrouprights-group": "گروه",
+       "listgrouprights-group": "داکووکە(گروو)",
        "listgrouprights-rights": "دسترسی‌ها",
        "listgrouprights-helppage": "Help:دسترسی‌های گروهی",
        "listgrouprights-members": "(فهرست اعضا)",
        "blanknamespace": "(سەر/اصلی)",
        "contributions": "هؤمکاریۀل{{GENDER:$1|کاربۀر}}",
        "contributions-title": "مشارکت‌های کاربری $1",
-       "mycontris": "هؤمکاری کِرۀل",
-       "anoncontribs": "هؤمکاری کِرۀل",
+       "mycontris": "بەشاکرەل(هام بێرەل)",
+       "anoncontribs": "بەشاکرەل(هام بێرەل)",
        "contribsub2": "برای {{GENDER:$3|$1}} ($2)",
        "contributions-userdoesnotexist": "حساب کاربری «$1» ثبت نشده‌است.",
        "nocontribs": "هیچ تغییری با این مشخصات یافت نشد.",
        "block": "بستن کاربر.",
        "unblock": "بازکردن کاربر",
        "blockip": "بستن {{GENDER:$1|کاربر}}",
-       "blockip-legend": "بستن کاربر",
        "blockiptext": "از فرم زیر برای بستن دسترسی ویرایش یک نشانی آی‌پی یا نام کاربری مشخص استفاده کنید.\nاین کار فقط فقط باید برای جلوگیری از خرابکاری و بر اساس [[{{MediaWiki:Policy-url}}|سیاست قطع دسترسی]] انجام شود.\nدلیل مشخص این کار را در زیر ذکر کنید (مثلاً با ذکر صفحه‌های به‌خصوصی که مورد خرابکاری واقع شده‌اند).",
        "ipaddressorusername": "نشانی آی‌پی یا نام کاربری:",
        "ipbexpiry": "زمان سرآمدن:",
        "exif-sublocationdest": "بخش شهر نمایش داده شده",
        "exif-objectname": "عنوان کوتاه",
        "exif-specialinstructions": "دستورالعمل‌های ویژه",
-       "exif-headline": "سةر Ù\88ةڵگة",
+       "exif-headline": "عÙ\86Ù\88اÙ\86",
        "exif-credit": "صاحب امتیاز/ارائه کننده",
-       "exif-source": "بÙ\90Ù\86Ú\86Û\80Ú©/Ù\85Û\80Ù\86بÛ\80ع",
+       "exif-source": "بÙ\86Ú\86Û\95Ú©(Ù\85Ù\86بع)",
        "exif-editstatus": "وضعیت تحریریه تصویر",
        "exif-urgency": "فوریت/هڵةپڵة",
        "exif-fixtureidentifier": "نام ستون نشریه",
        "exif-gpsdirection-m": "جهت مغناطیسی",
        "exif-ycbcrpositioning-1": "وسط‌چین‌شده",
        "exif-ycbcrpositioning-2": "اشتراکی/هام بةشی",
-       "exif-dc-contributor": "هؤمکاری کِرۀل",
+       "exif-dc-contributor": "بەشاکرەل(هام بێرەل)",
        "exif-dc-coverage": "محدوده مکانی و یا زمانی رسانه",
        "exif-dc-date": "تاریخ(ها)",
        "exif-dc-publisher": "بۀشا کۀر-ناشر",
        "tags-tag": "نام برچسب",
        "tags-display-header": "نمایش در فهرست‌های تغییرات",
        "tags-description-header": "توضیح کامل معنی",
-       "tags-source-header": "بÙ\90Ù\86Ú\86Û\80Ú©/Ù\85Û\80Ù\86بÛ\80ع",
+       "tags-source-header": "بÙ\86Ú\86Û\95Ú©(Ù\85Ù\86بع)",
        "tags-active-header": "فعال(کارکةر)؟",
        "tags-hitcount-header": "تغییرهای برچسب‌دار",
        "tags-actions-header": "کارۀل",
index 48cf1d5..a3de91f 100644 (file)
        "accmailtext": "Nejauši ģenerēta parole lietotājam [[User talk:$1|$1]] tika nosūtīta uz $2.\n\nŠī konta paroli pēc ielogošanās varēs nomainīt ''[[Special:ChangePassword|šeit]]''.",
        "newarticle": "(Jauns raksts)",
        "newarticletext": "Šajā projektā vēl nav lapas ar šādu nosaukumu.\nLai izveidotu lapu, sāc rakstīt teksta logā apakšā (par teksta formatēšanu un sīkākai informācija skatīt [$1 palīdzības lapu]).\nJa tu šeit nonāci kļūdas pēc, vienkārši uzspied <strong>back</strong> pogu pārlūkprogrammā.",
-       "anontalkpagetext": "----''Šī ir diskusiju lapa anonīmam dalībniekam, kurš vēl nav kļuvis par reģistrētu dalībnieku vai arī neizmanto savu dalībnieka vārdu. Tādēļ mums ir jāizmanto skaitliskā IP adrese, lai viņu identificētu.\nŠāda IP adrese var būt vairākiem dalībniekiem.\nJa tu esi anonīms dalībnieks un uzskati, ka tev ir adresēti neatbilstoši komentāri, lūdzu, [[Special:CreateAccount|kļūsti par dalībnieku]] vai arī [[Special:UserLogin|izmanto jau izveidotu dalībnieka vārdu]], lai izvairītos no turpmākām neskaidrībām un tu netiktu sajaukts ar citiem anonīmiem dalībniekiem.''",
+       "anontalkpagetext": "----\n<em>Šī ir anonīma dalībnieka, kurš vēl nav izveidojis lietotāja kontu vai to nelieto, diskusiju lapa.</em>\nTādēļ mums ir jāizmanto IP adrese, lai viņu identificētu.\nŠāda IP adrese var būt vairākiem dalībniekiem.\nJa tu esi anonīms dalībnieks un uzskati, ka tev ir adresēti neatbilstoši komentāri, lūdzu, [[Special:CreateAccount|izveido kontu]] vai [[Special:UserLogin|pieslēdzies]], lai izvairītos no turpmākām neskaidrībām un tu netiktu sajaukts ar citiem anonīmiem dalībniekiem.",
        "noarticletext": "Šajā lapā šobrīd nav nekāda teksta, tu vari [[Special:Search/{{PAGENAME}}|meklēt citās lapās pēc šīs lapas nosaukuma]], <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} meklēt saistītos reģistru ierakstos] vai arī [{{fullurl:{{FULLPAGENAME}}|action=edit}} sākt rediģēt šo lapu]</span>.",
        "noarticletext-nopermission": "Šajā lapā pašlaik nav nekāda teksta.\nTu vari [[Special:Search/{{PAGENAME}}|meklēt šīs lapas nosaukumu]] citās lapās,\nvai <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} meklēt saistītus reģistru ierakstus]</span>, bet jums nav atļauja izveidot šo lapu.",
        "userpage-userdoesnotexist": "Lietotājs \"<nowiki>$1</nowiki>\" nav reģistrēts.\nLūdzu, pārliecinies vai vēlies izveidot/izmainīt šo lapu.",
        "prefs-editor": "Redaktors",
        "prefs-preview": "Priekšskatījums",
        "prefs-advancedrc": "Papildu iespējas",
+       "prefs-opt-out": "Atteikties no uzlabojumiem",
        "prefs-advancedrendering": "Papildu iespējas",
        "prefs-advancedsearchoptions": "Papildu iespējas",
        "prefs-advancedwatchlist": "Papildu iespējas",
        "action-userrights-interwiki": "mainīt dalībnieku tiesības citās Vikipēdijās",
        "action-siteadmin": "bloķēt vai atbloķēt datubāzi",
        "action-sendemail": "sūtīt e-pastus",
+       "action-editmyoptions": "labot savas izvēles",
        "action-deletechangetags": "dzēst iezīmes no datubāzes",
        "nchanges": "$1 {{PLURAL:$1|izmaiņas|izmaiņa|izmaiņas}}",
        "enhancedrc-since-last-visit": "$1 {{PLURAL:$1|kopš pēdējā apmeklējuma}}",
        "listfiles-delete": "dzēst",
        "listfiles-summary": "Šajā īpašajā lapā ir redzami visi augšupielādētie faili.",
        "listfiles_search_for": "Meklēt failu pēc vārda:",
+       "listfiles-userdoesnotexist": "Dalībnieks \"$1\" nav reģistrēts.",
        "imgfile": "fails",
        "listfiles": "Attēlu uzskaitījums",
        "listfiles_thumb": "Sīktēls",
        "apisandbox-dynamic-parameters-add-placeholder": "Parametra nosaukums",
        "apisandbox-deprecated-parameters": "Novecojuši parametri",
        "apisandbox-results": "Rezultāti",
+       "apisandbox-sending-request": "Sūta API pieprasījumu...",
+       "apisandbox-loading-results": "Saņem API rezultātus...",
+       "apisandbox-request-selectformat-label": "Rādīt pieprasījuma datus kā:",
        "apisandbox-request-format-url-label": "URL vaicājuma teksts",
        "apisandbox-request-url-label": "Pieprasījuma URL:",
        "apisandbox-request-json-label": "Pieprasījuma JSON:",
        "protectexpiry": "Beidzas:",
        "protect_expiry_invalid": "Beigu termiņš ir nederīgs.",
        "protect_expiry_old": "Beigu termiņs ir pagātnē.",
+       "protect-unchain-permissions": "Pieslēgt papildu aizsargāšanas iespējas",
        "protect-text": "Šeit var apskatīt un izmainīt lapas <strong>$1</strong> aizsardzības līmeni.",
        "protect-locked-access": "Jūsu kontam nav atļaujas mainīt lapas aizsardzības pakāpi.\nPašreizējie lapas '''$1''' iestatījumi ir:",
        "protect-cascadeon": "Šī lapa pašlaik ir aizsargāta, jo tā ir iekļauta {{PLURAL:$1|šajās lapās|šajā lapā|šajās lapās}} (mainot šīs lapas aizsardzības līmeni aizsardzība netiks noņemta):",
        "protect-default": "Atļaut visiem lietotājiem",
        "protect-fallback": "Atļaut tikai lietotājiem ar \"$1\" atļauju",
-       "protect-level-autoconfirmed": "Atļaut tikai autoapstiprinātiem lietotājiem",
+       "protect-level-autoconfirmed": "Atļaut tikai pašpārbaudītajiem",
        "protect-level-sysop": "Atļaut tikai administratoriem",
        "protect-summary-cascade": "kaskāde",
        "protect-expiring": "līdz $1 (UTC)",
        "protect-expiring-local": "beidzas $1",
        "protect-expiry-indefinite": "bezgalīgs",
-       "protect-cascade": "Aizsargāt šajā lapā iekļautās lapas (veidnes) ''(cascading protection)''",
+       "protect-cascade": "Aizsargāt šajā lapā iekļautās lapas un veidnes (kaskādes aizsardzība)",
        "protect-cantedit": "Tu nevari izmainīt šīs lapas aizsardzības līmeņus, tāpēc, ka tur nevari izmainīt šo lapu.",
        "protect-othertime": "Cits laiks:",
        "protect-othertime-op": "cits laiks",
        "pageinfo-article-id": "Lapas ID",
        "pageinfo-language": "Lappuses satura valoda",
        "pageinfo-content-model": "Lapas satura modelis",
+       "pageinfo-content-model-change": "mainīt",
        "pageinfo-robot-policy": "Indeksācija ar robotiem",
        "pageinfo-robot-index": "Atļauta",
        "pageinfo-robot-noindex": "Aizliegta",
        "pageinfo-watchers": "Lapas uzraudzītāju skaits",
+       "pageinfo-visiting-watchers": "Lapas uzraudzītāju skaits, kuri apskatījuši pēdējos labojumus",
        "pageinfo-few-watchers": "Mazāk kā $1 {{PLURAL:$1|uzraudzītāju|uzraudzītājs|uzraudzītāju}}",
        "pageinfo-redirects-name": "Pāradresāciju skaits uz šo lapu",
        "pageinfo-subpages-name": "Šīs lapas apakšlapas",
        "pageinfo-edits": "Kopējais izmaiņu skaits",
        "pageinfo-authors": "Kopējais atsevišķu autoru skaits",
        "pageinfo-recent-edits": "Izmaiņu skaits (pēdējās $1)",
+       "pageinfo-recent-authors": "Neseno lapas labotāju skaits",
        "pageinfo-magic-words": "{{PLURAL:$1|Maģiskie vārdi|Maģiskais vārds|Maģiskie vārdi}} ($1)",
        "pageinfo-hidden-categories": "{{PLURAL:$1|Slēptas kategorijas|Slēpta kategorija|Slēptas kategorijas}} ($1)",
        "pageinfo-templates": "{{PLURAL:$1|Iekļautās veidnes|Iekļautā veidne|Iekļautās veidnes}} ($1)",
        "exif-disclaimer": "Atruna",
        "exif-contentwarning": "Brīdinājums par saturu",
        "exif-giffilecomment": "GIF faila komentārs",
+       "exif-subjectnewscode": "Temata kods",
+       "exif-scenecode": "IPTC ainas kods",
        "exif-event": "Attēlotais notikums",
        "exif-organisationinimage": "Attēlotā organizācija",
        "exif-personinimage": "Attēlotā persona",
        "tag-filter": "[[Special:Tags|Iezīmju]] filtrs:",
        "tag-filter-submit": "Filtrs",
        "tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1|Iezīmes|Iezīme|Iezīmes}}]]: $2)",
+       "tag-mw-contentmodelchange": "satura modeļa izmaiņa",
        "tags-title": "Iezīmes",
        "tags-intro": "Šajā lapā uzskaitītas iezīmes, ar kurām programmatūra var atzīmēt labojumus, un to nozīme.",
        "tags-tag": "Iezīmes nosaukums",
        "compare-invalid-title": "Norādītais nosaukums nav derīgs.",
        "compare-title-not-exists": "Norādītais nosaukums neeksistē.",
        "compare-revision-not-exists": "Norādītā versija neeksistē.",
+       "diff-form": "Atšķirības",
        "dberr-problems": "Atvainojiet!\nŠai vietnei ir radušās tehniskas problēmas.",
        "dberr-again": "Uzgaidiet dažas minūtes un pārlādējiet šo lapu.",
        "dberr-info": "(Nevar piekļūt datubāzei: $1)",
index 257ad66..bb0bed3 100644 (file)
        "showdiff": "बदल दाखवा",
        "blankarticle": "<strong>ईशारा:</strong>आपण तयार करीत असलेले पान कोरे आहे.जर आपण पुन्हा \"$1\" टिचकले तर,कोणताही आशय/मजकूर नसलेले पान तयार होईल.",
        "anoneditwarning": "<strong>इशारा:</strong> तुम्ही विकिपीडियाचे सदस्य म्हणून सनोंद-प्रवेश (लॉग-इन) केलेले नाही.आपण काही संपादन केले तर, तुमचा अंकपत्ता (आयपी) सार्वजनिक रित्या दृष्य होईल. जर आपण <strong>[$1 सनोंद प्रवेश केला]</strong> किंवा <strong>[$2 खाते उघडले]</strong>,तर आपण केलेली संपादने ही आपल्या नांवाशी संलग्न होतील, त्याशिवाय याचे इतरही फायदे आहेत.",
-       "anonpreviewwarning": "\"'''सावधान:''' à¤¤à¥\81मà¥\8dहà¥\80 à¤µà¤¿à¤\95िपà¥\80डियाà¤\9aà¥\87 à¤¸à¤¦à¤¸à¥\8dय à¤®à¥\8dहणà¥\82न à¤¸à¤¨à¥\8bà¤\82द-पà¥\8dरवà¥\87श (लà¥\89à¤\97-à¤\87न) à¤\95à¥\87लà¥\87ला à¤¨à¤¾à¤¹à¥\80. à¤¯à¤¾ à¤ªà¤¾à¤¨à¤¾à¤\9aà¥\8dया à¤¸à¤\82पादन à¤\87तिहासात à¤¤à¥\81मà¤\9aा à¤\85à¤\82à¤\95पतà¥\8dता (à¤\86य.पà¥\80. à¥²ड्रेस) नोंदला जाईल.\"",
+       "anonpreviewwarning": "\"'''सावधान:''' à¤¤à¥\81मà¥\8dहà¥\80 à¤µà¤¿à¤\95िपà¥\80डियाà¤\9aà¥\87 à¤¸à¤¦à¤¸à¥\8dय à¤®à¥\8dहणà¥\82न à¤¸à¤¨à¥\8bà¤\82द-पà¥\8dरवà¥\87श (लà¥\89à¤\97-à¤\87न) à¤\95à¥\87लà¥\87ला à¤¨à¤¾à¤¹à¥\80. à¤¯à¤¾ à¤ªà¤¾à¤¨à¤¾à¤\9aà¥\8dया à¤¸à¤\82पादन à¤\87तिहासात à¤¤à¥\81मà¤\9aा à¤\85à¤\82à¤\95पतà¥\8dता (à¤\86य.पà¥\80. à¤\85à¥\85ड्रेस) नोंदला जाईल.\"",
        "missingsummary": "'''आठवण:''' आपण संपादन सारांश पुरवलेला नाही.आपण 'जतन करा' वर पुन्हा टिचकी मारली तर, ते त्याशिवायच जतन होईल.",
        "selfredirect": "<strong>ईशारा:</strong>आपण या पानास, त्याच पानावर पुनर्निर्देशित करीता आहात.\nआपण पुनर्निर्देशनासाठी चूकिचे लक्ष्य नमूद केले आहे किंवा आपण चूकिच्या पानाचे संपादन करीत आहात.\nजर आपण पुन्हा \"$1\" टिचकले तर, कसेहीकरुन ते पुनर्निर्देशन तयार होईल.",
        "missingcommenttext": "कृपया खाली प्रतिक्रिया भरा.",
        "action-rollback": "या आधीच्या सदस्याने नुकतेच संपादन केलेले एखादे विशिष्ट पानाचे बदल लवकर पूर्वस्थितीत न्या",
        "action-import": "दुसऱ्या विकीवरुन पाने आयात करा",
        "action-importupload": "अपभारीत संचिकेतून पाने आयात करा",
-       "action-patrol": "à¤\87तराà¤\82à¤\9aà¥\80 संपादनांवर 'पहारा दिला' म्हणून खूण करा",
+       "action-patrol": "à¤\87तराà¤\82à¤\9aà¥\8dया संपादनांवर 'पहारा दिला' म्हणून खूण करा",
        "action-autopatrol": "आपल्या संपादनांवर पहारा दिल्याची खूण करा",
        "action-unwatchedpages": "पहारा न दिलेल्या पानांची यादी पहा",
        "action-mergehistory": "पानाचा इतिहास विलीन करा",
        "timezone-local": "स्थानिक",
        "duplicate-defaultsort": "'''ताकिद:''' डिफॉल्ट सॉर्ट की \"$2\" ओवर्राइड्स अर्लीयर डिफॉल्ट सॉर्ट की \"$1\".",
        "version": "आवृत्ती",
-       "version-extensions": "सà¥\8dथापित à¤µà¤¿à¤¸à¥\8dतार",
+       "version-extensions": "यà¥\87थà¥\87 à¤¸à¥\8dथापलà¥\87लà¥\80 à¤µà¤¿à¤¸à¥\8dतारà¤\95à¥\87",
        "version-skins": "इंस्टॉल केल्या गेलेल्या त्वचा",
        "version-specialpages": "विशेष पाने",
        "version-parserhooks": "पृथकक अंकुश",
index 1d155bc..d711feb 100644 (file)
        "cannotloginnow-title": "Niet mogelijk om aan te melden",
        "cannotloginnow-text": "Aanmelden is niet mogelijk bij het gebruik van $1.",
        "cannotcreateaccount-title": "Kan geen accounts aanmaken",
-       "cannotcreateaccount-text": "Direct aanmaken van een gebruiker is niet ingeschakeld op deze wiki.",
+       "cannotcreateaccount-text": "Direct aanmaken van een account is niet ingeschakeld op deze wiki.",
        "yourdomainname": "Uw domein:",
        "password-change-forbidden": "U kunt uw wachtwoord niet wijzigen in deze wiki.",
-       "externaldberror": "Er is een fout opgetreden bij het aanmelden bij de database of u hebt geen toestemming uw externe gebruiker bij te werken.",
+       "externaldberror": "Er is een fout opgetreden bij het aanmelden bij de database of u hebt geen toestemming om uw externe account bij te werken.",
        "login": "Aanmelden",
        "login-security": "Uw identiteit controleren",
        "nav-login-createaccount": "Aanmelden / registreren",
        "userlogin-helplink2": "Hulp bij aanmelden",
        "userlogin-loggedin": "U bent al aangemeld als {{GENDER:$1|$1}}.\nGebruik het onderstaande formulier om aan te melden als een andere gebruiker.",
        "userlogin-reauth": "U moet opnieuw inloggen om te bevestigen dat u {{GENDER:$1|$1}} bent.",
-       "userlogin-createanother": "Een andere account registreren",
+       "userlogin-createanother": "Een ander account aanmaken",
        "createacct-emailrequired": "E-mailadres",
        "createacct-emailoptional": "E-mailadres (optioneel)",
        "createacct-email-ph": "Geef uw e-mailadres op",
        "createacct-another-email-ph": "Geef een e-mailadres op",
        "createaccountmail": "Gebruik een tijdelijk willekeurig wachtwoord en stuur het naar het opgegeven e-mailadres",
-       "createaccountmail-help": "Kan worden gebruikt voor het aanmaken van een gebruiker voor een andere persoon zonder het wachtwoord te leren.",
+       "createaccountmail-help": "Kan worden gebruikt voor het aanmaken van een account voor een andere persoon zonder het wachtwoord te leren.",
        "createacct-realname": "Echte naam (optioneel)",
        "createacct-reason": "Reden",
-       "createacct-reason-ph": "Waarom u een andere account aanmaakt",
+       "createacct-reason-ph": "Waarom u een ander account aanmaakt",
        "createacct-reason-help": "Weergegeven bericht in het logbestand van aangemaakte gebruikers",
        "createacct-submit": "Account aanmaken",
        "createacct-another-submit": "Account aanmaken",
        "createacct-benefit-body2": "pagina{{PLURAL:$1||'s}}",
        "createacct-benefit-body3": "recente bijdrager{{PLURAL:$1||s}}",
        "badretype": "De ingevoerde wachtwoorden verschillen van elkaar.",
-       "usernameinprogress": "Het aanmaken van een gebruiker met die naam is al bezig.\nEven geduld alstublieft.",
+       "usernameinprogress": "Het aanmaken van een account met die naam is al bezig.\nEven geduld alstublieft.",
        "userexists": "De gekozen gebruikersnaam is al in gebruik.\nKies een andere naam.",
        "loginerror": "Aanmeldfout",
        "createacct-error": "Fout tijdens aanmaken account",
-       "createaccounterror": "Het was niet mogelijk de account aan te maken: $1",
-       "nocookiesnew": "De gebruiker is geregistreerd, maar niet aangemeld.\n{{SITENAME}} gebruikt cookies voor het aanmelden van gebruikers.\nSchakel die in en meld daarna aan met uw nieuwe gebruikersnaam en wachtwoord.",
+       "createaccounterror": "Het was niet mogelijk het account aan te maken: $1",
+       "nocookiesnew": "Het gebruikersaccount is aangemaakt, maar u bent niet aangemeld.\n{{SITENAME}} gebruikt cookies voor het aanmelden van gebruikers.\nSchakel die in en meld daarna aan met uw nieuwe gebruikersnaam en wachtwoord.",
        "nocookieslogin": "{{SITENAME}} gebruikt cookies voor het aanmelden van gebruikers.\nCookies zijn uitgeschakeld in uw browser.\nSchakel deze optie in en probeer het opnieuw.",
-       "nocookiesfornew": "De gebruiker is niet gemaakt omdat de bron niet bevestigd kon worden.\nZorg ervoor dat u cookies hebt ingeschakeld, herlaad deze pagina en probeer het opnieuw.",
-       "createacct-loginerror": "De gebruiker is succesvol aangemaakt, maar u kon niet automatisch worden aangemeld. Ga naar [[Special:UserLogin|handmatig aanmelden]].",
+       "nocookiesfornew": "Het gebruikersaccount is niet aangemaakt, omdat de bron niet bevestigd kon worden.\nZorg ervoor dat u cookies hebt ingeschakeld, herlaad deze pagina en probeer het opnieuw.",
+       "createacct-loginerror": "Het account is succesvol aangemaakt, maar u kon niet automatisch worden aangemeld. Ga naar [[Special:UserLogin|handmatig aanmelden]].",
        "noname": "U hebt geen geldige gebruikersnaam opgegeven.",
        "loginsuccesstitle": "Aangemeld",
        "loginsuccess": "<strong>U bent nu aangemeld bij {{SITENAME}} als \"$1\".</strong>",
-       "nosuchuser": "De gebruiker \"$1\" bestaat niet.\nGebruikersnamen zijn hoofdlettergevoelig.\nControleer de schrijfwijze of [[Special:CreateAccount|maak een nieuw gebruiker aan]].",
+       "nosuchuser": "De gebruiker \"$1\" bestaat niet.\nGebruikersnamen zijn hoofdlettergevoelig.\nControleer de schrijfwijze of [[Special:CreateAccount|maak een nieuw account aan]].",
        "nosuchusershort": "De gebruiker \"$1\" bestaat niet.\nControleer de schrijfwijze.",
        "nouserspecified": "Geef een gebruikersnaam op.",
        "login-userblocked": "Deze gebruiker is geblokkeerd.\nAanmelden is niet mogelijk.",
        "password-login-forbidden": "Het gebruik van deze gebruikersnaam met dit wachtwoord is niet toegestaan.",
        "mailmypassword": "Nieuw wachtwoord e-mailen",
        "passwordremindertitle": "Nieuw tijdelijk wachtwoord voor {{SITENAME}}",
-       "passwordremindertext": "Iemand, waarschijnlijk u, heeft vanaf IP-adres $1 een verzoek\ngedaan tot het toezenden van een nieuw wachtwoord voor {{SITENAME}}\n($4). Er is een tijdelijk wachtwoord aangemaakt voor gebruiker \"$2\":\n\"$3\". Als dat uw bedoeling was, meld u dan nu aan en kies een nieuw\nwachtwoord.\nUw tijdelijke wachtwoord vervalt over {{PLURAL:$5|$5 dag|$5 dagen}}.\n\nAls iemand anders dan u dit verzoek heeft gedaan of als u zich inmiddels het\nwachtwoord herinnert en het niet langer wilt wijzigen, negeer dit bericht\ndan en blijf uw bestaande wachtwoord gebruiken.",
+       "passwordremindertext": "Iemand, waarschijnlijk u, heeft vanaf IP-adres $1 een verzoek\ngedaan tot het toezenden van een nieuw wachtwoord voor {{SITENAME}}\n($4). Er is een tijdelijk wachtwoord aangemaakt voor gebruiker \"$2\":\n\"$3\". Als dat uw bedoeling was, meld u dan nu aan en kies een nieuw\nwachtwoord.\nUw tijdelijke wachtwoord vervalt over {{PLURAL:$5|één dag|$5 dagen}}.\n\nAls iemand anders dan u dit verzoek heeft gedaan, of als u zich het\nwachtwoord inmiddels herinnert en het niet langer wilt wijzigen, negeer\ndit bericht dan en blijf uw oude wachtwoord gebruiken.",
        "noemail": "Er is geen e-mailadres bekend voor gebruiker \"$1\".",
        "noemailcreate": "U moet een geldig e-mailadres opgeven",
        "passwordsent": "Het wachtwoord is verzonden naar het e-mailadres voor \"$1\".\nMeld u aan nadat u het hebt ontvangen.",
        "blocked-mailpassword": "Uw IP-adres is geblokkeerd voor het maken van wijzigingen. Om misbruik te voorkomen is het niet mogelijk om een nieuw wachtwoord aan te vragen.",
-       "eauthentsent": "Er is ter bevestiging een e-mail naar het opgegeven e-mailadres gezonden.\nVolg de aanwijzingen in de e-mail om aan te geven dat het uw e-mailadres is.\nTot die tijd worden er geen e-mails naar het e-mailadres gezonden.",
+       "eauthentsent": "Er is ter bevestiging een e-mail naar het opgegeven e-mailadres gezonden.\nVolg de aanwijzingen in de e-mail om te bevestigen dat het uw account is.\nTot die tijd wordt er geen andere e-mail naar het account gezonden.",
        "throttled-mailpassword": "In {{PLURAL:$1|het laatste uur|de laatste $1 uur}} is al een wachtwoordherinnering verzonden.\nOm misbruik te voorkomen wordt er slechts één wachtwoordherinnering per {{PLURAL:$1|uur|$1 uur}} verzonden.",
        "mailerror": "Fout bij het verzenden van e-mail: $1",
        "acct_creation_throttle_hit": "Bezoekers van deze wiki met hetzelfde IP-adres als u hebben de afgelopen $2 al {{PLURAL:$1|1 gebruiker|$1 gebruikers}} geregistreerd, wat het maximale toegestane aantal is voor deze periode.\nDaarom kunt u vanaf uw IP-adres op dit moment geen nieuwe gebruikers registreren.",
        "accountcreated": "Account aangemaakt",
        "accountcreatedtext": "Het gebruikersaccount [[{{ns:User}}:$1|$1]] ([[{{ns:User talk}}:$1|overleg]]) is aangemaakt.",
        "createaccount-title": "Gebruikers registreren voor {{SITENAME}}",
-       "createaccount-text": "Iemand heeft een gebruiker op {{SITENAME}} ($4) aangemaakt met de naam \"$2\" en uw e-mailadres.\nHet wachtwoord voor \"$2\" is \"$3\".\nMeld u aan en wijzig uw wachtwoord.\n\nNegeer dit bericht als deze gebruiker zonder uw medeweten is aangemaakt.",
+       "createaccount-text": "Iemand heeft een account voor uw e-mailadres op {{SITENAME}} ($4) aangemaakt genaamd \"$2\", met wachtwoord \"$3\".\nMeld u aan en wijzig uw wachtwoord.\n\nU kunt dit bericht negeren als dit account zonder uw medeweten is aangemaakt.",
        "login-throttled": "U heeft recentelijk te veel mislukte aanmeldpogingen gedaan.\nWacht alstublieft $1 voordat u het opnieuw probeert.",
        "login-abort-generic": "Uw aanmelding is mislukt - Afgebroken",
        "login-migrated-generic": "Uw gebruikersnaam is hernoemd, en uw gebruikersnaam bestaat niet langer op deze wiki.",
        "passwordreset-domain": "Domein:",
        "passwordreset-email": "E-mailadres:",
        "passwordreset-emailtitle": "Accountgegevens op {{SITENAME}}",
-       "passwordreset-emailtext-ip": "Iemand, waarschijnlijk u, heeft vanaf het IP-adres $1 een aanvraag gedaan om uw wachtwoord voor {{SITENAME}} ($4) opnieuw in te stellen. De volgende {{PLURAL:$3|gebruiker is|gebruikers zijn}} gekoppeld aan dit e-mailadres:\n\n$2\n\n{{PLURAL:$3|Dit tijdelijke wachtwoord vervalt|Deze tijdelijke wachtwoorden vervallen}} over {{PLURAL:$5|een dag|$5 dagen}}. Meld u aan en wijzig het wachtwoord nu. Als u dit verzoek niet zelf heeft gedaan, of als u het oorspronkelijke wachtwoord nog kent en het niet wilt wijzigen, negeer dit bericht dan en blijf uw oude wachtwoord gebruiken.",
-       "passwordreset-emailtext-user": "Gebruiker $1 op de site {{SITENAME}} heeft een aanvraag gedaan om uw wachtwoord voor {{SITENAME}} ($4) opnieuw in te stellen. De volgende {{PLURAL:$3|gebruiker is|gebruikers zijn}} gekoppeld aan dit e-mailadres:\n\n$2\n\n{{PLURAL:$3|Dit tijdelijke wachtwoord vervalt|Deze tijdelijke wachtwoorden vervallen}} over {{PLURAL:$5|een dag|$5 dagen}}.\nMeld u aan en wijzig het wachtwoord nu. Als u dit verzoek niet zelf heeft gedaan, of als u het oorspronkelijke wachtwoord nog kent en het niet wilt wijzigen, negeer dit bericht dan en blijf uw oude wachtwoord gebruiken.",
+       "passwordreset-emailtext-ip": "Iemand (waarschijnlijk u, vanaf IP-adres $1) heeft een aanvraag gedaan om uw wachtwoord voor {{SITENAME}} ($4) opnieuw in te stellen. {{PLURAL:$3|Het volgende gebruikersaccount is|De volgende gebruikersaccounts zijn}} gekoppeld aan dit e-mailadres:\n\n$2\n\n{{PLURAL:$3|Dit tijdelijke wachtwoord vervalt|Deze tijdelijke wachtwoorden vervallen}} over {{PLURAL:$5|een dag|$5 dagen}}. Meld u aan en wijzig het wachtwoord nu. Als u dit verzoek niet zelf heeft gedaan, of als u het oorspronkelijke wachtwoord nog kent en het niet wilt wijzigen, negeer dit bericht dan en blijf uw oude wachtwoord gebruiken.",
+       "passwordreset-emailtext-user": "Gebruiker $1 op {{SITENAME}} heeft een aanvraag gedaan om uw wachtwoord voor {{SITENAME}} ($4) opnieuw in te stellen. {{PLURAL:$3|Het volgende gebruikersaccount is|De volgende gebruikersaccounts zijn}} gekoppeld aan dit e-mailadres:\n\n$2\n\n{{PLURAL:$3|Dit tijdelijke wachtwoord vervalt|Deze tijdelijke wachtwoorden vervallen}} over {{PLURAL:$5|een dag|$5 dagen}}.\nMeld u aan en wijzig het wachtwoord nu. Als u dit verzoek niet zelf heeft gedaan, of als u het oorspronkelijke wachtwoord nog kent en het niet wilt wijzigen, negeer dit bericht dan en blijf uw oude wachtwoord gebruiken.",
        "passwordreset-emailelement": "Gebruikersnaam: \n$1\n\nTijdelijk wachtwoord: \n$2",
        "passwordreset-emailsentemail": "Als dit e-mailadres aan uw account gekoppeld is, dan wordt er een e-mail verzonden om uw wachtwoord opnieuw in te stellen.",
        "passwordreset-emailsentusername": "Als er een e-mailadres geregistreerd is voor die gebruikersnaam, dan wordt er een e-mail verzonden om uw wachtwoord opnieuw in te stellen.",
        "showpreview": "Bewerking ter controle bekijken",
        "showdiff": "Wijzigingen bekijken",
        "blankarticle": "<strong>Waarschuwing:</strong> de pagina die u wilt aanmaken is leeg.\nAls u opnieuw op \"$1\" klikt, wordt de pagina aangemaakt zonder enige inhoud.",
-       "anoneditwarning": "<strong>Waarschuwing:</strong> u bent niet aangemeld.\nUw IP-adres wordt opgeslagen als u wijzigingen op deze pagina maakt. Wanneer u <strong>[$1 aanmeldt]</strong> of <strong>[$2 een gebruiker aanmaakt]</strong> verschijnen uw bewerkingen onder uw gebruikersnaam, naast andere voordelen.",
+       "anoneditwarning": "<strong>Waarschuwing:</strong> U bent niet aangemeld.\nUw IP-adres zal voor iedereen zichtbaar zijn als u wijzigingen op deze pagina maakt. Wanneer u <strong>[$1 zich aanmeldt]</strong> of <strong>[$2 een account aanmaakt]</strong>, verschijnen uw bewerkingen onder uw gebruikersnaam, naast andere voordelen.",
        "anonpreviewwarning": "''U bent niet aangemeld.''\n''Door uw bewerking op te slaan wordt uw IP-adres opgeslagen in de paginageschiedenis.''",
        "missingsummary": "'''Let op:''' u hebt geen bewerkingssamenvatting opgegeven.\nAls u nogmaals op \"$1\" klikt wordt de bewerking zonder samenvatting opgeslagen.",
        "selfredirect": "<strong>Waarschuwing:</strong> U heeft een doorverwijzing gemaakt naar deze pagina. Mogelijk heeft u de verkeerde bestemming voor de doorverwijzing gebruikt, of bewerkt u de verkeerde pagina. Door nogmaals op \"$1\" te klikken word de doorverwijzing alsnog aangemaakt.",
        "subject-preview": "Voorvertoning van het onderwerp:",
        "previewerrortext": "Er is een fout opgetreden tijdens het weergeven van uw wijzigingen.",
        "blockedtitle": "Gebruiker is geblokkeerd",
-       "blockedtext": "'''Uw gebruiker of IP-adres is geblokkeerd.'''\n\nDe blokkade is uitgevoerd door $1.\nDe opgegeven reden is ''$2''.\n\n* Aanvang blokkade: $8\n* Einde blokkade: $6\n* Bedoeld te blokkeren: $7\n\nU kunt contact opnemen met $1 of een andere [[{{MediaWiki:Grouppage-sysop}}|beheerder]] om de blokkade te bespreken.\nU kunt geen gebruik maken van de functie \"Deze gebruiker e-mailen\", tenzij u een geldig e-mailadres hebt opgegeven in uw [[Special:Preferences|voorkeuren]] en het gebruik van deze functie niet geblokkeerd is.\nUw huidige IP-adres is $3 en het blokkadenummer is #$5.\nVermeld alle bovenstaande gegevens als u ergens op deze blokkade reageert.",
-       "autoblockedtext": "Uw IP-adres is automatisch geblokkeerd, omdat het is gebruikt door een andere gebruiker, die is geblokkeerd door $1.\nDe opgegeven reden is:\n\n:''$2''\n\n* Aanvang blokkade: $8\n* Einde blokkade: $6\n* Bedoeld te blokkeren: $7\n\nU kunt deze blokkade bespreken met $1 of een andere [[{{MediaWiki:Grouppage-sysop}}|beheerder]].\n\nU kunt geen gebruik maken van de functie \"Deze gebruiker e-mailen\", tenzij u een geldig e-mailadres hebt opgegeven in uw [[Special:Preferences|voorkeuren]] en het gebruik van deze functie niet is geblokkeerd.\n\nUw huidige IP-adres is $3 en het blokkadenummer is #$5.\nVermeld alle bovenstaande gegevens als u ergens op deze blokkade reageert.",
-       "systemblockedtext": "Uw gebruikersnaam of IP-adres is automatisch geblokkeerd door MediaWiki.\nDe opgegeven reden is:\n\n:<em>$2</em>\n\n* Aanvang blokkade: $8\n* Einde blokkade: $6\n* Bedoeld te blokkeren: $7\n\nUw huidige IP-adres is $3.\nVermeld alle bovenstaande gegevens in een query die u maakt.",
+       "blockedtext": "'''Uw gebruikersaccount of IP-adres is geblokkeerd.'''\n\nDe blokkade is uitgevoerd door $1.\nDe opgegeven reden is ''$2''.\n\n* Aanvang blokkade: $8\n* Einde blokkade: $6\n* Bedoeld te blokkeren: $7\n\nU kunt contact opnemen met $1 of een andere [[{{MediaWiki:Grouppage-sysop}}|beheerder]] om de blokkade te bespreken.\nU kunt geen gebruik maken van de functie \"Deze gebruiker e-mailen\", tenzij u een geldig e-mailadres hebt opgegeven in uw [[Special:Preferences|voorkeuren]] en het gebruik van deze functie niet geblokkeerd is.\nUw huidige IP-adres is $3 en het blokkadenummer is #$5.\nVermeld alle bovenstaande gegevens als u ergens op deze blokkade reageert.",
+       "autoblockedtext": "Uw IP-adres is automatisch geblokkeerd, omdat het gebruikt is door een andere gebruiker, die geblokkeerd is door $1.\nDe opgegeven reden is:\n\n:''$2''\n\n* Aanvang blokkade: $8\n* Einde blokkade: $6\n* Bedoeld te blokkeren: $7\n\nU kunt contact opnemen met $1 of een andere [[{{MediaWiki:Grouppage-sysop}}|beheerder]] om de blokkade te bespreken.\n\nU kunt geen gebruik maken van de functie \"Deze gebruiker e-mailen\", tenzij u een geldig e-mailadres hebt opgegeven in uw [[Special:Preferences|voorkeuren]] en het gebruik van deze functie niet geblokkeerd is.\n\nUw huidige IP-adres is $3 en het blokkadenummer is #$5.\nVermeld alle bovenstaande gegevens als u ergens op deze blokkade reageert.",
+       "systemblockedtext": "Uw gebruikersaccount of IP-adres is automatisch geblokkeerd door MediaWiki.\nDe opgegeven reden is:\n\n:<em>$2</em>\n\n* Aanvang blokkade: $8\n* Einde blokkade: $6\n* Bedoeld te blokkeren: $7\n\nUw huidige IP-adres is $3.\nVermeld alle bovenstaande gegevens als u ergens op deze blokkade reageert.",
        "blockednoreason": "geen reden opgegeven",
        "whitelistedittext": "U moet $1 om pagina's te bewerken.",
        "confirmedittext": "U moet uw e-mailadres bevestigen voor u kunt bewerken.\nVoer uw e-mailadres in en bevestig het via uw [[Special:Preferences|voorkeuren]].",
        "accmailtext": "Een willekeurig gegenereerd wachtwoord voor [[User talk:$1|$1]] is verzonden naar $2. Het kan worden gewijzigd op de pagina \"[[Special:ChangePassword|wachtwoord wijzigen]]\" na het aanmelden.",
        "newarticle": "(Nieuw)",
        "newarticletext": "Deze pagina bestaat niet.\nTyp in het onderstaande veld om de pagina aan te maken (meer informatie staat op de [$1 hulppagina]).\nGebruik de knop <strong>Terug</strong> in uw browser als u hier per ongeluk terecht bent gekomen.",
-       "anontalkpagetext": "----\n<em>Deze overlegpagina hoort bij een anonieme gebruiker die geen gebruikersnaam heeft of deze niet gebruikt.</em>\nDaarom wordt het IP-adres ter identificatie gebruikt.\nHet is mogelijk dat meerdere personen hetzelfde IP-adres gebruiken.\nMogelijk ontvangt u hier berichten die niet voor u bedoeld zijn.\nAls u dat wilt voorkomen, [[Special:CreateAccount|registreer u]] of [[Special:UserLogin|meld u aan]] om verwarring met andere anonieme gebruikers te voorkomen.",
+       "anontalkpagetext": "----\n<em>Deze overlegpagina hoort bij een anonieme gebruiker die nog geen account heeft aangemaakt, of het niet gebruikt.</em>\nDaarom wordt het IP-adres ter identificatie gebruikt.\nHet is mogelijk dat meerdere personen hetzelfde IP-adres gebruiken.\nMogelijk ontvangt u hier berichten die niet voor u bedoeld zijn.\nAls u dat wilt voorkomen, [[Special:CreateAccount|registreer u]] of [[Special:UserLogin|meld u aan]] om verwarring met andere anonieme gebruikers te voorkomen.",
        "noarticletext": "Deze pagina bevat geen tekst.\nU kunt [[Special:Search/{{PAGENAME}}|naar deze term zoeken]] in andere pagina's, <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} de logboeken doorzoeken] of [{{fullurl:{{FULLPAGENAME}}|action=edit}} deze pagina aanmaken]</span>.",
        "noarticletext-nopermission": "Deze pagina bevat geen tekst.\nU kunt [[Special:Search/{{PAGENAME}}|naar deze term zoeken]] in andere pagina's of\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} de logboeken doorzoeken]</span>, maar u mag de pagina niet aanmaken.",
        "missing-revision": "De versie #$1 van de pagina \"{{FULLPAGENAME}}\" bestaat niet.\n\nDit wordt meestal veroorzaakt door het volgen van een verouderde koppeling naar een pagina die is verwijderd.\nMeer gegevens zijn mogelijk te vinden in het [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} verwijderingslogboek].",
-       "userpage-userdoesnotexist": "U bewerkt een gebruikerspagina van een gebruiker die niet bestaat (gebruiker \"$1\").\nControleer of u deze pagina wel wilt aanmaken of bewerken.",
-       "userpage-userdoesnotexist-view": "De gebruiker \"$1\" is niet geregistreerd.",
-       "blocked-notice-logextract": "Deze gebruiker is op het moment geblokkeerd.\nDe laatste regel uit het blokkeerlogboek wordt hieronder ter referentie weergegeven:",
+       "userpage-userdoesnotexist": "Gebruikersaccount \"$1\" bestaat niet.\nControleer of u deze pagina wel wilt aanmaken/bewerken.",
+       "userpage-userdoesnotexist-view": "Gebruikersaccount \"$1\" is niet geregistreerd.",
+       "blocked-notice-logextract": "Deze gebruiker is momenteel geblokkeerd.\nDe laatste regel uit het blokkeerlogboek wordt hieronder ter referentie weergegeven:",
        "clearyourcache": "<strong>Opmerking:</strong> nadat u de wijzigingen hebt opgeslagen is het wellicht nodig uw browsercache te legen.\n* <strong>Firefox / Safari:</strong> houd <em>Shift</em> ingedrukt terwijl u op <em>Vernieuwen</em> klikt of druk op <em>Ctrl-F5</em> of <em>Ctrl-R</em> (<em>⌘-Shift-R</em> op een Mac)\n* <strong>Google Chrome:</strong> druk op <em>Ctrl-Shift-R</em> (<em>⌘-Shift-R</em> op een Mac)\n* <strong>Internet Explorer:</strong> houd <em>Ctrl</em> ingedrukt terwijl u op <em>Vernieuwen</em> klikt of druk op <em>Ctrl-F5</em>\n* '''Opera:''' ga naar <em>Menu → Instellingen</em> (<em>Opera → Voorkeuren</em> op een Mac) en daarna naar <em>Privacy & beveiliging → Browsegegevens wissen... →  Tijdelijk opgeslgen afbeeldingen en bestanden</em>.",
        "usercssyoucanpreview": "'''Tip:''' gebruik de knop \"{{int:showpreview}}\" om uw nieuwe CSS te testen alvorens op te slaan.",
        "userjsyoucanpreview": "'''Tip:''' gebruik de knop \"{{int:showpreview}}\" om uw nieuwe JavaScript te testen alvorens op te slaan.",
        "yourlanguage": "Taal:",
        "yourvariant": "Taalvariant voor inhoud:",
        "prefs-help-variant": "Uw voorkeursvariant of -spelling om de inhoudspagina's van deze wiki in weer te geven.",
-       "yournick": "Tekst voor ondertekening:",
-       "prefs-help-signature": "Reacties op de overlegpagina's worden meestal ondertekend met \"<nowiki>~~~~</nowiki>\".\nDe tildes worden omgezet in uw ondertekening en een datum en tijd van de bewerking.",
+       "yournick": "Tekst voor handtekening:",
+       "prefs-help-signature": "Reacties op de overlegpagina's worden meestal ondertekend met \"<nowiki>~~~~</nowiki>\".\nDe tildes worden omgezet in uw handtekening en de datum en tijd van de bewerking.",
        "badsig": "Ongeldige ondertekening; controleer de HTML-labels.",
        "badsiglength": "Uw ondertekening is te lang.\nDeze moet minder dan $1 {{PLURAL:$1|teken|tekens}} bevatten.",
        "yourgender": "Hoe wilt u beschreven worden?",
        "email": "E-mail",
        "prefs-help-realname": "Echte naam is optioneel.\nAls u deze opgeeft, kan deze naam gebruikt worden om u erkenning te geven voor uw werk.",
        "prefs-help-email": "E-mailadres is optioneel, maar maakt het mogelijk om u uw wachtwoord te e-mailen als u het bent vergeten.",
-       "prefs-help-email-others": "U kunt ook anderen in staat stellen per e-mail contact met u op te nemen via een koppeling op uw gebruikers- en overlegpagina zonder dat u uw identiteit prijsgeeft.",
+       "prefs-help-email-others": "U kunt ook anderen in staat stellen per e-mail contact met u op te nemen via een koppeling op uw gebruikers- en overlegpagina.\nUw e-mailadres wordt niet prijsgegeven als andere gebruikers contact met u opnemen.",
        "prefs-help-email-required": "Hiervoor is een e-mailadres nodig.",
        "prefs-info": "Basisgegevens",
        "prefs-i18n": "Taalinstellingen",
-       "prefs-signature": "Ondertekening",
+       "prefs-signature": "Handtekening",
        "prefs-dateformat": "Datumopmaak",
        "prefs-timeoffset": "Tijdverschil",
        "prefs-advancedediting": "Algemene instellingen",
        "saveusergroups": "{{GENDER:$1|Gebruikersgroepen}} opslaan",
        "userrights-groupsmember": "Lid van:",
        "userrights-groupsmember-auto": "Impliciet lid van:",
-       "userrights-groups-help": "U kunt de groepen wijzigen waar deze gebruiker lid van is.\n* Een aangekruist vakje betekent dat de gebruiker lid is van de groep.\n* Een niet aangekruist vakje betekent dat de gebruiker geen lid is van de groep.\n* Een \"*\" betekent dat u een gebruiker niet uit een groep kunt verwijderen nadat u die hebt toegevoegd of vice versa.\n* Een \"#\" betekent dat u dit groepslidmaatschap alleen kunt verlengen. U kunt het niet verkorten.",
+       "userrights-groups-help": "U kunt de groepen wijzigen waar deze gebruiker lid van is:\n* Een aangekruist vakje betekent dat de gebruiker lid is van de groep.\n* Een niet aangekruist vakje betekent dat de gebruiker geen lid is van de groep.\n* Een \"*\" betekent dat u een gebruiker niet uit een groep kunt verwijderen nadat u die hebt toegevoegd of vice versa.\n* Een \"#\" betekent dat u dit groepslidmaatschap alleen kunt verlengen; u kunt het niet verkorten.",
        "userrights-reason": "Reden:",
        "userrights-no-interwiki": "U hebt geen rechten om gebruikersrechten op andere wiki's te wijzigen.",
        "userrights-nodatabase": "De database $1 bestaat niet of is geen lokale database.",
        "right-edit": "Pagina's bewerken",
        "right-createpage": "Pagina's aanmaken",
        "right-createtalk": "Overlegpagina's aanmaken",
-       "right-createaccount": "Nieuwe gebruikers aanmaken",
+       "right-createaccount": "Nieuwe gebruikersaccounts aanmaken",
        "right-autocreateaccount": "Automatisch aanmelden met een extern gebruikersaccount",
        "right-minoredit": "Bewerkingen als klein markeren",
        "right-move": "Pagina's hernoemen",
        "action-edit": "deze pagina te bewerken",
        "action-createpage": "deze pagina aan te maken",
        "action-createtalk": "deze overlegpagina aan te maken",
-       "action-createaccount": "deze gebruiker aan te maken",
-       "action-autocreateaccount": "dit externe gebruikersaccount automatisch aanmaken",
+       "action-createaccount": "dit gebruikersaccount aan te maken",
+       "action-autocreateaccount": "dit externe gebruikersaccount automatisch aan te maken",
        "action-history": "de geschiedenis van deze pagina te bekijken",
        "action-minoredit": "deze bewerking als klein te markeren",
        "action-move": "deze pagina te hernoemen",
        "zip-bad": "Het bestand is een beschadigd of onleesbaar ZIP-bestand.\nDe veiligheid kan niet worden gecontroleerd.",
        "zip-unsupported": "Het bestand is een ZIP-bestand dat gebruik maakt van ZIP-mogelijkheden die MediaWiki niet ondersteunt.\nDe veiligheid kan niet worden gecontroleerd.",
        "uploadstash": "Verborgen uploads",
-       "uploadstash-summary": "Deze pagina biedt toegang tot bestanden die geüpload zijn of nog geüpload worden maar nog niet beschikbaar gemaakt zijn in de wiki. Deze bestanden zijn alleen zichtbaar voor de gebruiker die ze uploadt.",
+       "uploadstash-summary": "Deze pagina biedt toegang tot bestanden die geüpload zijn of nu geüpload worden, maar nog niet beschikbaar gemaakt zijn in de wiki. Deze bestanden zijn alleen zichtbaar voor de gebruiker die ze heeft geüpload.",
        "uploadstash-clear": "Verborgen bestanden weggooien",
        "uploadstash-nofiles": "Er zijn geen verborgen bestanden.",
        "uploadstash-badtoken": "Het uitvoeren van de handeling is mislukt, mogelijk doordat uw bewerkingsreferenties zijn verlopen. Probeer het opnieuw.",
        "log": "Logboeken",
        "logeventslist-submit": "Weergeven",
        "all-logs-page": "Alle openbare logboeken",
-       "alllogstext": "Dit is het gecombineerde logboek van {{SITENAME}}.\nU kunt ook kiezen voor specifieke logboeken en filteren op gebruiker (hoofdlettergevoelig) en paginanaam (hoofdlettergevoelig).",
+       "alllogstext": "Dit is het gecombineerde logboek van {{SITENAME}}.\nU kunt de lijst filteren door een specifiek logboektype te selecteren, of de gebruikersnaam (hoofdlettergevoelig) of paginatitel (tevens hoofdlettergevoelig) in te geven.",
        "logempty": "Er zijn geen regels in het logboek die voldoen aan deze criteria.",
        "log-title-wildcard": "Pagina's zoeken die met deze tekens beginnen",
        "showhideselectedlogentries": "Geselecteerde logboekregels weergeven of verbergen",
        "listgrouprights-namespaceprotection-namespace": "Naamruimte",
        "listgrouprights-namespaceprotection-restrictedto": "Recht(en) waardoor gebruiker kan bewerken",
        "listgrants": "Toestemmingen",
-       "listgrants-summary": "Hieronder staat een lijst met toestemmingen en de bijbehorende gebruikersrechten. Gebruikers kunnen toepassingen machtigen voor toegang tot hun gebruikers, maar met beperkte rechten gebaseerd op de toestemmingen die de gebruiker aan de toepassing heeft gegeven. Een toepassing die namens een gebruiker handelt, kan nooit rechten gebruiken die een gebruiker niet heeft.\nEr zijn mogelijk [[{{MediaWiki:Listgrouprights-helppage}}|aanvullende  gegevens]] over individuele rechten.",
+       "listgrants-summary": "Hieronder staat een lijst met toestemmingen en de bijbehorende gebruikersrechten. Gebruikers kunnen toepassingen machtigen voor toegang tot hun account, maar met beperkte rechten gebaseerd op de toestemmingen die de gebruiker aan de toepassing heeft gegeven. Een toepassing die namens een gebruiker handelt, kan nooit rechten gebruiken die een gebruiker niet heeft.\nEr zijn mogelijk [[{{MediaWiki:Listgrouprights-helppage}}|aanvullende  gegevens]] over individuele rechten.",
        "listgrants-grant": "Toestemming",
        "listgrants-rights": "Rechten",
        "trackingcategories": "Volgcategorieën",
        "emailuser-title-notarget": "Gebruiker e-mailen",
        "emailpagetext": "Via dit formulier kunt u een e-mail aan {{GENDER:$1|deze gebruiker}} verzenden.\nHet e-mailadres dat u hebt opgegeven bij [[Special:Preferences|uw voorkeuren]] wordt als afzender gebruikt.\nDe ontvanger kan dus direct naar u reageren.",
        "defemailsubject": "E-mail van {{SITENAME}}-gebruiker \"$1\"",
-       "usermaildisabled": "Gebruikerse-mail uitgeschakeld",
+       "usermaildisabled": "Gebruikers-e-mail uitgeschakeld",
        "usermaildisabledtext": "U kunt geen e-mail verzenden naar andere gebruikers op deze wiki",
        "noemailtitle": "Van deze gebruiker is geen e-mailadres bekend",
        "noemailtext": "Deze gebruiker heeft geen geldig e-mailadres opgegeven.",
        "unwatchthispage": "Niet meer volgen",
        "notanarticle": "Is geen pagina",
        "notvisiblerev": "De laatste versie van een andere gebruiker is verwijderd",
-       "watchlist-details": "Er {{PLURAL:$1|staat één pagina|staan $1 pagina's}} op uw volglijst (inclusief overlegpagina's).",
+       "watchlist-details": "Er {{PLURAL:$1|staat één pagina|staan $1 pagina's}} op uw volglijst (plus overlegpagina's).",
        "wlheader-enotif": "U wordt per e-mail gewaarschuwd.",
        "wlheader-showupdated": "Pagina's die zijn bewerkt sinds uw laatste bezoek worden '''vet''' weergegeven.",
        "wlnote": "Hieronder {{PLURAL:$1|staat de laaste wijziging|staan de laatste $1 wijzigingen}} in {{PLURAL:$2|het laatste uur|de laatste $2 uur}} per $3 om $4.",
        "sp-contributions-logs": "logboeken",
        "sp-contributions-talk": "overleg",
        "sp-contributions-userrights": "{{GENDER:$1|gebruikersrechtenbeheer}}",
-       "sp-contributions-blocked-notice": "Deze gebruiker is op het moment geblokkeerd.\nDe laatste regel uit het blokkeerlogboek wordt hieronder ter referentie weergegeven:",
+       "sp-contributions-blocked-notice": "Deze gebruiker is momenteel geblokkeerd.\nDe laatste regel uit het blokkeerlogboek wordt hieronder ter referentie weergegeven:",
        "sp-contributions-blocked-notice-anon": "Dit IP-adres is geblokkeerd.\nDe laatste regel uit het blokkeerlogboek wordt hieronder ter referentie weergegeven:",
        "sp-contributions-search": "Zoeken naar bijdragen",
        "sp-contributions-username": "IP-adres of gebruikersnaam:",
        "ipbexpiry": "Vervalt (maak een keuze):",
        "ipbreason": "Reden:",
        "ipbreason-dropdown": "*Veelvoorkomende redenen voor blokkades\n** Foutieve informatie invoeren\n** Verwijderen van informatie uit pagina's\n** Spamkoppeling naar externe websites\n** Invoegen van nonsens in pagina's\n** Intimiderend gedrag\n** Misbruik door meerdere gebruikers\n** Onaanvaardbare gebruikersnaam",
-       "ipb-hardblock": "Voorkomen dat aangemelde gebruikers vanaf dit IP-adres kunnen bewerken",
+       "ipb-hardblock": "Aangemelde gebruikers de mogelijkheid ontnemen om vanaf dit IP-adres te bewerken",
        "ipbcreateaccount": "Registreren accounts blokkeren",
-       "ipbemailban": "Gebruiker weerhouden van het sturen van e-mail",
-       "ipbenableautoblock": "Automatisch de IP-adressen van deze gebruiker blokkeren",
+       "ipbemailban": "Gebruiker de mogelijkheid ontnemen om e-mail te versturen",
+       "ipbenableautoblock": "Automatisch het laatste IP-adres van deze gebruiker blokkeren, en alle volgende IP-adressen waarvandaan degene probeert te bewerken",
        "ipbsubmit": "Deze gebruiker blokkeren",
        "ipbother": "Andere duur:",
        "ipboptions": "2 uur:2 hours,1 dag:1 day,3 dagen:3 days,1 week:1 week,2 weken:2 weeks,1 maand:1 month,3 maanden:3 months,6 maanden:6 months,1 jaar:1 year,onbepaald:infinite",
-       "ipbhidename": "Gebruiker in bewerkingen en lijsten verbergen",
-       "ipbwatchuser": "Gebruikerspagina en overlegpagina op volglijst plaatsen",
-       "ipb-disableusertalk": "Voorkomen dat deze gebruiker tijdens de blokkade de eigen overlegpagina kan bewerken",
+       "ipbhidename": "Gebruikersnaam in bewerkingen en lijsten verbergen",
+       "ipbwatchuser": "Gebruikerspagina en overlegpagina van deze gebruiker op de volglijst plaatsen",
+       "ipb-disableusertalk": "Deze gebruiker de mogelijkheid ontnemen om tijdens de blokkade de eigen overlegpagina te bewerken",
        "ipb-change-block": "De gebruiker opnieuw blokkeren met deze instellingen",
        "ipb-confirm": "Blokkade bevestigen",
        "badipaddress": "Geen geldig IP-adres",
        "blockipsuccesssub": "De blokkering is ingesteld",
        "blockipsuccesstext": "[[Special:Contributions/$1|$1]] is geblokkeerd.<br />\nZie de [[Special:BlockList|blokkadelijst]] voor recente blokkades.",
        "ipb-blockingself": "U staat op het punt uzelf te blokkeren. Weet u zeker dat u dat wilt doen?",
-       "ipb-confirmhideuser": "U staat op het punt een verborgen gebruiker te blokkeren. Hiervoor worden gebruikersnamen in alle lijsten en logboekregels verborgen. Weet u het zeker?",
+       "ipb-confirmhideuser": "U staat op het punt een verborgen gebruiker te blokkeren. Hiermee wordt de gebruikersnaam in alle lijsten en logboekregels verborgen. Weet u het zeker?",
        "ipb-confirmaction": "Weet u zeker dat u dit wilt doen? Selecteer dan het selectievakje \"{{int:ipb-confirm}}\" hieronder.",
        "ipb-edit-dropdown": "Lijst van redenen bewerken",
        "ipb-unblock-addr": "$1 deblokkeren",
        "ipb_expiry_invalid": "Ongeldige duur.",
        "ipb_expiry_old": "Vervaldatum is in het verleden.",
        "ipb_expiry_temp": "Blokkades voor verborgen gebruikers moeten permanent zijn.",
-       "ipb_hide_invalid": "Het is niet mogelijk deze gebruiker te verbergen; deze heeft meer dan {{PLURAL:$1|een bewerking|$1 bewerkingen}} uitgevoerd.",
+       "ipb_hide_invalid": "Het is niet mogelijk dit account te verbergen; het heeft meer dan {{PLURAL:$1|een bewerking|$1 bewerkingen}}.",
        "ipb_already_blocked": "\"$1\" is al geblokkeerd",
        "ipb-needreblock": "$1 is al geblokkeerd.\nWilt u de instellingen wijzigen?",
        "ipb-otherblocks-header": "Andere {{PLURAL:$1|blokkade|blokkades}}",
        "proxyblocker": "Proxyblocker",
        "proxyblockreason": "Uw IP-adres is geblokkeerd, omdat u gebruik maakt van een open proxyserver.\nNeem contact op met uw internetprovider of uw helpdesk en stel die op de hoogte van dit ernstige beveiligingsprobleem.",
        "sorbsreason": "Uw IP-adres staat bekend als open proxyserver in de DNS-blacklist die {{SITENAME}} gebruikt.",
-       "sorbs_create_account_reason": "Uw IP-adres staat bekend als open proxyserver in de DNS-blacklist die {{SITENAME}} gebruikt.\nU kunt geen gebruiker registreren.",
+       "sorbs_create_account_reason": "Uw IP-adres staat bekend als open proxyserver in de DNS-blacklist die {{SITENAME}} gebruikt.\nU kunt geen account aanmaken.",
        "softblockrangesreason": "Anonieme bijdragen zijn niet toegestaan op basis van uw IP-adres ($1). Gelieve in te loggen.",
        "xffblockreason": "Een IP-adres dat u gebruikt is geblokkeerd. Dit staat de X-Forwarded-For van de header. De oorspronkelijke blokkadereden is: $1",
        "cant-see-hidden-user": "De gebruiker die u probeert te blokken is al geblokkeerd en verborgen.\nOmdat u het recht \"hideuser\" niet hebt, kunt u de blokkade van de gebruiker niet bekijken of bewerken.",
        "confirmemail": "E-mailadres bevestigen",
        "confirmemail_noemail": "U hebt geen geldig e-mailadres opgegeven in uw [[Special:Preferences|gebruikersvoorkeuren]].",
        "confirmemail_text": "{{SITENAME}} eist bevestiging van uw e-mailadres voordat u de e-mailmogelijkheden kunt gebruiken.\nKlik op de onderstaande knop om een bevestigingsbericht te ontvangen.\nDit bericht bevat een koppeling met een code.\nOpen die koppeling om uw e-mailadres te bevestigen.",
-       "confirmemail_pending": "Er is al een bevestigingsbericht aan u verzonden.\nAls u recentelijk uw gebruiker hebt aangemaakt, wacht dan een paar minuten totdat die aankomt voordat u opnieuw een e-mail laat sturen.",
+       "confirmemail_pending": "Er is al een bevestigingsbericht aan u verzonden.\nAls u recentelijk uw account hebt aangemaakt, wacht dan een paar minuten totdat het bericht aankomt voordat u opnieuw een e-mail laat sturen.",
        "confirmemail_send": "Een bevestigingscode verzenden",
        "confirmemail_sent": "Bevestigingscode verzonden.",
        "confirmemail_oncreate": "Er is een bevestigingscode naar uw e-mailadres verzonden.\nDeze code is niet nodig om u aan te melden, maar u dient deze wel te bevestigen voordat u de e-mailmogelijkheden van deze wiki kunt gebruiken.",
        "confirmemail_success": "Uw e-mailadres is bevestigd.\nU kunt zich nu [[Special:UserLogin|aanmelden]] en de wiki gebruiken.",
        "confirmemail_loggedin": "Uw e-mailadres is nu bevestigd.",
        "confirmemail_subject": "Bevestiging e-mailadres voor {{SITENAME}}",
-       "confirmemail_body": "Iemand, waarschijnlijk u, met het IP-adres $1,\nheeft zich met dit e-mailadres geregistreerd als gebruiker \"$2\" op {{SITENAME}}.\n\nOpen de volgende koppeling in uw webbrowser om te bevestigen dat u deze gebruiker bent en om de e-mailmogelijkheden op {{SITENAME}} te activeren:\n\n$3\n\nAls u uzelf *niet* hebt aangemeld, volg dan de volgende koppeling om de bevestiging van uw e-mailadres te annuleren:\n\n$5\n\nDe bevestigingscode vervalt op $4.",
-       "confirmemail_body_changed": "Iemand, waarschijnlijk u, met het IP-adres $1,\nheeft het e-mailadres geregistreerd voor gebruiker \"$2\" op {{SITENAME}} gewijzigd naar dit e-mailadres.\n\nOpen de volgende koppeling in uw webbrowser om te bevestigen dat u deze gebruiker bent en om de e-mailmogelijkheden op {{SITENAME}} opnieuw te activeren:\n\n$3\n\nAls u uzelf *niet* hebt aangemeld, volg dan de volgende koppeling om de bevestiging van uw e-mailadres te annuleren:\n\n$5\n\nDe bevestigingscode vervalt op $4.",
-       "confirmemail_body_set": "Iemand, waarschijnlijk u, met het IP-adres $1,\nheeft het e-mailadres voor gebruiker \"$2\" op {{SITENAME}} ingesteld op dit e-mailadres.\n\nOpen de volgende koppeling in uw webbrowser om te bevestigen dat u deze gebruiker bent en om de e-mailmogelijkheden op {{SITENAME}} opnieuw te activeren:\n\n$3\n\nAls deze gebruiker *niet* aan u toebehoort, klik dan op de volgende koppeling om de bevestiging van uw e-mailadres te annuleren:\n\n$5\n\nDe bevestigingscode vervalt op $4.",
+       "confirmemail_body": "Iemand, waarschijnlijk u, vanaf IP-adres $1,\nheeft met dit e-mailadres een account \"$2\" aangemaakt op {{SITENAME}}.\n\nOpen de volgende koppeling in uw webbrowser om te bevestigen dat dit account echt aan u toebehoort en de e-mailmogelijkheden op {{SITENAME}} te activeren:\n\n$3\n\nAls u *niet* dit account hebt aangemaakt, volg dan de volgende koppeling om de bevestiging van uw e-mailadres te annuleren:\n\n$5\n\nDe bevestigingscode vervalt op $4.",
+       "confirmemail_body_changed": "Iemand, waarschijnlijk u, vanaf IP-adres $1,\nheeft het e-mailadres van het account \"$2\" op {{SITENAME}} gewijzigd naar dit e-mailadres.\n\nOpen de volgende koppeling in uw webbrowser om te bevestigen dat dit account echt aan u toebehoort en de e-mailmogelijkheden op {{SITENAME}} opnieuw te activeren:\n\n$3\n\nAls dit account *niet* aan u toebehoort, volg dan de volgende koppeling om de bevestiging van uw e-mailadres te annuleren:\n\n$5\n\nDe bevestigingscode vervalt op $4.",
+       "confirmemail_body_set": "Iemand, waarschijnlijk u, vanaf IP-adres $1,\nheeft het e-mailadres van het account \"$2\" op {{SITENAME}} ingesteld op dit e-mailadres.\n\nOpen de volgende koppeling in uw webbrowser om te bevestigen dat dit account echt aan u toebehoort en de e-mailmogelijkheden op {{SITENAME}} te activeren:\n\n$3\n\nAls dit account *niet* aan u toebehoort, volg dan de volgende koppeling om de bevestiging van uw e-mailadres te annuleren:\n\n$5\n\nDe bevestigingscode vervalt op $4.",
        "confirmemail_invalidated": "De e-mailbevestiging is geannuleerd",
        "invalidateemail": "E-mailbevestiging annuleren",
        "notificationemail_subject_changed": "{{SITENAME}} geregistreerd e-mailadres is gewijzigd",
        "notificationemail_subject_removed": "{{SITENAME}} geregistreerd e-mailadres is verwijderd",
-       "notificationemail_body_changed": "Iemand, waarschijnlijk u, met het IP-adres $1, heeft het e-mailadres van de gebruiker \"$2\" op {{SITENAME}} gewijzigd naar \"$3\". \n\nAls u dit niet was, neem dan onmiddellijk contact op met een sitebeheerder.",
-       "notificationemail_body_removed": "Iemand, waarschijnlijk u, met het IP-adres $1, heeft het e-mailadres geregistreerd voor gebruiker \"$2\" verwijderd op {{SITENAME}}. \n\nAls u dit niet was, neem dan onmiddellijk contact op met een sitebeheerder.",
+       "notificationemail_body_changed": "Iemand, waarschijnlijk u, vanaf IP-adres $1, heeft het e-mailadres van het account \"$2\" op {{SITENAME}} gewijzigd naar \"$3\". \n\nAls u dit niet was, neem dan onmiddellijk contact op met een sitebeheerder.",
+       "notificationemail_body_removed": "Iemand, waarschijnlijk u, vanaf IP-adres $1, heeft het e-mailadres van het account \"$2\" verwijderd op {{SITENAME}}. \n\nAls u dit niet was, neem dan onmiddellijk contact op met een sitebeheerder.",
        "scarytranscludedisabled": "[Interwiki-invoeging van sjablonen is uitgeschakeld]",
        "scarytranscludefailed": "[De sjabloon $1 kon niet opgehaald worden]",
        "scarytranscludefailed-httpstatus": "[De sjabloon $1 kon niet opgehaald worden: HTTP $2]",
        "logentry-patrol-patrol-auto": "$1 {{GENDER:$2|heeft}} versie $4 van pagina $3 automatisch gemarkeerd als gecontroleerd",
        "logentry-newusers-newusers": "Gebruikersaccount $1 {{GENDER:$2|is}} aangemaakt",
        "logentry-newusers-create": "Gebruikersaccount $1 {{GENDER:$2|is}} aangemaakt",
-       "logentry-newusers-create2": "Gebruiker $3 {{GENDER:$2|is}} aangemaakt door $1",
-       "logentry-newusers-byemail": "Gebruiker $3 {{GENDER:$2|is}} aangemaakt door $1 en het wachtwoord is per e-mail verzonden",
+       "logentry-newusers-create2": "Gebruikersaccount $3 is {{GENDER:$2|aangemaakt}} door $1",
+       "logentry-newusers-byemail": "Gebruikersaccount $3 is {{GENDER:$2|aangemaakt}} door $1 en het wachtwoord is per e-mail verzonden",
        "logentry-newusers-autocreate": "Gebruikersaccount $1 {{GENDER:$2|is}} automatisch aangemaakt",
        "logentry-protect-move_prot": "$1 heeft de beveiligingsinstellingen {{GENDER:$2|verplaatst}} van $4 naar $3",
        "logentry-protect-unprotect": "$1 heeft de beveiliging {{GENDER:$2|opgeheven}} van $3",
        "log-action-filter-upload-overwrite": "Herupload",
        "authmanager-authn-not-in-progress": "Verificatie is niet in uitvoering of de sessiegegevens zijn verloren gegaan. Gelieve opnieuw starten vanaf het begin.",
        "authmanager-authn-no-primary": "De meegeleverde inloggegevens kunnen niet worden geverifieerd.",
-       "authmanager-authn-no-local-user": "De ingevoerde inloggegevens zijn niet geassocieerd met een gebruiker op deze wiki.",
-       "authmanager-authn-no-local-user-link": "De meegeleverde inloggegevens zijn geldig, maar zijn niet gekoppeld aan enige gebruiker op deze wiki. Log in op een andere manier, of creëer een nieuwe gebruiker, en u heeft een optie om uw eerdere inloggegevens van te koppelen.",
+       "authmanager-authn-no-local-user": "De ingevoerde inloggegevens zijn niet gekoppeld aan een gebruiker op deze wiki.",
+       "authmanager-authn-no-local-user-link": "De ingevoerde inloggegevens zijn geldig, maar zijn niet gekoppeld aan een gebruiker op deze wiki. Meld u op een andere manier aan, of maak een nieuw account aan, en u krijgt een optie om uw eerdere inloggegevens aan dat account te koppelen.",
        "authmanager-authn-autocreate-failed": "Het automatisch aanmaken van een lokaal account is mislukt: $1",
        "authmanager-change-not-supported": "De meegeleverde inloggegevens kunnen niet worden gewijzigd, omdat niets deze zou gebruiken.",
        "authmanager-create-disabled": "Het aanmaken van accounts is uitgeschakeld.",
index 2cc58b0..6c15199 100644 (file)
        "changepassword-success": "ستاسې پټنوم بدل شو!",
        "changepassword-throttled": "تاسې څو واره هڅه کړې چې غونډال ته ورننوځۍ.\nلطفاً د بيا هڅې نه مخکې $1 شېبې تم شۍ.",
        "botpasswords": "روباټ پټنومونه",
+       "botpasswords-summary": "<em>د بوټ پټنومونه</em> د اصلي پټنوم کارولو څخه پرته د ای پی ادرس سره ګڼون ته لاسرسي نه ورکول کيږی. د کاروونکي موجوده لاسرسی ممکن محدود وي کله چې د روباټ پاسورډ داخل شي.\nکه تاسو نه پوهیږئ چې څه شی کولی شئ له دې سره وکړئ، تاسو ممکن هیڅکله هم ونه کړئ. هیڅوک باید له تاسو څخه د دې د ورکولو لپاره نه وپوښتل شي.",
+       "botpasswords-disabled": "د بوټ پټنوم ناممکنه دي.",
+       "botpasswords-no-central-id": "د بوټ د پټنوم کارولو لپاره، تاسو باید په مرکزي حساب کې ننوتلي ياست.",
        "botpasswords-existing": "د بوټ موجود پټ نومونه",
        "botpasswords-createnew": "نوی پټنوم (پاسورډ) جوړ کړي",
        "botpasswords-editexisting": "د بوټ موجود پاسورډ جوړ کړئ",
        "botpasswords-label-delete": "ړنگول",
        "botpasswords-label-resetpassword": "پټوم بدل کړي",
        "botpasswords-label-grants": "تطبیق وړ ګرانټ:",
+       "botpasswords-help-grants": "هر اجازه روبوټ ته اجازه ورکوي چې هغه واک ته لاسرسۍ ومومي کوم چې ستاسو حساب ساتي. د اجازې فعالول دلته، نوې لاسرسی نشته چې ستاسو حساب اوس مهال نلري. د نورو معلوماتو لپاره [[Special:ListGrants|table of grants]] وګورئ.",
        "botpasswords-label-grants-column": "ورکړل شو",
        "botpasswords-bad-appid": "د بوټ نوم \"$1\" وجود نلري.",
        "botpasswords-insert-failed": "د بوټ \"$1\" نوم په ورګډولو کي پاتې راغلې دا نوم د پخوا څخه ورګډ سوي وو?",
+       "botpasswords-update-failed": "د بوټ نوم په نوي کولو کې ناکام شوې \"$1\".ایا دا ړنګ شوی دی؟",
        "botpasswords-created-title": "د بوټ پټنوم جوړ شو",
        "botpasswords-created-body": "د بوټ پټنوم د بوټ \"$1\" د کارن \"$2\" لپاره جوړ شو.",
        "botpasswords-updated-title": "د بوټ پټنوم آپډيټ سو",
        "botpasswords-updated-body": "د بوټ پټنوم د بوټ \"$1\" د کارن \"$2\" لپاره آپډيټ شو.",
        "botpasswords-deleted-title": "د بوټ پټنوم ړنګ شو",
        "botpasswords-deleted-body": "د بوټ پټنوم د بوټ \"$1\" د کارن \"$2\" لپاره ړنګ شو.",
+       "botpasswords-newpassword": "<strong>$2</strong> د ګڼون سره د ننوتلو لپاره نوی پټنوم <strong>$1</strong> دی. <em>مهرباني وکړئ دا د راتلونکی لپاره وساتئ.</em> <br> (د زړو روبوټونو لپاره چې یو کارنومینر ته اړتیا لري چې خپل ګڼون سره سمون لري، تاسو کولی شئ له <strong>$3</strong> لاندې يو کارننوم او <strong>$4</strong> د پټنوم په توګه کاروئ.)",
+       "botpasswords-no-provider": "د بوټ شفر د غونډو وړاندې کول شتون نلري.",
+       "botpasswords-restriction-failed": "د بوټ پاسورډ محدودیتونه د دې ننوتنې مخه نیسي",
+       "botpasswords-invalid-name": "په کارنۍ نومول شوی کې د بوټو د پاسورډ جلا کول شامل نه دی (\"$1\").",
+       "botpasswords-not-exist": "کارن \"$1\"  يو روباټ پټنوم نه لري نوم \"$2\".",
        "resetpass_forbidden": "پټنومونه مو نه شي بدلېدلای",
+       "resetpass_forbidden-reason": "پټنومونه مو نه شي بدلېدلای: $1",
        "resetpass-no-info": "دې مخ ته د لاسرسي لپاره بايد غونډال کې ورننوځۍ.",
        "resetpass-submit-loggedin": "پټنوم بدلول",
        "resetpass-submit-cancel": "ناگارل",
-       "resetpass-wrong-oldpass": "Ù\84Ù\86Ú\89Ù\85Ù\87اÙ\84 Ø§Ù\88 Ù\8aا Ù\87Ù\85 Ø§Ù\88سÙ\86Û\8c Ù¾Ù¼Ù\86Ù\88Ù\85 Ù\85Ù\88 Ù\86اسÙ\85 Ø¯Û\8c",
+       "resetpass-wrong-oldpass": "Ù\86اسÙ\85 Ù\84Ù\86Ú\89Ù\85Ù\87اÙ\84Ù\87 Û\8cا Ø§Ù\88سÙ\86Û\8c Ù¾Ù¼Ù\86Ù\88Ù\85.\nتاسÙ\88 Ù\85Ù\85Ú©Ù\86Ù\86 Ù\85خکÛ\90 Ø®Ù¾Ù\84 Ù¾Ù¼Ù\86Ù\88Ù\85 Ø¨Ø¯Ù\84 Ú©Ú\93Û\8c Ù\88Ù\8a Û\8cا Ø¯ Ù\86Ù\88Ù\8a Ù\84Ù\86Ú\89Ù\85Ù\87اÙ\84Ù\87 Ù¾Ù¼Ù\86Ù\88Ù\85 ØºÙ\88Ú\9aتÙ\86Ù\87 Ú©Ú\93Û\90 Ù\88Û\8c.",
        "resetpass-recycled": "لطفاً پټنوم مو داسې وټاکئ چې له اوسني پټنوم سره يې توپير وي.",
        "resetpass-temp-emailed": "تاسې د يو لنډمهاله کوډ په مرسته چې دربرېښليک شوی و، ننوتلي ياست. \nد ننوتلو د بشپړولو لپاره بايد ځانته يو نوی پټنوم دلته وټاکئ:",
        "resetpass-temp-password": "لنډمهالی پټنوم:",
        "passwordreset-domain": "شپول:",
        "passwordreset-email": "برېښليک پته:",
        "passwordreset-emailtitle": "د {{SITENAME}} د گڼون څرگندنې",
+       "passwordreset-emailtext-ip": "یک نفر (شاید تاسو، دآی‌پی پتی سره$1) د خپل پټنوم بیا سمولو لپاره غوښتنه{{SITENAME}} ($4) کړی ده. {{PLURAL:$3|ګڼون|ګڼونونه}} لاندې کارن د دې برېښنالیک سره تړلی دی:\n\n$2\n\n{{PLURAL:$3|دا یو لنډمهاله پاسورډ دی|دا شفرونه لنډمهاله دي}} وروسته تر {{PLURAL:$5|یوه ورځ|$5 ورځی}} به باطل شي.\nتاسو باید اوس ننوځئ او نوي شفرونه غوره کړئ. که تاسو فکر کوئ چې بل چا دا غوښتنه کړې ده یا که تاسو خپل اصلي پټنوم په یاد ولرئ او تاسو نور یې نه غواړئ بدلون ومومئ، تاسو کولی شئ دا پیغام غفلت کړئ او خپل پخوانی پاسورډ کارولو ته دوام ورکړئ.",
+       "passwordreset-emailtext-user": "یک نفر (شاید تاسو، دآی‌پی پتی سره$1) د خپل پټنوم بیا سمولو لپاره غوښتنه{{SITENAME}} ($4) کړی ده. {{PLURAL:$3|ګڼون|ګڼونونه}} لاندې کارن د دې برېښنالیک سره تړلی دی:\n\n$2\n\n{{PLURAL:$3|دا یو لنډمهاله پاسورډ دی|دا شفرونه لنډمهاله دي}} وروسته تر {{PLURAL:$5|یوه ورځ|$5 ورځی}} به باطل شي.\nتاسو باید اوس ننوځئ او نوي شفرونه غوره کړئ. که تاسو فکر کوئ چې بل چا دا غوښتنه کړې ده یا که تاسو خپل اصلي پټنوم په یاد ولرئ او تاسو نور یې نه غواړئ بدلون ومومئ، تاسو کولی شئ دا پیغام غفلت کړئ او خپل پخوانی پاسورډ کارولو ته دوام ورکړئ.",
        "passwordreset-emailelement": "کارن-نوم: \n$1\n\nلنډمهاله پټنوم: \n$2",
        "passwordreset-emailsentemail": "د پټنوم بيا پرځای کېدنې لپاره برېښليک درولېږل شو.",
+       "passwordreset-emailsentusername": "که د دې کارن-نوم سره یو بریښنالیک پته شتون ولري نو بیا به د پاسورډ ری سیټ ای میل ته واستول شي.",
+       "passwordreset-nocaller": "يو اواز باید ورکړل شي",
+       "passwordreset-nosuchcaller": "کالر شتون نلري: $1",
+       "passwordreset-ignored": "د شفر بیاچالان سم نه و. کیدای شي کوم برابرونکي ترتیب نه وي؟",
        "passwordreset-invalidemail": "ناسمه برېښليک پته",
+       "passwordreset-nodata": "نه هم یو کاروونکي نوم او نه بریښنالیک پته ورکړل شوی",
        "changeemail": "برېښليک پته بدلول يا ليرې کول",
-       "changeemail-header": "د Ú¯Ú¼Ù\88Ù\86 Ø¨Ø±Û\90Ú\9aÙ\84Ù\8aÚ© Ù¾ØªÙ\87 Ø¨Ø¯Ù\84Ù\88Ù\84",
+       "changeemail-header": "د Ú¯Ú¼Ù\88Ù\86 Ø¯ Ø¨Ø±Û\90Ú\9aÙ\86اÙ\84Ù\8aÚ© Ø¨Ø¯Ù\84Ù\88Ù\84Ù\88 Ù\84پارÙ\87 Ø¯Ø§ Ù¾Ù\88رÙ\85 Ù¾Ù\88رÙ\87 Ú©Ú\93Ù\8a. Ú©Ù\87 ØªØ§Ø³Ù\88 ØºÙ\88اÚ\93ئ Ø¯ Ø®Ù¾Ù\84 Ù\87ر Ú\89Ù\88Ù\84 Ø­Ø³Ø§Ø¨ Ú\85Ø®Ù\87 Ø¯ Ø¨Ø±Û\8cÚ\9aÙ\86اÙ\84Ù\8aÚ© Ù¾ØªÙ\87 Ù\84رÛ\90 Ú©Ú\93Ù\8aØ\8c Ù\86Ù\88 Ø¯ Ø¨Ø±Ù\8aÚ\9aÙ\86اÙ\84Ù\8aÚ© Ú\81اÙ\8a Ù\85Ù\88 Ø¯ Ù¾Ù\88رÙ\85 Ø³Ù¾Ø§Ø±Ù\86Û\90 Ù¾Ù\87 Ù\88خت Ú©Û\90 Ø®Ø§Ù\84Ù\8a Ù¾Ø±Ù\8aÚ\96دÙ\8a.",
        "changeemail-no-info": "دې مخ ته د لاسرسي لپاره بايد غونډال کې ورننوځۍ.",
        "changeemail-oldemail": "اوسنۍ برېښليک پته:",
        "changeemail-newemail": "نوې برېښليک پته:",
+       "changeemail-newemail-help": "که تاسو غواړئ خپل بریښنالیک لرې کړئ نو دا ساحه باید پریښودل شي. تاسو به د هیر شوي شفر بیاپټولو توان نه لرئ او د دې ويکي نه بریښنالیکونه به مو ترلاسه نکړئ که چیرې مو برېښناليک لرې کړای شو.",
        "changeemail-none": "(هېڅ)",
        "changeemail-password": "ستاسې د{{SITENAME}} پټنوم:",
        "changeemail-submit": "برېښليک بدلول",
        "changeemail-throttled": "تاسې څو واره هڅه کړې چې غونډال ته ورننوځۍ.\nلطفاً د بيا هڅې نه مخکې $1 شېبې تم شۍ.",
+       "changeemail-nochange": "مهرباني وکړئ یو بل نوی برېښناليک پته ولیکئ.",
+       "resettokens": "د ټوکنونو بیاکتنه",
+       "resettokens-text": "تاسو کولی شئ  ټوکنونه بیا ځای پرځای کړئ کوم چې دلته ستاسو د حساب سره تړلی ځینې مشخصو معلوماتو ته دلا سرسۍ اجازه ورکوي.\n\nتاسو باید دا کار وکړئ که چیرې تاسو په ناڅاپي توګه له چا سره شریک کړي یا ستاسو حساب ورسره موافق وي.",
        "resettokens-tokens": "ټوکنونه:",
        "resettokens-token-label": "$1 (اوسنی ارزښت: $2)",
        "resettokens-done": "د رایو بیا راګرځول.",
        "newarticletext": "تاسې د يوې داسې تړنې څارنه کړې چې لا تر اوسه پورې نه شته.\nکه همدا مخ ليکل غواړۍ، نو په لانديني چوکاټ کې خپل متن وټاپئ (د لا نورو مالوماتو لپاره د [$1 لارښود مخ] وگورئ).\nکه چېرته تاسې دلته په تېروتنه راغلي ياست، نو يواځې د خپل د کتنمل '''مخ پر شا''' تڼۍ مو وټوکئ.",
        "anontalkpagetext": "----''دا د يوه ورکنومي کارن چې کارن-نوم نه لري او يا خپل کارن-نوم نه کاروي، د سکالو يوه پاڼه ده. نو د يوه کس د پېژندلو پخاطر موږ د هماغه کارن د انټرنېټ شمېره يا IP پته دلته ثبتوؤ. داسې يوه IP پته د ډېرو کارنانو لخوا هم کارېدلی شي. که تاسې يو ورکنومی کارن ياست او تاسې ته دا څرگندېږي چې تاسې ته نااړونده پېغامونه او تبصرې اشاره شوي، نو د نورو بې نومو کارنانو او ستاسې ترمېنځ د ټکنتوب د مخ نيونې لپاره لطفاً [[Special:CreateAccount|يو گڼون جوړ کړۍ]] او يا هم [[Special:UserLogin|غونډال ته ورننوځۍ]].''",
        "noarticletext": "دم مهال په دې مخ کې څه نشته.\nتاسې کولای شی چې په نورو مخونو کې [[Special:Search/{{PAGENAME}}|د دې مخ د سرليک پلټنه]]،\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} د اړوندو يادښتونو پلټنه] ،\nاو يا [{{fullurl:{{FULLPAGENAME}}|action=edit}} همدا مخ جوړ کړئ]</span>.",
-       "noarticletext-nopermission": "دم مهال په دې مخ کې متن نشته.\nتاسې کولای شی چې [[Special:Search/{{PAGENAME}}|همدا سرليک په نورو مخونو کې وپلټۍ]], يا هم <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} اړونده يادښتونه وپلټۍ]</span>، خو تاسې د دې مخ د جوړولو اجازه نه لرۍ.",
+       "noarticletext-nopermission": "دم مهال په دې مخ کې متن نشته.\nتاسې کولای شی چې [[Special:Search/{{PAGENAME}}|همدا سرليک په نورو مخونو کې وپلټۍ]]، يا هم <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} اړونده يادښتونه وپلټۍ]</span>، خو تاسې د دې مخ د جوړولو اجازه نه لرۍ.",
        "userpage-userdoesnotexist": "د \"<nowiki>$1</nowiki>\" گڼون نه دی ثبت شوی.\nلطفاً ځان ډاډه کړئ چې آيا تاسې په رښتيا همدا مخ جوړول/سمول غواړئ.",
        "userpage-userdoesnotexist-view": "د \"$1\" گڼون نه دی ثبت شوی.",
        "blocked-notice-logextract": "دم مهال په دې کارن بنديز لگېدلی.\nد بنديز يادښت تازه مالومات په لاندې توگه دي:",
        "longpageerror": "'''تېروتنه: کوم متن چې مو ليکلی {{PLURAL:$1|يو کيلوبايټه|$1 کيلوبايټه}} اوږد دی، چې دا پخپله د حد اکثر نه {{PLURAL:$2|يو کيلوبايټه|$2 کيلوبايټه}} اوږد دی.'''\nستاسې متن نه شي خوندي کېدلای.",
        "protectedpagewarning": "'''گواښنه: همدا مخ تړل شوی او يوازې هغه کارنان په دې مخ کې بدلونونه راوستلای شي چې د پازوالۍ د آسانتياوو نه برخمن دي.'''\nستاسې د مالوماتو لپاره د وروستني يادښت متن دلته په دې توگه راوړل شوی:",
        "semiprotectedpagewarning": "'''پاملرنه:''' دا مخ تړل شوی او يواځې ثبت شوي کارنان کولای شي چې په دې مخ کې بدلونونه راولي.\nستاسې د مالوماتو لپاره د وروستني يادښت متن دلته په دې توگه راوړل شوی:",
-       "cascadeprotectedwarning": "'''گواښنه:''' همدا مخ تړل شوی دی او يوازې هغه کارنان په دې مخ کې بدلونونه راوستلای شي چې د پازوالۍ د آسانتياوو نه برخمن دي، دا په دې خاطر چې همدا مخ د {{PLURAL:$1|لانديني مخ|لاندينيو مخونو}} په ځوړاوبيزې ژغورنې کې ورگډ دی:",
+       "cascadeprotectedwarning": "'''گواښنه:''' همدا مخ تړل شوی دی او يوازې هغه کارنان په دې مخ کې بدلونونه راوستلای شي چې د [[Special:ListGroupRights|د پازوالۍ د آسانتياوو]] نه برخمن دي، دا په دې خاطر چې همدا مخ د {{PLURAL:$1|لانديني مخ|لاندينيو مخونو}} په ځوړاوبيزې ژغورنې کې ورگډ دی:",
        "titleprotectedwarning": "'''گواښنه: همدا مخ تړل شوی دی او د دې د جوړولو لپاره تاسې ته د [[Special:ListGroupRights|ځانگړو رښتو]] د ترلاسه کولو اړتيا ده.'''\nستاسې د مالوماتو لپاره د وروستني يادښت متن دلته په دې توگه راوړل شوی:",
        "templatesused": "په دې مخ کارېدلې {{PLURAL:$1|کينډۍ|کينډۍ}}:",
        "templatesusedpreview": "يه دې مخليدنه کارېدلې {{PLURAL:$1|کينډۍ|کينډۍ}}:",
        "history-feed-description": "ددي مخ د بياکتنې تاريخ په ويکي کي",
        "history-feed-item-nocomment": "$1 په $2",
        "history-feed-empty": "ستاسې غوښتلی مخ نه شته.\nکېدای شي چې دا له ويکي نه ړنگ شوی وي، او يا هم په بل نوم بدل شوی وي.\nتاسې په دې ويکي د اړوندو نوؤ مخونو لپاره [[Special:Search|د پلټنې هڅه وکړۍ]].",
+       "history-edit-tags": "د غوره بڼې سمول نښانونه",
        "rev-deleted-comment": "(د سمون لنډيز لرې شو)",
        "rev-deleted-user": "(کارن-نوم ليري شوی)",
+       "rev-deleted-event": "(د ننوتنې مالومات ړنګ شوي)",
+       "rev-deleted-user-contribs": "[د کارن-نوم یا ای پی پته لرې کړه - له مرستو څخه پټ شوی ترمیم]",
        "rev-deleted-text-permission": "د دې مخ بڼه <strong>ړنگه شوه</strong>.\nد دې مخ اړونده تفصيل په [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} ړنگون يادښت] کې موندلی شی.",
+       "rev-suppressed-text-permission": "د دې مخ بڼه <strong>ړنگه شوه</strong>.\nد دې مخ اړونده تفصيل په [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} ړنگون يادښت] کې موندلی شی.",
+       "rev-suppressed-text-unhide": "د دې مخ بیاکتنه روانه <strong>ماتول ده</strong>.\nتفصيلات په دې ځای کې موندل کيداى شي[{{fullurl:{{#Special:Log}}/suppress|page={{FULLPAGENAMEE}}}} د ماتولو يادښت].\nتاسو لا هم کولی شئ [$1 دا بیاکتنه وګورئ] که تاسو غواړئ چې پرمخ بوځي.",
+       "rev-deleted-text-view": "ددې مخ سمون ''' ړنګ شوی '''.\nتاسو کولی شئ دا وګورئ؛ دا کېدای شي اړوند معلومات [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}}ړنګ شوی] په کې شامل وي.",
+       "rev-suppressed-text-view": "د دې مخ بڼه <strong>ړنگه شوه</strong>.\nد دې مخ اړونده تفصيل په [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} ړنگون يادښت] کې موندلی شی.",
+       "rev-deleted-no-diff": "د دې مخ بڼه <strong>ړنگه شوه</strong>.\nد دې مخ اړونده تفصيل په [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} ړنگون يادښت] کې موندلی شی.",
+       "rev-suppressed-no-diff": "تاسو دا توپیر نه شو لیدلی ځکه چې د بیاکتنې څخه یو یې <strong>ړنګ شویدی</strong>.",
+       "rev-deleted-unhide-diff": "د دې مخ بیاکتنه روانه <strong>ماتول ده</strong>.\nتفصيلات په دې ځای کې موندل کيداى شي[{{fullurl:{{#Special:Log}}/suppress|page={{FULLPAGENAMEE}}}} د ماتولو يادښت].\nتاسو لا هم کولی شئ [$1 دا بیاکتنه وګورئ] که تاسو غواړئ چې پرمخ بوځي.",
+       "rev-suppressed-unhide-diff": "د دې مخ بیاکتنه روانه <strong>ماتول ده</strong>.\nتفصيلات په دې ځای کې موندل کيداى شي[{{fullurl:{{#Special:Log}}/suppress|page={{FULLPAGENAMEE}}}} د ماتولو يادښت].\nتاسو لا هم کولی شئ [$1 دا بیاکتنه وګورئ] که تاسو غواړئ چې پرمخ بوځي.",
+       "rev-deleted-diff-view": "ددې مخ سمون ''' ړنګ شوی '''.\nتاسو کولی شئ دا وګورئ؛ دا کېدای شي اړوند معلومات [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}}ړنګ شوی] په کې شامل وي.",
+       "rev-suppressed-diff-view": "د دې مخ بڼه <strong>ړنگه شوه</strong>.\nد دې مخ اړونده تفصيل په [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} ړنگون يادښت] کې موندلی شی.",
        "rev-delundel": "ښکارېدنه بدلول",
        "rev-showdeleted": "ښکاره کول",
        "revisiondelete": "د ړنگولو/ناړنگولو مخکتنې",
        "revdelete-nooldid-title": "ناباوره پيښنليک ته اشاره",
+       "revdelete-nooldid-text": "تاسو یا د کوم هدف بیا کتنه نده مشخص کړې چې دا فعالیت ترسره کړي، یا مشخص بیاکتنه شتون نلري، یا تاسو د اوسني بیاکتنې پټولو هڅه کوۍ.",
        "revdelete-no-file": "ځانگړې شوې دوتنه نشته.",
+       "revdelete-show-file-confirm": "ایا ته باوري یې چې دا دوتنه د خراب شوي څخه بیاکتنې ته واړوی\"<nowiki>$1</nowiki>\" له$2 په $3؟",
        "revdelete-show-file-submit": "هو",
        "revdelete-selected-text": "د [[:$2]] {{PLURAL:$1|ټاکلې بڼه|ټاکلې بڼې}}:",
        "revdelete-selected-file": "د [[:$2]] {{PLURAL:$1|ټاکلې دوتنې بڼه|ټاکلې دوتنې بڼې}}",
        "logdelete-selected": "{{PLURAL:$1|ټاکلي يادښت پېښه|ټاکلي يادښت پېښې}}:",
        "revdelete-text-text": "ړنگې شوې بڼې به لا تر اوسه پورې د مخ پېښليک کې ښکاري، خو د هغو ځينو برخو ته به عام خلک لاسرسی و نه لري.",
+       "revdelete-text-file": "ړنگې شوې بڼې به لا تر اوسه پورې د مخ پېښليک کې ښکاري، خو د هغو ځينو برخو ته به عام خلک لاسرسی و نه لري.",
+       "logdelete-text": "ړنگې شوې بڼې به لا تر اوسه پورې د مخ پېښليک کې ښکاري، خو د هغو ځينو برخو ته به عام خلک لاسرسی و نه لري.",
+       "revdelete-text-others": "نور پازوالان به لا هم د پټ راز محتوياتو ته لاسرسی ومومي او دا یې له منځه یوسي، مګر که نه بل ډول مشخص شوی.",
+       "revdelete-confirm": "لطفا دا تایید کړئ چې تاسو دا کار کول غواړئ، دا چې تاسو پایلې په پام کې لرئ او تاسو یې سره مطابقت کوئ[[{{MediaWiki:Policy-url}}|پالیسۍ]].",
        "revdelete-legend": "د ښکارېدنې محدوديتونه ټاکل",
        "revdelete-hide-text": "د مخکتنې متن",
        "revdelete-hide-image": "د دوتنې مېنځپانگه پټول",
        "userrights-user-editname": "يو کارن نوم ورکړئ:",
        "editusergroup": "{{GENDER:$1|کارن}} ډلې سمول",
        "editinguser": "د <strong>[[User:$1|$1]]</strong> {{GENDER:$1|کارن}} رښتې بدلول $2",
-       "userrights-editusergroup": "کارن ډلې سمول",
+       "userrights-editusergroup": "{{GENDER:$1|کارن}} ډلې سمول",
        "userrights-viewusergroup": "د{{GENDER:$1|کارن}} ګروپونه ښکاره کړي",
        "saveusergroups": "{{GENDER:$1|کارن}} ډلې خوندي کول",
        "userrights-groupsmember": "غړی د:",
        "action-userrights-interwiki": "په نورو ويکي گانو د کارنانو رښتې سمول",
        "action-siteadmin": "توکبنسټ کولپول يا نه کولپول",
        "action-sendemail": "برېښليکونه لېږل",
+       "action-editmyoptions": "خپل غوره توبونه سمول",
        "action-editmywatchlist": "خپل کتنلړ سمول",
        "action-viewmywatchlist": "خپل کتنلړ کتل",
        "action-viewmyprivateinfo": "خپل شخصي مالومات کتل",
        "rcfilters-savedqueries-add-new-title": "د امستنې اوسنۍ فيلټر خوندي کړي",
        "rcfilters-filterlist-title": "چاڼگران",
        "rcfilters-highlightmenu-title": "يو رنګ وټاکۍ",
+       "rcfilters-filter-user-experience-level-unregistered-label": "ناثبت",
        "rcfilters-filter-user-experience-level-newcomer-label": "نوي راغلي",
        "rcfilters-filter-user-experience-level-learner-label": "زده کوونکي",
-       "rcnotefrom": "دلته لاندې د <strong>$2</strong> څخه راپدېخوا پېښ شوي بدلونونه راغلي (تر <strong>$1</strong> پورې ښکاري).",
+       "rcnotefrom": "دلته لاندې د <strong>$3, $4</strong> (څخه <strong>$1</strong> {{PLURAL:$5|راپدېخوا پېښ شوي بدلونونه|ښکاري}}).",
        "rclistfrom": "نوي بدلونونه چې له $3، $2 څخه پيلېږي ښکاره کول",
        "rcshowhideminor": "وړې سمونې $1",
        "rcshowhideminor-show": "ښکاره کول",
        "recentchangeslinked-page": "د مخ نوم:",
        "recentchangeslinked-to": "د ورکړل شوي مخ پر ځای د اړونده تړلي مخونو بدلونونه ښکاره کول",
        "recentchanges-page-added-to-category": "[[:$1]] وېشنيزې کې ورگډ شو",
-       "recentchanges-page-added-to-category-bundled": "[[:$1]] او {{PLURAL:$2|يو مخ|$2 مخونه}} وېشنيزې کې ورگډ شول",
+       "recentchanges-page-added-to-category-bundled": "[[:$1]] له وېشنيزې وغورځول شول، [[Special:WhatLinksHere/$1|په نورو مخونو کې دا مخ موجود دی.]]",
        "recentchanges-page-removed-from-category": "[[:$1]] له وېشنيزې وغورځول شو",
-       "recentchanges-page-removed-from-category-bundled": "[[:$1]] او {{PLURAL:$2|يو مخ|$2 مخونه}} له وېشنيزې وغورځول شول",
+       "recentchanges-page-removed-from-category-bundled": "[[:$1]] له وېشنيزې وغورځول شول، [[Special:WhatLinksHere/$1|په نورو مخونو کې دا مخ موجود دی.]]",
        "autochange-username": "د مېډياويکي خپلکاره بدلون",
        "upload": "دوتنه پورته کول",
        "uploadbtn": "دوتنه پورته کول",
        "reuploaddesc": "پورته کېدنه ناگارل او بېرته د پورته کېدنې فورمې ته ورگرځېدل",
        "upload-tryagain": "د بدلون موندلې دوتنې څرگندونې سپارل",
+       "upload-tryagain-nostash": "د بیا رالېږل شوې دوتنې وړاندې کول او تعدیل شوی بیان وړاندې کړئ",
        "uploadnologin": "غونډال کې نه ياست ننوتي",
        "uploadnologintext": "د دوتنې پورته کولو لپاره بايد $1",
        "uploaderror": "د پورته کولو ستونزه",
        "upload-form-label-infoform-categories": "وېشنيزې",
        "upload-form-label-infoform-date": "نېټه",
        "backend-fail-notexists": "د $1 په نوم دوتنه نشته.",
+       "backend-fail-invalidpath": "\"$1\" د اعتبار وړ لاره نه ده.",
        "backend-fail-delete": "د \"$1\" دوتنه ړنګه نه شوه.",
+       "backend-fail-describe": "د $1 دوتنې لپاره مېټاډاټا نشو بدلولی",
        "backend-fail-alreadyexists": "د $1 دوتنه له پخوا نه شته.",
        "backend-fail-store": "په \"$2\" باندې د \"$1\" دوتنه نه زېرمل کېږي.",
        "backend-fail-copy": "د \"$1\" دوتنه و \"$2\" ته نه لمېسل کېږي.",
        "sharedupload": "دا دوتنه د $1 لخوا څخه ده او کېدای شي چې نورې پروژې به يې هم کاروي.",
        "sharedupload-desc-there": "دا دوتنه د $1 څخه ده او کېدای شي چې په نورو پروژو به هم کارېږي.\nد نورو مالوماتو لپاره لطفاً [د $2 دوتنې د څرگندونو مخ] وگورئ.",
        "sharedupload-desc-here": "دا دوتنه د $1 لخوا خپرېږې او کېدای شي چې دا په نورو پروژو هم کارېدلې وي.\nد دوتنې د کارېدنې لا نور مالومات د [$2 دوتنې د څرگندنو په مخ] کې لاندې ښودل شوی.",
+       "sharedupload-desc-edit": "دا دوتنه د $1 لخوا خپرېږې او کېدای شي چې دا په نورو پروژو هم کارېدلې وي.\nکېدای شي تاسو به غواړئ چې څرگندونې يې د دې دوتنې [د $2 دوتنې د څرگندنو په مخ] کې سمې کړئ.",
        "sharedupload-desc-create": "دا دوتنه د $1 لخوا خپرېږې او کېدای شي چې دا په نورو پروژو هم کارېدلې وي.\nکېدای شي تاسو به غواړئ چې څرگندونې يې د دې دوتنې [د $2 دوتنې د څرگندنو په مخ] کې سمې کړئ.",
        "filepage-nofile": "په دې نوم کومه دوتنه نشته.",
        "filepage-nofile-link": "په دې نوم کومه دوتنه نشته، خو تاسې يې [$1 پورته کولی شی].",
        "fewestrevisions": "لږ مخليدل شوي مخونه",
        "nbytes": "$1 {{PLURAL:$1|بايټ|بايټونه}}",
        "ncategories": "$1 {{PLURAL:$1|وېشنيزه|وېشنيزې}}",
-       "ninterwikis": "$1 {{PLURAL:$1|ويکي خپلمنځي|ويکي خپلمنځي}}",
+       "ninterwikis": "$1 {{PLURAL:$1|انټرویکی|انټرویکی}}",
        "nlinks": "$1 {{PLURAL:$1|تړنه|تړنې}}",
        "nmembers": "$1 {{PLURAL:$1|غړی|غړي}}",
        "nmemberschanged": "$1 → $2 {{PLURAL:$2|غړی|غړي}}",
        "booksources-invalid-isbn": "دا ISBN چې تاسې ورکړی سم نه ښکاري؛ د تېروتنو لپاره د لمېسلو اصلي سرچينه وگورئ.",
        "magiclink-tracking-isbn": "مخونه د اي اس بي ان جادوګر لينکونو سره",
        "specialloguserlabel": "ترسره کوونکی:",
-       "speciallogtitlelabel": "موخه (سرليک يا کارن):",
+       "speciallogtitlelabel": "موخه (سرليک يا {{ns:user}}:کارن نوم د کارن لپاره):",
        "log": "يادښتونه",
        "logeventslist-submit": "ښکاره کول",
        "all-logs-page": "ټول عام يادښتونه",
        "addedwatchtext-short": "د \"$1\" مخ ستاسې کتنلړ کې ورگډ شو.",
        "removewatch": "له کتنلړ نه غورځول",
        "removedwatchtext": "د \"[[:$1]]\" مخ [[Special:Watchlist|ستاسې کتنلړ]] نه لرې شو.",
+       "removedwatchtext-talk": "د \"[[:$1]]\" په نوم يو مخ ستاسې [[Special:Watchlist|کتنلړ]] کې ورگډ شو.\nپه راتلونکې کې چې په دغه مخ او د دې د خبرواترو مخ کې کوم بدلونونه راځي نو هغه به ستاسې کتنلړ کې ښکاري.",
        "removedwatchtext-short": "د \"$1\" مخ ستاسې له کتنلړ څخه لرې شو.",
        "watch": "کتل",
        "watchthispage": "همدا مخ کتل",
        "wlshowhideanons": "ورکنومي کارنان",
        "wlshowhidepatr": "څارل شوي سمونونه",
        "wlshowhidemine": "زما سمونونه",
+       "wlshowhidecategorization": "د مخ وېشنيزې",
        "watchlist-options": "د کتنلړ خوښنې",
        "watching": "د کتلو په حال کې...",
        "unwatching": "د نه کتلو په حال کې...",
        "version-libraries-license": "منښتليک",
        "version-libraries-description": "څرگندونه",
        "version-libraries-authors": "ليکوالان",
-       "redirect": "ورگرځېدنې د دوتنې، کارن، مخ يا بڼې پېژند له مخې",
+       "redirect": "د دوتنې ورگرځېدنې، کارن، مخ يا بڼې پېژند له مخې",
        "redirect-summary": "دا ځانګړی مخ د یوې دوتنې (د فیلمین لخوا ورکړ شوی)، یو مخ (د بیاکتنې پیژند یا د پاڼې پېژندل شوی اي ډي)، د کاروونکي پاڼه (د شمېره کاروونکي اي ډي ورکړه)، او یا د ننوتلو ننوتل (د ننوتنې اي ډي ورکړل شوی). کارول:[[{{#Special:Redirect}}/file/Example.jpg]], [[{{#Special:Redirect}}/page/64308]], [[{{#Special:Redirect}}/revision/328429]], [[{{#Special:Redirect}}/user/101]], or [[{{#Special:Redirect}}/logid/186]].",
        "redirect-submit": "ورځه",
        "redirect-lookup": "وګوري:",
index 31a07bd..bf4a9a8 100644 (file)
        "rcfilters-savedqueries-apply-and-setdefault-label": "Criar filtro padrão",
        "rcfilters-savedqueries-cancel-label": "Cancelar",
        "rcfilters-savedqueries-add-new-title": "Gravar configurações atuais de filtros",
+       "rcfilters-savedqueries-already-saved": "Esses filtros já foram salvos",
        "rcfilters-restore-default-filters": "Restaurar filtros padrão",
        "rcfilters-clear-all-filters": "Limpar todos os filtros",
        "rcfilters-show-new-changes": "Veja as novas mudanças",
index 2583c81..2d18707 100644 (file)
        "rcfilters-filter-newpages-label": "လွင်ႈၵေႃႇသၢင်ႈ ၼႃႈလိၵ်ႈ",
        "rcfilters-filter-newpages-description": "မႄးထတ်း ဢၼ်ႁဵတ်းပဵၼ် ၼႃႈလိၵ်ႈဢၼ်မႂ်ႇ",
        "rcfilters-filter-categorization-label": "လႅၵ်ႈလၢႆႈ တွၼ်ႈၵၼ်",
+       "rcfilters-filtergroup-lastRevision": "ၵၢၼ်ၶူၼ်ႉၶႆႈ ၵမ်းလိုၼ်းသုတ်း",
+       "rcfilters-filter-lastrevision-label": "ၵၢၼ်ၶူၼ်ႉၶႆႈ ၵမ်းလိုၼ်းသုတ်း",
+       "rcfilters-filter-lastrevision-description": "ၸိူဝ်းဢၼ်မီးလွင်ႈလႅၵ်ႈလၢႆႈၸူး ၼႃႈလိၵ်ႈ ဢၼ်ပႆႇႁိုင်ၼၼ်ႉၵူၺ်း",
+       "rcfilters-filter-previousrevision-label": "ဢမ်ႇၸႂ်ႈၵၢၼ်ၶူၼ်ႉၶႆႈ ၵမ်းလိုၼ်းသုတ်း",
+       "rcfilters-filter-previousrevision-description": "ၸိူဝ်းလႅၵ်ႈလၢႆႈတင်းသဵင်ႈ ဢၼ်ဢမ်ႇၸႂ်ႈ \"လွင်ႈၶူၼ်ႉၶႆႈၵမ်းလိုၼ်းသုတ်း\"။",
        "rcnotefrom": "ၽၢႆႇတႂ်ႈ {{PLURAL:$5|ၼႆႉ ပဵၼ်လွင်ႈလႅၵ်ႈလၢႆႈ|ၸိူဝ်းၼႆႉ ပဵၼ်လွင်ႈလႅၵ်ႈလၢႆႈ}} ဝႆႉ ၸဵမ်မိူဝ်ႈ <strong>$3, $4</strong> (တေႃႇထိုင် <strong>$1</strong> ဢၼ်ၼႄဝႆႉ).",
        "rclistfrom": "ၼႄ လွင်ႈ​လႅၵ်ႈလၢႆႈဢၼ်မႂ်ႇ တႄႇတီႈ $2, $3",
        "rcshowhideminor": "$1 လွင်ႈမူၼ်ႉမႄး ဢိတ်းဢီႈ",
index 975bb87..ea77fe1 100644 (file)
@@ -71,6 +71,7 @@
        "tog-watchlisthideminor": "Сакриј мање измене са списка надгледања",
        "tog-watchlisthideliu": "Сакриј измене пријављених корисника са списка надгледања",
        "tog-watchlistreloadautomatically": "Аутоматски освежи списак надгледања кад год се филтер измени (потребан JavaScript)",
+       "tog-watchlistunwatchlinks": "Додај дугме за укључење/искључење надгледања свакој страни на списку надгледања (потребан Јаваскрипт за ефекат укључи/искључи)",
        "tog-watchlisthideanons": "Сакриј измене анонимних корисника са списка надгледања",
        "tog-watchlisthidepatrolled": "Сакриј патролиране измене са списка надгледања",
        "tog-watchlisthidecategorization": "Сакриј категоризацију страница",
        "anonpreviewwarning": "<em>Нисте пријављени. Ако објавите страницу, Ваша IP адреса ће бити јавно видљива у њеној историји измена и другде.</em>",
        "missingsummary": "'''Подсетник:''' Нисте унели опис измене.\nАко поново кликнете на „$1”, Ваша измена ће бити сачувана без описа.",
        "selfredirect": "<strong>Упозорење:</strong> Преусмеравате ову страницу на њу саму.\nМожда вам је одредишна страница за преусмерење погрешна или уређујете погрешну страницу.\nАко још једном притиснете „$1”, преусмерење ће свеједно бити направљено.",
-       "missingcommenttext": "УнеÑ\81иÑ\82е ÐºÐ¾Ð¼ÐµÐ½Ñ\82аÑ\80 Ð¸Ñ\81под.",
+       "missingcommenttext": "Ð\9cолимо Ñ\83неÑ\81иÑ\82е ÐºÐ¾Ð¼ÐµÐ½Ñ\82аÑ\80.",
        "missingcommentheader": "<strong>Напомена:</strong> Нисте унели наслов теме овог коментара.\nАко поново кликнете на „$1”, измена ће бити сачувана без наслова.",
        "summary-preview": "Преглед описа измене:",
        "subject-preview": "Преглед теме:",
        "page_last": "последња",
        "histlegend": "Избор разлика: изаберите кутијице измена за упоређивање и притисните ентер или дугме на дну.<br />\nОбјашњење: <strong>({{int:cur}})</strong> = разлика с тренутном изменом, <strong>({{int:last}})</strong> = разлика с претходном изменом, <strong>{{int:minoreditletter}}</strong> = мала измена",
        "history-fieldset-title": "Преглед измена",
-       "history-show-deleted": "Само обрисане измјене",
+       "history-show-deleted": "Само обрисане измене",
        "histfirst": "најстарије",
        "histlast": "најновије",
        "historysize": "({{PLURAL:$1|1 бајт|$1 бајта|$1 бајтова}})",
        "timezoneregion-europe": "Европа",
        "timezoneregion-indian": "Индијски океан",
        "timezoneregion-pacific": "Тихи океан",
-       "allowemail": "Омогући примање имејла од других корисника",
+       "allowemail": "Ð\9eмогÑ\83Ñ\9bи Ð¿Ñ\80имаÑ\9aе Ð¸Ð¼ÐµÑ\98лова Ð¾Ð´ Ð´Ñ\80Ñ\83гиÑ\85 ÐºÐ¾Ñ\80иÑ\81ника",
        "prefs-searchoptions": "Претрага",
        "prefs-namespaces": "Именски простори",
        "default": "подразумевано",
        "rcfilters-grouping-title": "Груписање",
        "rcfilters-activefilters": "Активни филтери",
        "rcfilters-advancedfilters": "Напредни филтери",
-       "rcfilters-limit-title": "Приказати измјена",
-       "rcfilters-limit-shownum": "Прикажи посљедњих $1 измјена",
+       "rcfilters-limit-title": "Приказати измена",
+       "rcfilters-limit-shownum": "Прикажи последњих $1 измена",
        "rcfilters-days-title": "Претходних неколико дана",
        "rcfilters-hours-title": "Претходних неколико сати",
        "rcfilters-days-show-days": "$1 {{PLURAL:$1|дан|дана}}",
        "rcfilters-days-show-hours": "$1 {{PLURAL:$1|сат|сата}}",
        "rcfilters-highlighted-filters-list": "Истакнуто: $1",
        "rcfilters-quickfilters": "Сачувани филтери",
-       "rcfilters-quickfilters-placeholder-title": "Ð\92езе Ñ\98оÑ\88 Ñ\83век Ð½Ð¸Ñ\81Ñ\83 Ñ\83памÑ\9bене",
-       "rcfilters-quickfilters-placeholder-description": "Ð\94а Ð±Ð¸Ñ\81Ñ\82е Ñ\81аÑ\87Ñ\83вали Ñ\81воÑ\98а Ð¿Ð¾Ð´ÐµÑ\88аваÑ\9aа Ñ\84илÑ\82еÑ\80а Ð¸ Ñ\83поÑ\82Ñ\80ебÑ\99авали Ð¸Ñ\85 ÐºÐ°Ñ\81ниÑ\98е, ÐºÐ»Ð¸ÐºÐ½Ð¸Ñ\82е Ð½Ð° Ð±Ñ\83кмаÑ\80к Ð¸ÐºÐ¾Ð½Ñ\83 Ñ\83 Ð¿Ð¾Ð´Ñ\80Ñ\83Ñ\87Ñ\98Ñ\83 Ð\90кÑ\82ивни Ñ\84илÑ\82еÑ\80и, испод.",
+       "rcfilters-quickfilters-placeholder-title": "Ð\88оÑ\88 Ñ\83век Ð½ÐµÐ¼Ð° Ñ\83памÑ\9bениÑ\85 Ñ\84илÑ\82еÑ\80а",
+       "rcfilters-quickfilters-placeholder-description": "Ð\94а Ð±Ð¸Ñ\81Ñ\82е Ñ\81аÑ\87Ñ\83вали Ñ\81воÑ\98а Ð¿Ð¾Ð´ÐµÑ\88аваÑ\9aа Ñ\84илÑ\82еÑ\80а Ð¸ Ñ\83поÑ\82Ñ\80ебÑ\99авали Ð¸Ñ\85 ÐºÐ°Ñ\81ниÑ\98е, ÐºÐ»Ð¸ÐºÐ½Ð¸Ñ\82е Ð½Ð° Ð¸ÐºÐ¾Ð½Ñ\83 Ð·Ð° Ð¾Ð·Ð½Ð°ÐºÑ\83 Ñ\83 Ð¿Ð¾Ð´Ñ\80Ñ\83Ñ\87Ñ\98Ñ\83 Ð°ÐºÑ\82ивниÑ\85 Ñ\84илÑ\82еÑ\80а, испод.",
        "rcfilters-savedqueries-defaultlabel": "Сачувани филтери",
        "rcfilters-savedqueries-rename": "Преименуј",
        "rcfilters-savedqueries-setdefault": "Постави као подразумевано",
        "rcfilters-savedqueries-apply-and-setdefault-label": "Направи подразумевани филтер",
        "rcfilters-savedqueries-cancel-label": "Откажи",
        "rcfilters-savedqueries-add-new-title": "Сачувај тренутне поставке филтера",
+       "rcfilters-savedqueries-already-saved": "Ови филтери су већ упамћени",
        "rcfilters-restore-default-filters": "Враћање подразумеваних филтера",
        "rcfilters-clear-all-filters": "Уклони све филтере",
        "rcfilters-show-new-changes": "Погледајте најновије измене",
-       "rcfilters-search-placeholder": "Филтер скорашњих измјена (претражите или почните куцати)",
+       "rcfilters-search-placeholder": "Филтрирај скорашње измене (употребите мени или потражите име филтра)",
        "rcfilters-invalid-filter": "Невалидан филтер",
        "rcfilters-empty-filter": "Нема активних филтера. Сви доприноси су приказани.",
        "rcfilters-filterlist-title": "Филтери",
        "rcfilters-filterlist-whatsthis": "Како ово функционише?",
-       "rcfilters-filterlist-feedbacklink": "Дајте повратне информације о новим (бета) филтерима",
+       "rcfilters-filterlist-feedbacklink": "Дајте повратне информације о новим (бета) алатима за филтрирање",
        "rcfilters-highlightbutton-title": "Истакни резултате",
        "rcfilters-highlightmenu-title": "Одабери боју",
        "rcfilters-highlightmenu-help": "Изаберите боју да бисте истакнули ово својство",
        "rcfilters-state-message-subset": "Овај филтер нема ефекта јер су његови резултати укључени са онима {{PLURAL:$2|следећег, ширег филтера|следећих, ширих филтера}} (покушајте са означавањем да бисте их распознали): $1",
        "rcfilters-state-message-fullcoverage": "Одабир свих филтера у групи је исто као и одабир ниједног, тако да овај филтер нема ефекта. Група укључује: $1",
        "rcfilters-filtergroup-authorship": "Ауторство доприноса",
-       "rcfilters-filter-editsbyself-label": "Ваше измјене",
+       "rcfilters-filter-editsbyself-label": "Ваше измене",
        "rcfilters-filter-editsbyself-description": "Ваши доприноси.",
-       "rcfilters-filter-editsbyother-label": "Измјене других",
-       "rcfilters-filter-editsbyother-description": "Све измјене осим Ваших.",
+       "rcfilters-filter-editsbyother-label": "Измене других",
+       "rcfilters-filter-editsbyother-description": "Све измене осим Ваших.",
        "rcfilters-filtergroup-userExpLevel": "Корисничка регистрација и искуство",
        "rcfilters-filter-user-experience-level-registered-label": "Регистровани",
        "rcfilters-filter-user-experience-level-registered-description": "Пријављени уредници.",
        "rcfilters-filter-user-experience-level-unregistered-label": "Нерегистровани",
        "rcfilters-filter-user-experience-level-unregistered-description": "Уредници који нису пријављени.",
        "rcfilters-filter-user-experience-level-newcomer-label": "Новајлије",
-       "rcfilters-filter-user-experience-level-newcomer-description": "Регистровани уредници са мање од 10 измјена и 4 дана активности.",
+       "rcfilters-filter-user-experience-level-newcomer-description": "Регистровани уредници са мање од 10 измена и 4 дана активности.",
        "rcfilters-filter-user-experience-level-learner-label": "Ученици",
        "rcfilters-filter-user-experience-level-learner-description": "Регистровани уредници са више искуства од „новајлија”, али мање од „искусних корисника”.",
        "rcfilters-filter-user-experience-level-experienced-label": "Искусни корисници",
-       "rcfilters-filter-user-experience-level-experienced-description": "Регистровани уредници са више од 500 измјена и 30 дана активности.",
+       "rcfilters-filter-user-experience-level-experienced-description": "Регистровани уредници са више од 500 измена и 30 дана активности.",
        "rcfilters-filtergroup-automated": "Аутоматизовани доприноси",
        "rcfilters-filter-bots-label": "Бот",
-       "rcfilters-filter-bots-description": "Измјене направљене аутоматизованим алатима.",
-       "rcfilters-filter-humans-label": "Човјек (није бот)",
-       "rcfilters-filter-humans-description": "Измјене које су направили људи-уредници.",
+       "rcfilters-filter-bots-description": "Измене направљене аутоматизованим алатима.",
+       "rcfilters-filter-humans-label": "Човек (није бот)",
+       "rcfilters-filter-humans-description": "Измене које су направили људи-уредници.",
        "rcfilters-filtergroup-reviewstatus": "Патролираност",
        "rcfilters-filter-patrolled-label": "Патролирано",
-       "rcfilters-filter-patrolled-description": "Измјене означене као патролиране.",
+       "rcfilters-filter-patrolled-description": "Измене означене као патролиране.",
        "rcfilters-filter-unpatrolled-label": "Непатролирано",
-       "rcfilters-filter-unpatrolled-description": "Измјене које нису означене као патролиране.",
+       "rcfilters-filter-unpatrolled-description": "Измене које нису означене као патролиране.",
        "rcfilters-filtergroup-significance": "Значај",
-       "rcfilters-filter-minor-label": "Мање измјене",
-       "rcfilters-filter-minor-description": "Измјене које је аутор означио као мање.",
-       "rcfilters-filter-major-label": "Не-мање измјене",
-       "rcfilters-filter-major-description": "Измјене које нису означене као мање.",
+       "rcfilters-filter-minor-label": "Мање измене",
+       "rcfilters-filter-minor-description": "Измене које је аутор означио као мање.",
+       "rcfilters-filter-major-label": "Не-мање измене",
+       "rcfilters-filter-major-description": "Измене које нису означене као мање.",
        "rcfilters-filtergroup-watchlist": "Странице на списку надгледања",
        "rcfilters-filter-watchlist-watched-label": "На списку надгледања",
-       "rcfilters-filter-watchlist-watched-description": "Измјене страница на Вашем списку надгледања",
-       "rcfilters-filter-watchlist-watchednew-label": "Нове измјене на списку надгледања",
-       "rcfilters-filter-watchlist-watchednew-description": "Измјене страница на списку надгледања које нисте посјетили од када су направљене измјене.",
+       "rcfilters-filter-watchlist-watched-description": "Измене страница на Вашем списку надгледања.",
+       "rcfilters-filter-watchlist-watchednew-label": "Нове измене на списку надгледања",
+       "rcfilters-filter-watchlist-watchednew-description": "Измене страница на списку надгледања које нисте посетили од када су направљене измене.",
        "rcfilters-filter-watchlist-notwatched-label": "Није на списку надгледања",
-       "rcfilters-filter-watchlist-notwatched-description": "Све осим измјена страница на Вашем списку надгледања.",
-       "rcfilters-filtergroup-changetype": "Тип измјене",
-       "rcfilters-filter-pageedits-label": "Измјене страница",
-       "rcfilters-filter-pageedits-description": "Измјене вики садржаја, расправа, описа категорија…",
+       "rcfilters-filter-watchlist-notwatched-description": "Све осим измена страница на Вашем списку надгледања.",
+       "rcfilters-filtergroup-watchlistactivity": "Стање на списку надгледања",
+       "rcfilters-filter-watchlistactivity-unseen-label": "Непогледане измене",
+       "rcfilters-filter-watchlistactivity-unseen-description": "Измене страница које нисте посетили од када су направљене измене.",
+       "rcfilters-filter-watchlistactivity-seen-label": "Погледане измене",
+       "rcfilters-filter-watchlistactivity-seen-description": "Измене страница које сте посетили од када су направљене измене.",
+       "rcfilters-filtergroup-changetype": "Врста измене",
+       "rcfilters-filter-pageedits-label": "Измене страница",
+       "rcfilters-filter-pageedits-description": "Измене вики садржаја, расправа, описа категорија…",
        "rcfilters-filter-newpages-label": "Стварање страница",
-       "rcfilters-filter-newpages-description": "Измјене којима се стварају нове странице.",
-       "rcfilters-filter-categorization-label": "Измјене категорија",
+       "rcfilters-filter-newpages-description": "Измене којима се стварају нове странице.",
+       "rcfilters-filter-categorization-label": "Измене категорија",
        "rcfilters-filter-categorization-description": "Записи о страницама додатим или уклоњеним из категорија.",
-       "rcfilters-filter-logactions-label": "РадÑ\9aе Ð·Ð°Ð±Ð¸Ñ\99ежене у дневницима",
+       "rcfilters-filter-logactions-label": "РадÑ\9aе Ð·Ð°Ð±ÐµÐ»ежене у дневницима",
        "rcfilters-filter-logactions-description": "Административне акције, стварање налога, брисање страница, отпремања…",
        "rcfilters-hideminor-conflicts-typeofchange-global": "Филтер за „мање” измене је у сукобу са једним или више филтера типа измена, зато што одређени типови измена не могу да се означе као „мање”. Сукобљени филтери су означени у подручју Активни филтери, изнад.",
        "rcfilters-hideminor-conflicts-typeofchange": "Одређени типови измена не могу да се означе као „мање”, тако да је овај филтер у сукобу са следећим филтерима типа измена: $1",
        "rcfilters-typeofchange-conflicts-hideminor": "Овај филтер типа измене је у сукобу са филтером за „мање” измене. Одређени типови измена не могу да се означе као „мање”.",
-       "rcfilters-filtergroup-lastRevision": "Посљедње измјене",
-       "rcfilters-filter-lastrevision-label": "Посљедња измјена",
+       "rcfilters-filtergroup-lastRevision": "Последње измене",
+       "rcfilters-filter-lastrevision-label": "Последња измена",
        "rcfilters-filter-lastrevision-description": "Само најновија измена на страници.",
-       "rcfilters-filter-previousrevision-label": "Није посљедња измјена",
-       "rcfilters-filter-previousrevision-description": "Све измјене које нису „посљедње измјене”.",
+       "rcfilters-filter-previousrevision-label": "Није последња измена",
+       "rcfilters-filter-previousrevision-description": "Све измене које нису „последње измене”.",
        "rcfilters-filter-excluded": "Изостављено",
        "rcfilters-tag-prefix-namespace-inverted": "<strong>:није</strong> $1",
        "rcfilters-exclude-button-off": "Изостави означено",
-       "rcfilters-view-tags": "Означене измјене",
+       "rcfilters-exclude-button-on": "Изостави одабрано",
+       "rcfilters-view-tags": "Означене измене",
        "rcfilters-view-namespaces-tooltip": "Филтер резултата према именском простору",
-       "rcfilters-view-tags-tooltip": "Филтер резултата према ознаци измјене",
-       "rcfilters-view-tags-help-icon-tooltip": "Сазнајте више о означеним измјенама",
+       "rcfilters-view-tags-tooltip": "Филтрирање резултата према ознаци измене",
+       "rcfilters-view-return-to-default-tooltip": "Повратак на главни мени",
+       "rcfilters-view-tags-help-icon-tooltip": "Сазнајте више о означеним изменама",
        "rcfilters-liveupdates-button": "Ажурирања уживо",
+       "rcfilters-liveupdates-button-title-on": "Искључи ажурирања уживо",
+       "rcfilters-liveupdates-button-title-off": "Прикажи нове измене уживо",
        "rcfilters-watchlist-markseen-button": "Означи све измене као виђене",
-       "rcfilters-watchlist-showupdated": "Промјене на страницама које нисте посјетили од када је измјена извршена су <strong>подебљане</strong>, са испуњеним ознакама.",
+       "rcfilters-watchlist-edit-watchlist-button": "Промените Вашу листу надгледаних страница",
+       "rcfilters-watchlist-showupdated": "Измене на страницама које нисте посетили од када је измена извршена су <strong>подебљане</strong>, са испуњеним ознакама.",
        "rcfilters-preference-label": "Сакриј побољшану верзију скорашњих измена",
        "rcfilters-preference-help": "Поништава редизајн интерфејса из 2017. и све алатке додате тада и после.",
        "rcnotefrom": "Испод {{PLURAL:$5|је измена|су измене}} од <strong>$3, $4</strong> (до <strong>$1</strong> приказано).",
        "undeleteviewlink": "погледај",
        "undeleteinvert": "Обрни избор",
        "undeletecomment": "Разлог:",
-       "cannotundelete": "Враћање једне или свих ставник није успјело:\n$1",
+       "cannotundelete": "Враћање једне или свих није успело:\n$1",
        "undeletedpage": "<strong>Страница $1 је враћена</strong>\n\nПогледајте [[Special:Log/delete|дневник брисања]] за записе о скорашњим брисањима и враћањима.",
        "undelete-header": "Погледајте [[Special:Log/delete|историјат брисања]] за недавно обрисане странице.",
        "undelete-search-title": "Претрага обрисаних страница",
        "pageinfo-robot-index": "Дозвољено",
        "pageinfo-robot-noindex": "Није дозвољено",
        "pageinfo-watchers": "Број надгледача странице",
-       "pageinfo-visiting-watchers": "Број надгледача странице који су посјетили скорашње измјене",
+       "pageinfo-visiting-watchers": "Број надгледача странице који су посетили скорашње измене",
        "pageinfo-few-watchers": "Мање од $1 {{PLURAL:$1|пратиоца|пратиоца|пратилаца}}",
        "pageinfo-redirects-name": "Број преусмерења на ову страницу",
        "pageinfo-subpages-name": "Подстранице ове странице",
        "tag-filter-submit": "Филтрирај",
        "tag-list-wrapper": "([[Special:Tags|$1 {{PLURAL:$1|ознака|ознаке|ознака}}]]: $2)",
        "tag-mw-contentmodelchange": "промена модела садржаја",
+       "tag-mw-contentmodelchange-description": "Измене које мењају модел садржаја странице",
        "tags-title": "Ознаке",
        "tags-intro": "На овој страници је наведен списак ознака с којима програм може да означи измене и његово значење.",
        "tags-tag": "Назив ознаке",
index c4e1368..01f2e83 100644 (file)
@@ -26,7 +26,8 @@
                        "Mega Aleksandar",
                        "Asmen",
                        "Obsuser",
-                       "Zoranzoki21"
+                       "Zoranzoki21",
+                       "Prevodim"
                ]
        },
        "tog-underline": "Podvlačenje veza:",
        "page_last": "poslednja",
        "histlegend": "Izbor razlika: izaberite kutijice izmena za upoređivanje i pritisnite enter ili dugme na dnu.<br />\nObjašnjenje: <strong>({{int:cur}})</strong> = razlika s trenutnom izmenom, <strong>({{int:last}})</strong> = razlika s prethodnom izmenom, <strong>{{int:minoreditletter}}</strong> = mala izmena",
        "history-fieldset-title": "Pregled izmena",
-       "history-show-deleted": "Samo obrisane",
+       "history-show-deleted": "Samo obrisane izmene",
        "histfirst": "najstarije",
        "histlast": "najnovije",
        "historysize": "({{PLURAL:$1|1 bajt|$1 bajta|$1 bajtova}})",
        "timezoneregion-europe": "Evropa",
        "timezoneregion-indian": "Indijski okean",
        "timezoneregion-pacific": "Tihi okean",
-       "allowemail": "Omogući primanje imejla od drugih korisnika",
+       "allowemail": "Omogući primanje imejlova od drugih korisnika",
        "prefs-searchoptions": "Pretraga",
        "prefs-namespaces": "Imenski prostori",
        "default": "podrazumevano",
        "rcfilters-other-review-tools": "Ostali alati za pregled:",
        "rcfilters-activefilters": "Aktivni filteri",
        "rcfilters-advancedfilters": "Napredni filteri",
-       "rcfilters-limit-title": "Prikazati izmjena",
+       "rcfilters-limit-title": "Prikazati izmena",
        "rcfilters-limit-shownum": "Prikaži posljednjih $1 izmjena",
        "rcfilters-days-show-days": "$1 {{PLURAL:$1|dana|dana}}",
        "rcfilters-days-show-hours": "$1 {{PLURAL:$1|sat|sata}}",
+       "rcfilters-quickfilters-placeholder-description": "Da biste sačuvali svoja podešavanja filtera i upotrebljavali ih kasnije, kliknite na ikonu za oznaku u području aktivnih filtera, ispod.",
        "rcfilters-search-placeholder": "Filter skorašnjih izmjena (pretražite ili počnite kucati)",
        "rcfilters-filtergroup-authorship": "Autorstvo doprinosa",
+       "rcfilters-filter-editsbyself-label": "Vaše izmene",
+       "rcfilters-filter-editsbyother-label": "Izmene drugih",
+       "rcfilters-filter-editsbyother-description": "Sve izmene osim Vaših.",
        "rcfilters-filter-user-experience-level-registered-label": "Registrovani",
        "rcfilters-filter-user-experience-level-registered-description": "Prijavljeni urednici.",
        "rcfilters-filter-user-experience-level-unregistered-label": "Neregistrovani",
        "rcfilters-filter-user-experience-level-learner-label": "Učenici",
        "rcfilters-filter-user-experience-level-learner-description": "Više dana aktivnosti i izmjena od „novajlija”, ali manje od „iskusnih korisnika”.",
        "rcfilters-filter-user-experience-level-experienced-label": "Iskusni korisnici",
-       "rcfilters-filter-user-experience-level-experienced-description": "Preko 30 dana aktivnosti i 500 izmjena.",
-       "rcfilters-filter-humans-label": "Čovjek (nije bot)",
+       "rcfilters-filter-user-experience-level-experienced-description": "Registrovani urednici sa više od 500 izmena i 30 dana aktivnosti.",
+       "rcfilters-filter-bots-description": "Izmene napravljene automatizovanim alatima.",
+       "rcfilters-filter-humans-label": "Čovek (nije bot)",
+       "rcfilters-filter-humans-description": "Izmene koje su napravili ljudi-urednici.",
        "rcfilters-filter-patrolled-label": "Patrolirano",
+       "rcfilters-filter-patrolled-description": "Izmene označene kao patrolirane.",
        "rcfilters-filter-unpatrolled-label": "Nepatrolirano",
-       "rcfilters-filter-minor-label": "Manje izmjene",
-       "rcfilters-filter-pageedits-label": "Izmjene stranica",
-       "rcfilters-filter-pageedits-description": "Izmjene viki sadržaja, rasprava, opisa kategorija...",
+       "rcfilters-filter-unpatrolled-description": "Izmene koje nisu označene kao patrolirane.",
+       "rcfilters-filter-minor-label": "Manje izmene",
+       "rcfilters-filter-minor-description": "Izmene koje je autor označio kao manje.",
+       "rcfilters-filter-major-label": "Ne-manje izmene",
+       "rcfilters-filter-major-description": "Izmene koje nisu označene kao manje.",
+       "rcfilters-filter-watchlist-watched-description": "Izmene stranica koje su na Vašem spisku nadgledanja.",
+       "rcfilters-filter-watchlist-watchednew-label": "Nove izmene na spisku nadgledanja",
+       "rcfilters-filter-watchlist-watchednew-description": "Izmene stranica na spisku nadgledanja koje niste posetili od kada su napravljene izmene.",
+       "rcfilters-filter-watchlist-notwatched-description": "Sve osim izmena stranica na Vašem spisku nadgledanja.",
+       "rcfilters-filtergroup-changetype": "Vrsta izmene",
+       "rcfilters-filter-pageedits-label": "Izmene stranica",
+       "rcfilters-filter-pageedits-description": "Izmene viki sadržaja, rasprava, opisa kategorija...",
        "rcfilters-filter-newpages-label": "Stvaranje stranica",
-       "rcfilters-filter-newpages-description": "Izmjene kojima se stvaraju nove stranice.",
-       "rcfilters-filter-logactions-label": "Radnje zabilježene u dnevnicima",
-       "rcfilters-view-advanced-filters-label": "Napredni filteri",
+       "rcfilters-filter-newpages-description": "Izmene kojima se stvaraju nove stranice.",
+       "rcfilters-filter-categorization-label": "Izmene kategorija",
+       "rcfilters-filter-logactions-label": "Radnje zabeležene u dnevnicima",
+       "rcfilters-filtergroup-lastRevision": "Poslednje izmene",
+       "rcfilters-filter-lastrevision-label": "Poslednja izmena",
+       "rcfilters-filter-previousrevision-label": "Nije poslednja izmena",
+       "rcfilters-filter-previousrevision-description": "Sve izmene koje nisu „poslednje izmene”.",
+       "rcfilters-view-tags": "Označene izmene",
        "rcfilters-view-namespaces-tooltip": "Filter rezultata prema imenskom prostoru",
-       "rcfilters-view-tags-tooltip": "Filter rezultata prema oznaci izmjene",
+       "rcfilters-view-tags-tooltip": "Filtriranje rezultata prema oznaci izmene",
+       "rcfilters-view-tags-help-icon-tooltip": "Saznajte više o označenim izmenama",
        "rcfilters-liveupdates-button": "Ažuriranja uživo",
        "rcfilters-watchlist-markseen-button": "Označi sve izmene kao viđene",
+       "rcfilters-watchlist-showupdated": "Izmene na stranicama koje niste posetili od kada je izmena izvršena su <strong>podebljane</strong>, sa ispunjenim oznakama.",
        "rcfilters-preference-label": "Sakrij poboljšanu verziju skorašnjih izmena",
        "rcfilters-preference-help": "Poništava redizajn interfejsa iz 2017. i sve alatke dodate tada i posle.",
        "rcnotefrom": "Ispod {{PLURAL:$5|je izmena|su izmene}} od <strong>$3, $4</strong> (do <strong>$1</strong> prikazano).",
        "undeleteviewlink": "pogledaj",
        "undeleteinvert": "Obrni izbor",
        "undeletecomment": "Razlog:",
-       "cannotundelete": "Vraćanje nije uspelo:\n$1",
+       "cannotundelete": "Vraćanje jedne ili svih nije uspelo:\n$1",
        "undeletedpage": "<strong>Stranica $1 je vraćena</strong>\n\nPogledajte [[Special:Log/delete|dnevnik brisanja]] za zapise o skorašnjim brisanjima i vraćanjima.",
        "undelete-header": "Pogledajte [[Special:Log/delete|istorijat brisanja]] za nedavno obrisane stranice.",
        "undelete-search-title": "Pretraga obrisanih stranica",
        "pageinfo-robot-index": "Dozvoljeno",
        "pageinfo-robot-noindex": "Nije dozvoljeno",
        "pageinfo-watchers": "Broj nadgledača stranicе",
-       "pageinfo-visiting-watchers": "Broj nadgledača stranice koji su posjetili skorašnje izmjene",
+       "pageinfo-visiting-watchers": "Broj nadgledača stranice koji su posetili skorašnje izmene",
        "pageinfo-few-watchers": "Manje od $1 {{PLURAL:$1|pratioca|pratilaca}}",
        "pageinfo-redirects-name": "Broj preusmerenja na ovu stranicu",
        "pageinfo-subpages-name": "Podstranice ove stranice",
        "tag-filter": "Filter za [[Special:Tags|oznake]]:",
        "tag-filter-submit": "Filtriraj",
        "tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1|Oznaka|Oznake}}]]: $2)",
+       "tag-mw-contentmodelchange-description": "Izmene koje menjaju model sadržaja stranice",
        "tags-title": "Oznake",
        "tags-intro": "Na ovoj stranici je naveden spisak oznaka s kojima program može da označi izmene i njegovo značenje.",
        "tags-tag": "Naziv oznake",
index 770ba73..762538a 100644 (file)
        "editundo": "bolaykeun",
        "diff-empty": "(taya bédana)",
        "diff-multi-sameuser": "({{PLURAL:$1|Hiji révisi antara|$1 révisi antara}} karya pamaké nu sarua henteu ditémbongkeun)",
+       "diff-multi-otherusers": "({{PLURAL:$1|Hiji révisi antara|$1 révisi antara}} karya leuwih ti {{PLURAL:$2|hiji pamaké|$2 pamaké}} teu ditémbongkeun)",
        "diff-multi-manyusers": "({{PLURAL:$1|Hiji révisi antara|$1 révisi antara}} karya leuwih ti {{PLURAL:$2|pamaké|pamaké}} teu ditémbongkeun)",
        "searchresults": "Hasil maluruh",
        "searchresults-title": "Hasil nyusud \"$1\"",
        "rcfilters-tag-prefix-namespace-inverted": "<strong>:lain</strong> $1",
        "rcfilters-exclude-button-off": "Iwalkeun nu dipilih",
        "rcfilters-exclude-button-on": "Teu kaasup nu dipilih",
-       "rcfilters-view-advanced-filters-label": "Panyaringan leuwih jero",
        "rcfilters-view-tags": "Éditan ditandaan",
        "rcfilters-view-namespaces-tooltip": "Saring hasil dumasar ngarangspasi",
        "rcfilters-view-tags-tooltip": "Saring hasil maké tag éditan",
        "rcfilters-view-return-to-default-tooltip": "Balik ka menu panyaringan utama",
+       "rcfilters-view-tags-help-icon-tooltip": "Teuleuman ngeunaan éditan maké tag",
        "rcfilters-liveupdates-button": "Parobahan langsung",
        "rcfilters-liveupdates-button-title-on": "Pareuman parobahan langsung",
        "rcfilters-liveupdates-button-title-off": "Témbongkeun parobahan anyar nalika éta parobahan prung",
        "uploadstash-refresh": "Nyegerken deui daptar berkas",
        "uploadstash-thumbnail": "tempo miniatur",
        "uploadstash-exception": "Teu bisa nyimpen unjalan di panyimpenan ($1): \"$2\".",
+       "uploadstash-bad-path": "Euweuh galur",
+       "uploadstash-bad-path-invalid": "Galur teu sah.",
+       "uploadstash-bad-path-unknown-type": "Jinis teu dipikanyaho \"$1\".",
+       "uploadstash-bad-path-unrecognized-thumb-name": "Ngaran liwatan teu dipakawawuh.",
+       "uploadstash-file-not-found-no-thumb": "Teu bisa nyomot tampilan saliwat.",
+       "uploadstash-no-extension": "Éksténsi nyamos.",
+       "uploadstash-zero-length": "Berkas mangrupa nol panjang.",
        "invalid-chunk-offset": "Opsét potongan teu valid",
        "img-auth-accessdenied": "Aksés ditolak",
        "img-auth-badtitle": "Teu bisa nyieun judul nu valid tina \"$1\".",
        "filehist-comment": "Kamandang",
        "imagelinks": "Pamakéan berkas",
        "linkstoimage": "Kaca ieu  {{PLURAL:$1|numbu|$1 numbu}} ka gambar ieu :",
+       "linkstoimage-more": "Leuwih ti $1 {{PLURAL:$1|kaca nutumbu|kaca nutumbu}} ka ieu berkas.\nBéréndélan di handap némbongkeun {{PLURAL:$1|tutumbu kaca kahiji|$1 tutumbu kaca}} ka ieu berkas hungkul.\n[[Special:WhatLinksHere/$2|Béréndélan lengkepna]] aya.",
        "nolinkstoimage": "Teu aya kaca anu nutumbu ka ieu berkas.",
        "morelinkstoimage": "Témbong [[Special:WhatLinksHere/$1|tutumbu lianna]] ka ieu berkas.",
        "linkstoimage-redirect": "$1 (pangalihan berkas) $2",
        "listusers-blocked": "(diblokir)",
        "activeusers": "Béréndélan pamaké nu getol",
        "activeusers-intro": "Ieu béréndélan kontributor anu geus ngoprék $1 {{PLURAL:$1|poé|poé}} panungtung.",
-       "activeusers-count": "$1 {{PLURAL:$1|aktivitas}} dina {{PLURAL:$3|1 hari|$3 hari}} panungtung",
+       "activeusers-count": "$1 {{PLURAL:$1|aktivitas}} dina {{PLURAL:$3|sapoé|$3 poé}} panungtung",
        "activeusers-from": "Témbongkeun kontributor dimimitian ku:",
        "activeusers-groups": "Témbongkeun pamaké nu kaasup gorombolan:",
        "activeusers-excludegroups": "Samunikeun pamaké nu kaasup gorombolan:",
        "ipb_cant_unblock": "Éror: ID peungpeuk $1 teu kapanggih. Sigana mah geus dibuka.",
        "ip_range_invalid": "Angka IP teu bener.",
        "ip_range_toolarge": "Panteng blok leuwih badag tibatan /$1 teu diheugbaékeun.",
+       "ip_range_toolow": "Panteng UP sacara éféktif teu diidinan.",
        "proxyblocker": "Pameungpeuk proxy",
        "proxyblockreason": "Alamat IP anjeun dipeungpeuk sabab mangrupa proxy muka. Mangga tepungan ''Internet service provider'' atanapi ''tech support'' anjeun, béjakeun masalah serius ieu.",
        "sorbsreason": "Alamat IP anjeun kadaptar salaku ''open proxy'' dina DNSBL anu dipaké ku {{SITENAME}}.",
        "logentry-protect-unprotect": "$1 {{GENDER:$2|mupus}} panangtayungan ti $3",
        "logentry-protect-protect": "$1 {{GENDER:$2|ditangtayungan}} $3 $4",
        "logentry-upload-upload": "$1 {{GENDER:$2|ngamuat}} $3",
+       "logentry-upload-overwrite": "$1 {{GENDER:$2|ngunggah}} $3 vérsi anyar",
        "logentry-upload-revert": "$1 {{GENDER:$2|diunjal}} $3",
        "log-name-managetags": "Log pangokolaan tag",
        "logentry-managetags-create": "$1 {{GENDER:$2|nyieun}} tag \"$4\"",
index fd51e98..b60268e 100644 (file)
@@ -34,7 +34,6 @@
        "underline-always": "Кезээде",
        "underline-never": "Кажан-даа",
        "underline-default": "Кештиң азы веб-браузерниң ниити үнези",
-       "editfont-default": "Веб-браузерниң ниити үнези",
        "sunday": "Улуг-хүн",
        "monday": "Бир дугаар хүн",
        "tuesday": "Ийи дугаар хүн",
@@ -94,7 +93,7 @@
        "hidden-category-category": "Чажыт бөлүктер",
        "category-subcat-count": "{{PLURAL:$2|1=Ук аңгылал чүгле дараазында иштики аңгылалдыг.|Ук аңгылалда бар-ла $2 иштики аңгылалдарның $1 иштики аңгылалы көстүп турар.}}",
        "category-subcat-count-limited": "Ук аңгылалда {{PLURAL:$1|1=бир|$1}} иштики аңгылал бар.",
-       "category-article-count": "{{PLURAL:$2|1=Ук аңгылалда чүгле чаңгыс арын бар.|Ук аңгылалда бар $2 арыннарының аразындан}} |{{PLURAL:$1 арынны көргүскен| $1 арыннарны көргүскен.}}",
+       "category-article-count": "{{PLURAL:$2|Ук аңгылалда чүгле чаңгыс арын бар.|Аңгылалда ниитизи-биле $2 арын бар. Мында чүгле {{PLURAL:$1|арын|$1 арын}} көргүскен}}",
        "category-file-count": "{{PLURAL:$2|1=Ук аңгылал чүгле чаңгыс файлдыг.|Ук аңгылалдың шупту $2 файлдарының аразындан $1 файлын көргүскен.}}",
        "listingcontinuesabbrev": "(уланчы)",
        "noindex-category": "Индекстелбес арынар",
        "anontalk": "Бо ИП-адрестиң чугаазы",
        "navigation": "Навигация",
        "and": "&#32;болгаш",
-       "qbfind": "Дилээри",
-       "qbbrowse": "Каралаары",
-       "qbedit": "Өскертири",
-       "qbpageoptions": "Бо арын",
-       "qbmyoptions": "Мээң арыннарым",
        "faq": "Бо-ла салыр айтырыглар (БлСА)",
-       "faqpage": "Project:БлСА",
        "actions": "Кылыглар",
        "namespaces": "Аттар делгемнери",
        "variants": "Янзы-хевирлери",
        "edit": "Эдер",
        "create": "Чогаадыры",
        "create-local": "Кызыы тайылбыр немээр",
-       "editthispage": "Бо арынны өскертири",
-       "create-this-page": "Бо арынны чогаадыры",
        "delete": "Ыраары",
-       "deletethispage": "Бо арынны ырадыры",
        "undelete_short": "$1 {{PLURAL:$1|1=эдигни|эдиглерни}} катап үндүрери",
        "viewdeleted_short": "{{PLURAL:$1|1=Бир ыраткан өскерлиишкинни|$1 ыраткан өскерлиишкиннерни}} көөрү",
        "protect": "Камгалаары",
        "protect_change": "өскертири",
-       "protectthispage": "Бо арынны камгалаар",
        "unprotect": "Камгалалды өскертири",
-       "unprotectthispage": "Бо арынның камгалалын өскертири",
        "newpage": "Чаа арын",
-       "talkpage": "Бо арын дугайында чугаалажыры",
        "talkpagelinktext": "Чугаалажып сайгарар",
        "specialpage": "Тускай арын",
        "personaltools": "Хууда херекселдер",
-       "articlepage": "Допчу арынны көөрү",
        "talk": "Сайгарылга",
        "views": "Көрүлделер",
        "toolbox": "Херекселдер",
-       "userpage": "Ажыглакчының арынын көөрү",
-       "projectpage": "Төлевилелдиң арынын көөрү",
        "imagepage": "Файлдың арынын көөрү",
        "mediawikipage": "Чагаа арынын көөрү",
        "templatepage": "Майык арынын көөрү",
        "whatlinkshere-filters": "Шүүрлер",
        "block": "Ажыглакчыны кызыгаарлаары",
        "blockip": "Ажыглакчыны кызыгаарлаары",
-       "blockip-legend": "Ажыглакчыны кызыгаарлаары",
        "ipaddressorusername": "ИП-адрес азы aжыглaкчының aды",
        "ipbreason": "Чылдагаан:",
        "ipbsubmit": "Бо ажыглакчыны кызыгаарлаары",
        "namespacesall": "шупту",
        "monthsall": "шупту",
        "recreate": "Катап чогаадыры",
+       "confirm-purge-title": "Ук арында кешти аштаар",
        "confirm_purge_button": "Чөп",
+       "confirm-purge-top": "Ук арында кешти аштаар бе?",
+       "confirm-purge-bottom": "Арында кешти аштаза, аңаа арынның сөөлгү хевири көстүр.",
        "confirm-watch-button": "Чөп",
        "confirm-unwatch-button": "Чөп",
        "imgmultipageprev": "← эрткен арын",
index e21a647..c82fc91 100644 (file)
        "htmlform-user-not-valid": "<strong>$1</strong> 不是有效的使用者名稱。",
        "logentry-delete-delete": "$1 刪除頁面 $3",
        "logentry-delete-delete_redir": "$1 透過覆寫{{GENDER:$2|刪除了}}重新導向 $3",
-       "logentry-delete-restore": "$1{{GENDER:$2|還原}}頁面 $3($4)",
+       "logentry-delete-restore": "$1 {{GENDER:$2|還原}}頁面 $3($4)",
        "logentry-delete-restore-nocount": "$1 {{GENDER:$2|已還原}}頁面 $3",
        "restore-count-revisions": "{{PLURAL:$1|1 修訂|$1 修訂}}",
        "restore-count-files": "{{PLURAL:$1|1 檔案|$1 檔案}}",
index 0dcfe2d..89c6e9a 100644 (file)
@@ -7,6 +7,7 @@
  * @file
  *
  * @author Alchimista
+ * @author Athena
  * @author Cecílio
  * @author MCruz
  * @author Malafaya
@@ -20,8 +21,8 @@ $namespaceNames = [
        NS_MEDIA            => 'Media',
        NS_SPECIAL          => 'Special',
        NS_TALK             => 'Cumbersa',
-       NS_USER             => 'Outelizador',
-       NS_USER_TALK        => 'Cumbersa_outelizador',
+       NS_USER             => 'Outelizador(a)',
+       NS_USER_TALK        => 'Cumbersa_outelizador(a)',
        NS_PROJECT_TALK     => '$1_cumbersa',
        NS_FILE             => 'Fexeiro',
        NS_FILE_TALK        => 'Cumbersa_fexeiro',
@@ -53,11 +54,16 @@ $namespaceAliases = [
        'Categoria_Discussão' => NS_CATEGORY_TALK,
 ];
 
+$namespaceGenderAliases = [
+       NS_USER => [ 'male' => 'Outelizador', 'female' => 'Outelizadora' ],
+       NS_USER_TALK => [ 'male' => 'Cumbersa_outelizador', 'female' => 'Cumbersa_outelizadora' ],
+]; // T180052
+
 $specialPageAliases = [
-       'CreateAccount'             => [ 'Criar Cuonta' ],
-       'Lonelypages'               => [ 'Páiginas Uorfanas' ],
-       'Uncategorizedcategories'   => [ 'Catadories sien catadories' ],
-       'Uncategorizedimages'       => [ 'Eimaiges sien catadories' ],
+       'CreateAccount'             => [ 'Criar_Cuonta' ],
+       'Lonelypages'               => [ 'Páiginas_Uorfanas' ],
+       'Uncategorizedcategories'   => [ 'Catadories_sien_catadories' ],
+       'Uncategorizedimages'       => [ 'Eimaiges_sien_catadories' ],
        'Userlogin'                 => [ 'Antrar' ],
        'Userlogout'                => [ 'Salir' ],
 ];
index b504bde..e5b4c13 100644 (file)
@@ -25,7 +25,7 @@ class CheckComposerLockUpToDate extends Maintenance {
                        $lockLocation = "$IP/vendor/composer.lock";
                        if ( !file_exists( $lockLocation ) ) {
                                $this->error(
-                                       'Could not find composer.lock file. Have you run "composer install"?',
+                                       'Could not find composer.lock file. Have you run "composer install --no-dev"?',
                                        1
                                );
                        }
@@ -53,7 +53,7 @@ class CheckComposerLockUpToDate extends Maintenance {
                if ( $found ) {
                        $this->error(
                                'Error: your composer.lock file is not up to date. ' .
-                                       'Run "composer update" to install newer dependencies',
+                                       'Run "composer update --no-dev" to install newer dependencies',
                                1
                        );
                } else {
index cad530b..73ec1a7 100644 (file)
@@ -11,6 +11,7 @@
 
 #pagehistory li.selected {
        background-color: #f8f9fa;
+       color: #252525;
        border: 1px dashed #a2a9b1;
 }
 
index 6931c7d..58e00f9 100644 (file)
@@ -69,16 +69,16 @@ a.stub {
 }
 
 /* Expand URLs for printing */
-.mw-body-content a.external.text:after,
-.mw-body-content a.external.autonumber:after {
+.mw-parser-output a.external.text:after,
+.mw-parser-output a.external.autonumber:after {
        content: ' (' attr( href ) ')';
        word-break: break-all;
        word-wrap: break-word;
 }
 
 /* Expand protocol-relative URLs for printing */
-.mw-body-content a.external.text[ href^='//' ]:after,
-.mw-body-content a.external.autonumber[ href^='//' ]:after {
+.mw-parser-output a.external.text[ href^='//' ]:after,
+.mw-parser-output a.external.autonumber[ href^='//' ]:after {
        content: ' (https:' attr( href ) ')';
 }
 
index d519648..5386291 100644 (file)
                        this.changesListModel.update(
                                pieces.changes,
                                pieces.fieldset,
-                               pieces.noResultsDetails === 'NO_RESULTS_TIMEOUT',
+                               pieces.noResultsDetails,
                                true // We're using existing DOM elements
                        );
                }
index 2a64aa3..d82ffe0 100644 (file)
@@ -9,7 +9,7 @@
  * compatibility ( browsers able to understand gradient syntax support also SVG ).
  * http://pauginer.tumblr.com/post/36614680636/invisible-gradient-technique */
 
-.mw-body-content a.external,
+.mw-parser-output a.external,
 .link-https {
        background: url( images/external-ltr.png ) center right no-repeat;
        /* @embed */
@@ -19,7 +19,7 @@
        padding-right: 15px;
 }
 
-.mw-body-content a.external[ href^='mailto:' ],
+.mw-parser-output a.external[ href^='mailto:' ],
 .link-mailto {
        background: url( images/mail.png ) center right no-repeat;
        /* @embed */
@@ -27,7 +27,7 @@
        padding-right: 15px;
 }
 
-.mw-body-content a.external[ href^='ftp://' ],
+.mw-parser-output a.external[ href^='ftp://' ],
 .link-ftp {
        background: url( images/ftp-ltr.png ) center right no-repeat;
        /* @embed */
@@ -35,8 +35,8 @@
        padding-right: 15px;
 }
 
-.mw-body-content a.external[ href^='irc://' ],
-.mw-body-content a.external[ href^='ircs://' ],
+.mw-parser-output a.external[ href^='irc://' ],
+.mw-parser-output a.external[ href^='ircs://' ],
 .link-irc {
        background: url( images/chat-ltr.png ) center right no-repeat;
        /* @embed */
        padding-right: 15px;
 }
 
-.mw-body-content a.external[ href$='.ogg' ],
-.mw-body-content a.external[ href$='.OGG' ],
-.mw-body-content a.external[ href$='.mid' ],
-.mw-body-content a.external[ href$='.MID' ],
-.mw-body-content a.external[ href$='.midi' ],
-.mw-body-content a.external[ href$='.MIDI' ],
-.mw-body-content a.external[ href$='.mp3' ],
-.mw-body-content a.external[ href$='.MP3' ],
-.mw-body-content a.external[ href$='.wav' ],
-.mw-body-content a.external[ href$='.WAV' ],
-.mw-body-content a.external[ href$='.wma' ],
-.mw-body-content a.external[ href$='.WMA' ],
+.mw-parser-output a.external[ href$='.ogg' ],
+.mw-parser-output a.external[ href$='.OGG' ],
+.mw-parser-output a.external[ href$='.mid' ],
+.mw-parser-output a.external[ href$='.MID' ],
+.mw-parser-output a.external[ href$='.midi' ],
+.mw-parser-output a.external[ href$='.MIDI' ],
+.mw-parser-output a.external[ href$='.mp3' ],
+.mw-parser-output a.external[ href$='.MP3' ],
+.mw-parser-output a.external[ href$='.wav' ],
+.mw-parser-output a.external[ href$='.WAV' ],
+.mw-parser-output a.external[ href$='.wma' ],
+.mw-parser-output a.external[ href$='.WMA' ],
 .link-audio {
        background: url( images/audio-ltr.png ) center right no-repeat;
        /* @embed */
        padding-right: 15px;
 }
 
-.mw-body-content a.external[ href$='.ogm' ],
-.mw-body-content a.external[ href$='.OGM' ],
-.mw-body-content a.external[ href$='.avi' ],
-.mw-body-content a.external[ href$='.AVI' ],
-.mw-body-content a.external[ href$='.mpeg' ],
-.mw-body-content a.external[ href$='.MPEG' ],
-.mw-body-content a.external[ href$='.mpg' ],
-.mw-body-content a.external[ href$='.MPG' ],
+.mw-parser-output a.external[ href$='.ogm' ],
+.mw-parser-output a.external[ href$='.OGM' ],
+.mw-parser-output a.external[ href$='.avi' ],
+.mw-parser-output a.external[ href$='.AVI' ],
+.mw-parser-output a.external[ href$='.mpeg' ],
+.mw-parser-output a.external[ href$='.MPEG' ],
+.mw-parser-output a.external[ href$='.mpg' ],
+.mw-parser-output a.external[ href$='.MPG' ],
 .link-video {
        background: url( images/video.png ) center right no-repeat;
        /* @embed */
        padding-right: 15px;
 }
 
-.mw-body-content a.external[ href$='.pdf' ],
-.mw-body-content a.external[ href$='.PDF' ],
-.mw-body-content a.external[ href*='.pdf#' ],
-.mw-body-content a.external[ href*='.PDF#' ],
-.mw-body-content a.external[ href*='.pdf?' ],
-.mw-body-content a.external[ href*='.PDF?' ],
+.mw-parser-output a.external[ href$='.pdf' ],
+.mw-parser-output a.external[ href$='.PDF' ],
+.mw-parser-output a.external[ href*='.pdf#' ],
+.mw-parser-output a.external[ href*='.PDF#' ],
+.mw-parser-output a.external[ href*='.pdf?' ],
+.mw-parser-output a.external[ href*='.PDF?' ],
 .link-document {
        background: url( images/document-ltr.png ) center right no-repeat;
        /* @embed */
 }
 
 /* Interwiki styling */
-.mw-body-content a.extiw,
-.mw-body-content a.extiw:active {
+.mw-parser-output a.extiw,
+.mw-parser-output a.extiw:active {
        color: #36b;
 }
 
 /* External link color */
-.mw-body-content a.external {
+.mw-parser-output a.external {
        color: #36b;
 }
index 366c5a9..3599f34 100644 (file)
@@ -53,33 +53,33 @@ a.new:visited,
 }
 
 /* Interwiki Styling */
-.mw-body-content a.extiw,
-.mw-body-content a.extiw:active {
+.mw-parser-output a.extiw,
+.mw-parser-output a.extiw:active {
        color: #36b;
 }
 
-.mw-body-content a.extiw:visited {
+.mw-parser-output a.extiw:visited {
        color: #636;
 }
 
-.mw-body-content a.extiw:active {
+.mw-parser-output a.extiw:active {
        color: #b63;
 }
 
 /* External links */
-.mw-body-content a.external {
+.mw-parser-output a.external {
        color: #36b;
 }
 
-.mw-body-content a.external:visited {
+.mw-parser-output a.external:visited {
        color: #636; /* T5112 */
 }
 
-.mw-body-content a.external:active {
+.mw-parser-output a.external:active {
        color: #b63;
 }
 
-.mw-body-content a.external.free {
+.mw-parser-output a.external.free {
        word-wrap: break-word;
 }
 
index 3e0d2b9..8cd25d8 100644 (file)
@@ -22,6 +22,7 @@ textarea {
 
 .editOptions {
        background-color: #eaecf0;
+       color: #252525;
        border: 1px solid #c8ccd1;
        border-top: 0;
        padding: 1em 1em 1.5em 1em;
index 633798d..481980f 100644 (file)
@@ -15,6 +15,7 @@
        margin-bottom: 0.5em;
        border: solid 1px #ddd;
        background-color: #fcfcfc;
+       color: #252525;
        /* Click handler in mediawiki.notification.js */
        cursor: pointer;
 
index cef935c..ff574d1 100644 (file)
@@ -5706,7 +5706,7 @@ Examples from RFC 2732, section 2:
 
 !! html/php
 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
-</p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
+</p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
 </p>
 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
@@ -5714,7 +5714,7 @@ Examples from RFC 2732, section 2:
 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
-<p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
+<p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
 </p>
 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
@@ -5727,7 +5727,7 @@ Examples from RFC 2732, section 2:
 !! html/parsoid
 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
 
-<p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
+<p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
@@ -5735,7 +5735,7 @@ Examples from RFC 2732, section 2:
 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
 
-<p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
+<p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
@@ -5769,7 +5769,7 @@ Examples from RFC 2732, section 2:
 
 !! html/php
 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
-</p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
+</p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
 </p>
 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
@@ -5777,7 +5777,7 @@ Examples from RFC 2732, section 2:
 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
-<p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
+<p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
 </p>
 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
@@ -5790,7 +5790,7 @@ Examples from RFC 2732, section 2:
 !! html/parsoid
 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
 
-<p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
+<p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
@@ -5798,7 +5798,7 @@ Examples from RFC 2732, section 2:
 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
 
-<p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
+<p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
@@ -10998,10 +10998,10 @@ Magic links: RFC (T2479)
 !! wikitext
 RFC 822
 !! html/php
-<p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
+<p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
 </p>
 !! html/parsoid
-<p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
+<p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
 !! end
 
 !! test
@@ -11009,10 +11009,10 @@ Magic links: RFC (T67278)
 !! wikitext
 This is RFC 822 but thisRFC 822 is not RFC 822linked.
 !! html/php
-<p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
+<p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
 </p>
 !! html/parsoid
-<p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
+<p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
 !! end
 
 !! test
@@ -11022,12 +11022,12 @@ RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
 RFC
 822
 !! html/php
-<p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
+<p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
 RFC
 822
 </p>
 !! html/parsoid
-<p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
+<p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
 RFC
 822</p>
 !! end
@@ -11123,14 +11123,14 @@ Magic links: use appropriate serialization for "almost" magic links.
 !! wikitext
 X[[Special:BookSources/0978739256|foo]]
 
-X[//tools.ietf.org/html/rfc1234 foo]
+X[https://tools.ietf.org/html/rfc1234 foo]
 !! html/php
 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
-</p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
+</p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
 </p>
 !! html/parsoid
 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
-<p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
+<p>X<a rel="mw:ExtLink" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
 !! end
 
 !! test
@@ -15164,10 +15164,10 @@ T3887: A RFC with a thumbnail
 !! wikitext
 [[File:Foobar.jpg|thumb|This is RFC 12354]]
 !! html/php
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
 
 !! html/parsoid
-<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
+<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="https://tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
 !! end
 
 !! test
@@ -20978,7 +20978,7 @@ Double RFC
 !! wikitext
 RFC RFC 1234
 !! html
-<p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
+<p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
 </p>
 !! end
 
@@ -20996,10 +20996,10 @@ RFC code coverage
 !! wikitext
 RFC   983&#x20;987
 !! html
-<p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
+<p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
 </p>
 !! html+tidy
-<p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
+<p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
 !! end
 
 !! test
@@ -25754,9 +25754,9 @@ Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
-<p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
-<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
-X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
+<p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
+<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
+X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
 !! wikitext
 RFC 123<nowiki/>4
 RFC 123<nowiki/>y
@@ -25768,18 +25768,18 @@ Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
 !! options
 parsoid=html2wt
 !! html/parsoid
-<p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
-<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
--<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
+<p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
+<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
+-<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
 </p>
 !! wikitext
 RFC 123?foo
 RFC 123&foo
 -RFC 123-
 !! html/php
-<p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
-<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
--<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
+<p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
+<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
+-<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
 </p>
 !! end
 
@@ -28040,9 +28040,9 @@ Edited RFC links not serializable as RFC links should serialize as extlinks
 !! options
 parsoid=html2wt
 !! html/parsoid
-<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
+<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
 !! wikitext
-[//tools.ietf.org/html/rfc123 New RFC]
+[https://tools.ietf.org/html/rfc123 New RFC]
 !! end
 
 !! test
@@ -28186,7 +28186,7 @@ Magic links inside image captions (autolinked)
 <div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
 <div class="thumbcaption">
 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
-<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
+<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a></div>
 </div>
 </div>
 <div class="thumb tright">
@@ -28205,7 +28205,7 @@ Magic links inside image captions (autolinked)
 </div>
 !! html/parsoid
 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
-<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
+<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
 !! end
diff --git a/tests/phpunit/includes/WatchedItemIntegrationTest.php b/tests/phpunit/includes/WatchedItemIntegrationTest.php
deleted file mode 100644 (file)
index 01e7ecb..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-use MediaWiki\MediaWikiServices;
-
-/**
- * @author Addshore
- *
- * @group Database
- *
- * @covers WatchedItem
- */
-class WatchedItemIntegrationTest extends MediaWikiTestCase {
-
-       public function setUp() {
-               parent::setUp();
-               self::$users['WatchedItemIntegrationTestUser']
-                       = new TestUser( 'WatchedItemIntegrationTestUser' );
-
-               $this->hideDeprecated( 'WatchedItem::fromUserTitle' );
-               $this->hideDeprecated( 'WatchedItem::addWatch' );
-               $this->hideDeprecated( 'WatchedItem::removeWatch' );
-               $this->hideDeprecated( 'WatchedItem::isWatched' );
-               $this->hideDeprecated( 'WatchedItem::duplicateEntries' );
-               $this->hideDeprecated( 'WatchedItem::batchAddWatch' );
-       }
-
-       private function getUser() {
-               return self::$users['WatchedItemIntegrationTestUser']->getUser();
-       }
-
-       public function testWatchAndUnWatchItem() {
-               $user = $this->getUser();
-               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
-               // Cleanup after previous tests
-               WatchedItem::fromUserTitle( $user, $title )->removeWatch();
-
-               $this->assertFalse(
-                       WatchedItem::fromUserTitle( $user, $title )->isWatched(),
-                       'Page should not initially be watched'
-               );
-               WatchedItem::fromUserTitle( $user, $title )->addWatch();
-               $this->assertTrue(
-                       WatchedItem::fromUserTitle( $user, $title )->isWatched(),
-                       'Page should be watched'
-               );
-               WatchedItem::fromUserTitle( $user, $title )->removeWatch();
-               $this->assertFalse(
-                       WatchedItem::fromUserTitle( $user, $title )->isWatched(),
-                       'Page should be unwatched'
-               );
-       }
-
-       public function testUpdateAndResetNotificationTimestamp() {
-               $user = $this->getUser();
-               $otherUser = ( new TestUser( 'WatchedItemIntegrationTestUser_otherUser' ) )->getUser();
-               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
-               WatchedItem::fromUserTitle( $user, $title )->addWatch();
-               $this->assertNull( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
-
-               EmailNotification::updateWatchlistTimestamp( $otherUser, $title, '20150202010101' );
-               $this->assertEquals(
-                       '20150202010101',
-                       WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp()
-               );
-
-               MediaWikiServices::getInstance()->getWatchedItemStore()->resetNotificationTimestamp(
-                       $user, $title
-               );
-               $this->assertNull( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
-       }
-
-       public function testDuplicateAllAssociatedEntries() {
-               $user = $this->getUser();
-               $titleOld = Title::newFromText( 'WatchedItemIntegrationTestPageOld' );
-               $titleNew = Title::newFromText( 'WatchedItemIntegrationTestPageNew' );
-               WatchedItem::fromUserTitle( $user, $titleOld->getSubjectPage() )->addWatch();
-               WatchedItem::fromUserTitle( $user, $titleOld->getTalkPage() )->addWatch();
-               // Cleanup after previous tests
-               WatchedItem::fromUserTitle( $user, $titleNew->getSubjectPage() )->removeWatch();
-               WatchedItem::fromUserTitle( $user, $titleNew->getTalkPage() )->removeWatch();
-
-               WatchedItem::duplicateEntries( $titleOld, $titleNew );
-
-               $this->assertTrue(
-                       WatchedItem::fromUserTitle( $user, $titleOld->getSubjectPage() )->isWatched()
-               );
-               $this->assertTrue(
-                       WatchedItem::fromUserTitle( $user, $titleOld->getTalkPage() )->isWatched()
-               );
-               $this->assertTrue(
-                       WatchedItem::fromUserTitle( $user, $titleNew->getSubjectPage() )->isWatched()
-               );
-               $this->assertTrue(
-                       WatchedItem::fromUserTitle( $user, $titleNew->getTalkPage() )->isWatched()
-               );
-       }
-
-       public function testIsWatched_falseOnNotAllowed() {
-               $user = $this->getUser();
-               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
-               WatchedItem::fromUserTitle( $user, $title )->addWatch();
-
-               $this->assertTrue( WatchedItem::fromUserTitle( $user, $title )->isWatched() );
-               $user->mRights = [];
-               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->isWatched() );
-       }
-
-       public function testGetNotificationTimestamp_falseOnNotAllowed() {
-               $user = $this->getUser();
-               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
-               WatchedItem::fromUserTitle( $user, $title )->addWatch();
-               MediaWikiServices::getInstance()->getWatchedItemStore()->resetNotificationTimestamp(
-                       $user, $title
-               );
-
-               $this->assertEquals(
-                       null,
-                       WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp()
-               );
-               $user->mRights = [];
-               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
-       }
-
-       public function testRemoveWatch_falseOnNotAllowed() {
-               $user = $this->getUser();
-               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
-               WatchedItem::fromUserTitle( $user, $title )->addWatch();
-
-               $previousRights = $user->mRights;
-               $user->mRights = [];
-               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->removeWatch() );
-               $user->mRights = $previousRights;
-               $this->assertTrue( WatchedItem::fromUserTitle( $user, $title )->removeWatch() );
-       }
-
-       public function testGetNotificationTimestamp_falseOnNotWatched() {
-               $user = $this->getUser();
-               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
-
-               WatchedItem::fromUserTitle( $user, $title )->removeWatch();
-               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->isWatched() );
-
-               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
-       }
-
-}
diff --git a/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php b/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
deleted file mode 100644 (file)
index 62ba5f6..0000000
+++ /dev/null
@@ -1,1676 +0,0 @@
-<?php
-
-use Wikimedia\ScopedCallback;
-use Wikimedia\TestingAccessWrapper;
-
-/**
- * @covers WatchedItemQueryService
- */
-class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
-
-       /**
-        * @return PHPUnit_Framework_MockObject_MockObject|Database
-        */
-       private function getMockDb() {
-               $mock = $this->getMockBuilder( Database::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-
-               $mock->expects( $this->any() )
-                       ->method( 'makeList' )
-                       ->with(
-                               $this->isType( 'array' ),
-                               $this->isType( 'int' )
-                       )
-                       ->will( $this->returnCallback( function ( $a, $conj ) {
-                               $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
-                               return join( $sqlConj, array_map( function ( $s ) {
-                                       return '(' . $s . ')';
-                               }, $a
-                               ) );
-                       } ) );
-
-               $mock->expects( $this->any() )
-                       ->method( 'addQuotes' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return "'$value'";
-                       } ) );
-
-               $mock->expects( $this->any() )
-                       ->method( 'timestamp' )
-                       ->will( $this->returnArgument( 0 ) );
-
-               $mock->expects( $this->any() )
-                       ->method( 'bitAnd' )
-                       ->willReturnCallback( function ( $a, $b ) {
-                               return "($a & $b)";
-                       } );
-
-               return $mock;
-       }
-
-       /**
-        * @param PHPUnit_Framework_MockObject_MockObject|Database $mockDb
-        * @return PHPUnit_Framework_MockObject_MockObject|LoadBalancer
-        */
-       private function getMockLoadBalancer( $mockDb ) {
-               $mock = $this->getMockBuilder( LoadBalancer::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-               $mock->expects( $this->any() )
-                       ->method( 'getConnectionRef' )
-                       ->with( DB_REPLICA )
-                       ->will( $this->returnValue( $mockDb ) );
-               return $mock;
-       }
-
-       /**
-        * @param int $id
-        * @return PHPUnit_Framework_MockObject_MockObject|User
-        */
-       private function getMockNonAnonUserWithId( $id ) {
-               $mock = $this->getMockBuilder( User::class )->getMock();
-               $mock->expects( $this->any() )
-                       ->method( 'isAnon' )
-                       ->will( $this->returnValue( false ) );
-               $mock->expects( $this->any() )
-                       ->method( 'getId' )
-                       ->will( $this->returnValue( $id ) );
-               return $mock;
-       }
-
-       /**
-        * @param int $id
-        * @return PHPUnit_Framework_MockObject_MockObject|User
-        */
-       private function getMockUnrestrictedNonAnonUserWithId( $id ) {
-               $mock = $this->getMockNonAnonUserWithId( $id );
-               $mock->expects( $this->any() )
-                       ->method( 'isAllowed' )
-                       ->will( $this->returnValue( true ) );
-               $mock->expects( $this->any() )
-                       ->method( 'isAllowedAny' )
-                       ->will( $this->returnValue( true ) );
-               $mock->expects( $this->any() )
-                       ->method( 'useRCPatrol' )
-                       ->will( $this->returnValue( true ) );
-               return $mock;
-       }
-
-       /**
-        * @param int $id
-        * @param string $notAllowedAction
-        * @return PHPUnit_Framework_MockObject_MockObject|User
-        */
-       private function getMockNonAnonUserWithIdAndRestrictedPermissions( $id, $notAllowedAction ) {
-               $mock = $this->getMockNonAnonUserWithId( $id );
-
-               $mock->expects( $this->any() )
-                       ->method( 'isAllowed' )
-                       ->will( $this->returnCallback( function ( $action ) use ( $notAllowedAction ) {
-                               return $action !== $notAllowedAction;
-                       } ) );
-               $mock->expects( $this->any() )
-                       ->method( 'isAllowedAny' )
-                       ->will( $this->returnCallback( function () use ( $notAllowedAction ) {
-                               $actions = func_get_args();
-                               return !in_array( $notAllowedAction, $actions );
-                       } ) );
-
-               return $mock;
-       }
-
-       /**
-        * @param int $id
-        * @return PHPUnit_Framework_MockObject_MockObject|User
-        */
-       private function getMockNonAnonUserWithIdAndNoPatrolRights( $id ) {
-               $mock = $this->getMockNonAnonUserWithId( $id );
-
-               $mock->expects( $this->any() )
-                       ->method( 'isAllowed' )
-                       ->will( $this->returnValue( true ) );
-               $mock->expects( $this->any() )
-                       ->method( 'isAllowedAny' )
-                       ->will( $this->returnValue( true ) );
-
-               $mock->expects( $this->any() )
-                       ->method( 'useRCPatrol' )
-                       ->will( $this->returnValue( false ) );
-               $mock->expects( $this->any() )
-                       ->method( 'useNPPatrol' )
-                       ->will( $this->returnValue( false ) );
-
-               return $mock;
-       }
-
-       private function getMockAnonUser() {
-               $mock = $this->getMockBuilder( User::class )->getMock();
-               $mock->expects( $this->any() )
-                       ->method( 'isAnon' )
-                       ->will( $this->returnValue( true ) );
-               return $mock;
-       }
-
-       private function getFakeRow( array $rowValues ) {
-               $fakeRow = new stdClass();
-               foreach ( $rowValues as $valueName => $value ) {
-                       $fakeRow->$valueName = $value;
-               }
-               return $fakeRow;
-       }
-
-       public function testGetWatchedItemsWithRecentChangeInfo() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               [ 'recentchanges', 'watchlist', 'page' ],
-                               [
-                                       'rc_id',
-                                       'rc_namespace',
-                                       'rc_title',
-                                       'rc_timestamp',
-                                       'rc_type',
-                                       'rc_deleted',
-                                       'wl_notificationtimestamp',
-                                       'rc_cur_id',
-                                       'rc_this_oldid',
-                                       'rc_last_oldid',
-                               ],
-                               [
-                                       'wl_user' => 1,
-                                       '(rc_this_oldid=page_latest) OR (rc_type=3)',
-                               ],
-                               $this->isType( 'string' ),
-                               [
-                                       'LIMIT' => 3,
-                               ],
-                               [
-                                       'watchlist' => [
-                                               'INNER JOIN',
-                                               [
-                                                       'wl_namespace=rc_namespace',
-                                                       'wl_title=rc_title'
-                                               ]
-                                       ],
-                                       'page' => [
-                                               'LEFT JOIN',
-                                               'rc_cur_id=page_id',
-                                       ],
-                               ]
-                       )
-                       ->will( $this->returnValue( [
-                               $this->getFakeRow( [
-                                       'rc_id' => 1,
-                                       'rc_namespace' => 0,
-                                       'rc_title' => 'Foo1',
-                                       'rc_timestamp' => '20151212010101',
-                                       'rc_type' => RC_NEW,
-                                       'rc_deleted' => 0,
-                                       'wl_notificationtimestamp' => '20151212010101',
-                               ] ),
-                               $this->getFakeRow( [
-                                       'rc_id' => 2,
-                                       'rc_namespace' => 1,
-                                       'rc_title' => 'Foo2',
-                                       'rc_timestamp' => '20151212010102',
-                                       'rc_type' => RC_NEW,
-                                       'rc_deleted' => 0,
-                                       'wl_notificationtimestamp' => null,
-                               ] ),
-                               $this->getFakeRow( [
-                                       'rc_id' => 3,
-                                       'rc_namespace' => 1,
-                                       'rc_title' => 'Foo3',
-                                       'rc_timestamp' => '20151212010103',
-                                       'rc_type' => RC_NEW,
-                                       'rc_deleted' => 0,
-                                       'wl_notificationtimestamp' => null,
-                               ] ),
-                       ] ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-
-               $startFrom = null;
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
-                       $user, [ 'limit' => 2 ], $startFrom
-               );
-
-               $this->assertInternalType( 'array', $items );
-               $this->assertCount( 2, $items );
-
-               foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
-                       $this->assertInstanceOf( WatchedItem::class, $watchedItem );
-                       $this->assertInternalType( 'array', $recentChangeInfo );
-               }
-
-               $this->assertEquals(
-                       new WatchedItem( $user, new TitleValue( 0, 'Foo1' ), '20151212010101' ),
-                       $items[0][0]
-               );
-               $this->assertEquals(
-                       [
-                               'rc_id' => 1,
-                               'rc_namespace' => 0,
-                               'rc_title' => 'Foo1',
-                               'rc_timestamp' => '20151212010101',
-                               'rc_type' => RC_NEW,
-                               'rc_deleted' => 0,
-                       ],
-                       $items[0][1]
-               );
-
-               $this->assertEquals(
-                       new WatchedItem( $user, new TitleValue( 1, 'Foo2' ), null ),
-                       $items[1][0]
-               );
-               $this->assertEquals(
-                       [
-                               'rc_id' => 2,
-                               'rc_namespace' => 1,
-                               'rc_title' => 'Foo2',
-                               'rc_timestamp' => '20151212010102',
-                               'rc_type' => RC_NEW,
-                               'rc_deleted' => 0,
-                       ],
-                       $items[1][1]
-               );
-
-               $this->assertEquals( [ '20151212010103', 3 ], $startFrom );
-       }
-
-       public function testGetWatchedItemsWithRecentChangeInfo_extension() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               [ 'recentchanges', 'watchlist', 'page', 'extension_dummy_table' ],
-                               [
-                                       'rc_id',
-                                       'rc_namespace',
-                                       'rc_title',
-                                       'rc_timestamp',
-                                       'rc_type',
-                                       'rc_deleted',
-                                       'wl_notificationtimestamp',
-                                       'rc_cur_id',
-                                       'rc_this_oldid',
-                                       'rc_last_oldid',
-                                       'extension_dummy_field',
-                               ],
-                               [
-                                       'wl_user' => 1,
-                                       '(rc_this_oldid=page_latest) OR (rc_type=3)',
-                                       'extension_dummy_cond',
-                               ],
-                               $this->isType( 'string' ),
-                               [
-                                       'extension_dummy_option',
-                               ],
-                               [
-                                       'watchlist' => [
-                                               'INNER JOIN',
-                                               [
-                                                       'wl_namespace=rc_namespace',
-                                                       'wl_title=rc_title'
-                                               ]
-                                       ],
-                                       'page' => [
-                                               'LEFT JOIN',
-                                               'rc_cur_id=page_id',
-                                       ],
-                                       'extension_dummy_join_cond' => [],
-                               ]
-                       )
-                       ->will( $this->returnValue( [
-                               $this->getFakeRow( [
-                                       'rc_id' => 1,
-                                       'rc_namespace' => 0,
-                                       'rc_title' => 'Foo1',
-                                       'rc_timestamp' => '20151212010101',
-                                       'rc_type' => RC_NEW,
-                                       'rc_deleted' => 0,
-                                       'wl_notificationtimestamp' => '20151212010101',
-                               ] ),
-                               $this->getFakeRow( [
-                                       'rc_id' => 2,
-                                       'rc_namespace' => 1,
-                                       'rc_title' => 'Foo2',
-                                       'rc_timestamp' => '20151212010102',
-                                       'rc_type' => RC_NEW,
-                                       'rc_deleted' => 0,
-                                       'wl_notificationtimestamp' => null,
-                               ] ),
-                       ] ) );
-
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-
-               $mockExtension = $this->getMockBuilder( WatchedItemQueryServiceExtension::class )
-                       ->getMock();
-               $mockExtension->expects( $this->once() )
-                       ->method( 'modifyWatchedItemsWithRCInfoQuery' )
-                       ->with(
-                               $this->identicalTo( $user ),
-                               $this->isType( 'array' ),
-                               $this->isInstanceOf( IDatabase::class ),
-                               $this->isType( 'array' ),
-                               $this->isType( 'array' ),
-                               $this->isType( 'array' ),
-                               $this->isType( 'array' ),
-                               $this->isType( 'array' )
-                       )
-                       ->will( $this->returnCallback( function (
-                               $user, $options, $db, &$tables, &$fields, &$conds, &$dbOptions, &$joinConds
-                       ) {
-                               $tables[] = 'extension_dummy_table';
-                               $fields[] = 'extension_dummy_field';
-                               $conds[] = 'extension_dummy_cond';
-                               $dbOptions[] = 'extension_dummy_option';
-                               $joinConds['extension_dummy_join_cond'] = [];
-                       } ) );
-               $mockExtension->expects( $this->once() )
-                       ->method( 'modifyWatchedItemsWithRCInfo' )
-                       ->with(
-                               $this->identicalTo( $user ),
-                               $this->isType( 'array' ),
-                               $this->isInstanceOf( IDatabase::class ),
-                               $this->isType( 'array' ),
-                               $this->anything(),
-                               $this->anything() // Can't test for null here, PHPUnit applies this after the callback
-                       )
-                       ->will( $this->returnCallback( function ( $user, $options, $db, &$items, $res, &$startFrom ) {
-                               foreach ( $items as $i => &$item ) {
-                                       $item[1]['extension_dummy_field'] = $i;
-                               }
-                               unset( $item );
-
-                               $this->assertNull( $startFrom );
-                               $startFrom = [ '20160203123456', 42 ];
-                       } ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               TestingAccessWrapper::newFromObject( $queryService )->extensions = [ $mockExtension ];
-
-               $startFrom = null;
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
-                       $user, [], $startFrom
-               );
-
-               $this->assertInternalType( 'array', $items );
-               $this->assertCount( 2, $items );
-
-               foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
-                       $this->assertInstanceOf( WatchedItem::class, $watchedItem );
-                       $this->assertInternalType( 'array', $recentChangeInfo );
-               }
-
-               $this->assertEquals(
-                       new WatchedItem( $user, new TitleValue( 0, 'Foo1' ), '20151212010101' ),
-                       $items[0][0]
-               );
-               $this->assertEquals(
-                       [
-                               'rc_id' => 1,
-                               'rc_namespace' => 0,
-                               'rc_title' => 'Foo1',
-                               'rc_timestamp' => '20151212010101',
-                               'rc_type' => RC_NEW,
-                               'rc_deleted' => 0,
-                               'extension_dummy_field' => 0,
-                       ],
-                       $items[0][1]
-               );
-
-               $this->assertEquals(
-                       new WatchedItem( $user, new TitleValue( 1, 'Foo2' ), null ),
-                       $items[1][0]
-               );
-               $this->assertEquals(
-                       [
-                               'rc_id' => 2,
-                               'rc_namespace' => 1,
-                               'rc_title' => 'Foo2',
-                               'rc_timestamp' => '20151212010102',
-                               'rc_type' => RC_NEW,
-                               'rc_deleted' => 0,
-                               'extension_dummy_field' => 1,
-                       ],
-                       $items[1][1]
-               );
-
-               $this->assertEquals( [ '20160203123456', 42 ], $startFrom );
-       }
-
-       public function getWatchedItemsWithRecentChangeInfoOptionsProvider() {
-               return [
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_FLAGS ] ],
-                               null,
-                               [],
-                               [ 'rc_type', 'rc_minor', 'rc_bot' ],
-                               [],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_USER ] ],
-                               null,
-                               [],
-                               [ 'rc_user_text' ],
-                               [],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_USER_ID ] ],
-                               null,
-                               [],
-                               [ 'rc_user' ],
-                               [],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_COMMENT ] ],
-                               null,
-                               [],
-                               [
-                                       'rc_comment_text' => 'rc_comment',
-                                       'rc_comment_data' => 'NULL',
-                                       'rc_comment_cid' => 'NULL',
-                               ],
-                               [],
-                               [],
-                               [],
-                               [ 'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD ],
-                       ],
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_COMMENT ] ],
-                               null,
-                               [ 'comment_rc_comment' => 'comment' ],
-                               [
-                                       'rc_comment_text' => 'COALESCE( comment_rc_comment.comment_text, rc_comment )',
-                                       'rc_comment_data' => 'comment_rc_comment.comment_data',
-                                       'rc_comment_cid' => 'comment_rc_comment.comment_id',
-                               ],
-                               [],
-                               [],
-                               [ 'comment_rc_comment' => [ 'LEFT JOIN', 'comment_rc_comment.comment_id = rc_comment_id' ] ],
-                               [ 'wgCommentTableSchemaMigrationStage' => MIGRATION_WRITE_BOTH ],
-                       ],
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_COMMENT ] ],
-                               null,
-                               [ 'comment_rc_comment' => 'comment' ],
-                               [
-                                       'rc_comment_text' => 'COALESCE( comment_rc_comment.comment_text, rc_comment )',
-                                       'rc_comment_data' => 'comment_rc_comment.comment_data',
-                                       'rc_comment_cid' => 'comment_rc_comment.comment_id',
-                               ],
-                               [],
-                               [],
-                               [ 'comment_rc_comment' => [ 'LEFT JOIN', 'comment_rc_comment.comment_id = rc_comment_id' ] ],
-                               [ 'wgCommentTableSchemaMigrationStage' => MIGRATION_WRITE_NEW ],
-                       ],
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_COMMENT ] ],
-                               null,
-                               [ 'comment_rc_comment' => 'comment' ],
-                               [
-                                       'rc_comment_text' => 'comment_rc_comment.comment_text',
-                                       'rc_comment_data' => 'comment_rc_comment.comment_data',
-                                       'rc_comment_cid' => 'comment_rc_comment.comment_id',
-                               ],
-                               [],
-                               [],
-                               [ 'comment_rc_comment' => [ 'JOIN', 'comment_rc_comment.comment_id = rc_comment_id' ] ],
-                               [ 'wgCommentTableSchemaMigrationStage' => MIGRATION_NEW ],
-                       ],
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_PATROL_INFO ] ],
-                               null,
-                               [],
-                               [ 'rc_patrolled', 'rc_log_type' ],
-                               [],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_SIZES ] ],
-                               null,
-                               [],
-                               [ 'rc_old_len', 'rc_new_len' ],
-                               [],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_LOG_INFO ] ],
-                               null,
-                               [],
-                               [ 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ],
-                               [],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'namespaceIds' => [ 0, 1 ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'wl_namespace' => [ 0, 1 ] ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'namespaceIds' => [ 0, "1; DROP TABLE watchlist;\n--" ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'wl_namespace' => [ 0, 1 ] ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'rcTypes' => [ RC_EDIT, RC_NEW ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_type' => [ RC_EDIT, RC_NEW ] ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
-                               null,
-                               [],
-                               [],
-                               [],
-                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
-                               [],
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_NEWER ],
-                               null,
-                               [],
-                               [],
-                               [],
-                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
-                               [],
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_OLDER, 'start' => '20151212010101' ],
-                               null,
-                               [],
-                               [],
-                               [ "rc_timestamp <= '20151212010101'" ],
-                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
-                               [],
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_OLDER, 'end' => '20151212010101' ],
-                               null,
-                               [],
-                               [],
-                               [ "rc_timestamp >= '20151212010101'" ],
-                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
-                               [],
-                       ],
-                       [
-                               [
-                                       'dir' => WatchedItemQueryService::DIR_OLDER,
-                                       'start' => '20151212020101',
-                                       'end' => '20151212010101'
-                               ],
-                               null,
-                               [],
-                               [],
-                               [ "rc_timestamp <= '20151212020101'", "rc_timestamp >= '20151212010101'" ],
-                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
-                               [],
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_NEWER, 'start' => '20151212010101' ],
-                               null,
-                               [],
-                               [],
-                               [ "rc_timestamp >= '20151212010101'" ],
-                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
-                               [],
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_NEWER, 'end' => '20151212010101' ],
-                               null,
-                               [],
-                               [],
-                               [ "rc_timestamp <= '20151212010101'" ],
-                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
-                               [],
-                       ],
-                       [
-                               [
-                                       'dir' => WatchedItemQueryService::DIR_NEWER,
-                                       'start' => '20151212010101',
-                                       'end' => '20151212020101'
-                               ],
-                               null,
-                               [],
-                               [],
-                               [ "rc_timestamp >= '20151212010101'", "rc_timestamp <= '20151212020101'" ],
-                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
-                               [],
-                       ],
-                       [
-                               [ 'limit' => 10 ],
-                               null,
-                               [],
-                               [],
-                               [],
-                               [ 'LIMIT' => 11 ],
-                               [],
-                       ],
-                       [
-                               [ 'limit' => "10; DROP TABLE watchlist;\n--" ],
-                               null,
-                               [],
-                               [],
-                               [],
-                               [ 'LIMIT' => 11 ],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_MINOR ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_minor != 0' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_MINOR ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_minor = 0' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_BOT ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_bot != 0' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_BOT ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_bot = 0' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_ANON ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_user = 0' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_ANON ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_user != 0' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_PATROLLED ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_patrolled != 0' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_PATROLLED ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_patrolled = 0' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_UNREAD ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_timestamp >= wl_notificationtimestamp' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_UNREAD ] ],
-                               null,
-                               [],
-                               [],
-                               [ 'wl_notificationtimestamp IS NULL OR rc_timestamp < wl_notificationtimestamp' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'onlyByUser' => 'SomeOtherUser' ],
-                               null,
-                               [],
-                               [],
-                               [ 'rc_user_text' => 'SomeOtherUser' ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'notByUser' => 'SomeOtherUser' ],
-                               null,
-                               [],
-                               [],
-                               [ "rc_user_text != 'SomeOtherUser'" ],
-                               [],
-                               [],
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
-                               [ '20151212010101', 123 ],
-                               [],
-                               [],
-                               [
-                                       "(rc_timestamp < '20151212010101') OR ((rc_timestamp = '20151212010101') AND (rc_id <= 123))"
-                               ],
-                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
-                               [],
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_NEWER ],
-                               [ '20151212010101', 123 ],
-                               [],
-                               [],
-                               [
-                                       "(rc_timestamp > '20151212010101') OR ((rc_timestamp = '20151212010101') AND (rc_id >= 123))"
-                               ],
-                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
-                               [],
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
-                               [ '20151212010101', "123; DROP TABLE watchlist;\n--" ],
-                               [],
-                               [],
-                               [
-                                       "(rc_timestamp < '20151212010101') OR ((rc_timestamp = '20151212010101') AND (rc_id <= 123))"
-                               ],
-                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
-                               [],
-                       ],
-               ];
-       }
-
-       /**
-        * @dataProvider getWatchedItemsWithRecentChangeInfoOptionsProvider
-        */
-       public function testGetWatchedItemsWithRecentChangeInfo_optionsAndEmptyResult(
-               array $options,
-               $startFrom,
-               array $expectedExtraTables,
-               array $expectedExtraFields,
-               array $expectedExtraConds,
-               array $expectedDbOptions,
-               array $expectedExtraJoinConds,
-               array $globals = []
-       ) {
-               // Sigh. This test class doesn't extend MediaWikiTestCase, so we have to reinvent setMwGlobals().
-               if ( $globals ) {
-                       $resetGlobals = [];
-                       foreach ( $globals as $k => $v ) {
-                               $resetGlobals[$k] = $GLOBALS[$k];
-                               $GLOBALS[$k] = $v;
-                       }
-                       $reset = new ScopedCallback( function () use ( $resetGlobals ) {
-                               foreach ( $resetGlobals as $k => $v ) {
-                                       $GLOBALS[$k] = $v;
-                               }
-                       } );
-               }
-
-               $expectedTables = array_merge( [ 'recentchanges', 'watchlist', 'page' ], $expectedExtraTables );
-               $expectedFields = array_merge(
-                       [
-                               'rc_id',
-                               'rc_namespace',
-                               'rc_title',
-                               'rc_timestamp',
-                               'rc_type',
-                               'rc_deleted',
-                               'wl_notificationtimestamp',
-
-                               'rc_cur_id',
-                               'rc_this_oldid',
-                               'rc_last_oldid',
-                       ],
-                       $expectedExtraFields
-               );
-               $expectedConds = array_merge(
-                       [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)', ],
-                       $expectedExtraConds
-               );
-               $expectedJoinConds = array_merge(
-                       [
-                               'watchlist' => [
-                                       'INNER JOIN',
-                                       [
-                                               'wl_namespace=rc_namespace',
-                                               'wl_title=rc_title'
-                                       ]
-                               ],
-                               'page' => [
-                                       'LEFT JOIN',
-                                       'rc_cur_id=page_id',
-                               ],
-                       ],
-                       $expectedExtraJoinConds
-               );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               $expectedTables,
-                               $expectedFields,
-                               $expectedConds,
-                               $this->isType( 'string' ),
-                               $expectedDbOptions,
-                               $expectedJoinConds
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo( $user, $options, $startFrom );
-
-               $this->assertEmpty( $items );
-               $this->assertNull( $startFrom );
-       }
-
-       public function filterPatrolledOptionProvider() {
-               return [
-                       [ WatchedItemQueryService::FILTER_PATROLLED ],
-                       [ WatchedItemQueryService::FILTER_NOT_PATROLLED ],
-               ];
-       }
-
-       /**
-        * @dataProvider filterPatrolledOptionProvider
-        */
-       public function testGetWatchedItemsWithRecentChangeInfo_filterPatrolledAndUserWithNoPatrolRights(
-               $filtersOption
-       ) {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               [ 'recentchanges', 'watchlist', 'page' ],
-                               $this->isType( 'array' ),
-                               [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)' ],
-                               $this->isType( 'string' ),
-                               $this->isType( 'array' ),
-                               $this->isType( 'array' )
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $user = $this->getMockNonAnonUserWithIdAndNoPatrolRights( 1 );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
-                       $user,
-                       [ 'filters' => [ $filtersOption ] ]
-               );
-
-               $this->assertEmpty( $items );
-       }
-
-       public function mysqlIndexOptimizationProvider() {
-               return [
-                       [
-                               'mysql',
-                               [],
-                               [ "rc_timestamp > ''" ],
-                       ],
-                       [
-                               'mysql',
-                               [ 'start' => '20151212010101', 'dir' => WatchedItemQueryService::DIR_OLDER ],
-                               [ "rc_timestamp <= '20151212010101'" ],
-                       ],
-                       [
-                               'mysql',
-                               [ 'end' => '20151212010101', 'dir' => WatchedItemQueryService::DIR_OLDER ],
-                               [ "rc_timestamp >= '20151212010101'" ],
-                       ],
-                       [
-                               'postgres',
-                               [],
-                               [],
-                       ],
-               ];
-       }
-
-       /**
-        * @dataProvider mysqlIndexOptimizationProvider
-        */
-       public function testGetWatchedItemsWithRecentChangeInfo_mysqlIndexOptimization(
-               $dbType,
-               array $options,
-               array $expectedExtraConds
-       ) {
-               $commonConds = [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)' ];
-               $conds = array_merge( $commonConds, $expectedExtraConds );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               [ 'recentchanges', 'watchlist', 'page' ],
-                               $this->isType( 'array' ),
-                               $conds,
-                               $this->isType( 'string' ),
-                               $this->isType( 'array' ),
-                               $this->isType( 'array' )
-                       )
-                       ->will( $this->returnValue( [] ) );
-               $mockDb->expects( $this->any() )
-                       ->method( 'getType' )
-                       ->will( $this->returnValue( $dbType ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo( $user, $options );
-
-               $this->assertEmpty( $items );
-       }
-
-       public function userPermissionRelatedExtraChecksProvider() {
-               return [
-                       [
-                               [],
-                               'deletedhistory',
-                               [
-                                       '(rc_type != ' . RC_LOG . ') OR ((rc_deleted & ' . LogPage::DELETED_ACTION . ') != ' .
-                                               LogPage::DELETED_ACTION . ')'
-                               ],
-                       ],
-                       [
-                               [],
-                               'suppressrevision',
-                               [
-                                       '(rc_type != ' . RC_LOG . ') OR (' .
-                                               '(rc_deleted & ' . ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ') != ' .
-                                               ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ')'
-                               ],
-                       ],
-                       [
-                               [],
-                               'viewsuppressed',
-                               [
-                                       '(rc_type != ' . RC_LOG . ') OR (' .
-                                               '(rc_deleted & ' . ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ') != ' .
-                                               ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ')'
-                               ],
-                       ],
-                       [
-                               [ 'onlyByUser' => 'SomeOtherUser' ],
-                               'deletedhistory',
-                               [
-                                       'rc_user_text' => 'SomeOtherUser',
-                                       '(rc_deleted & ' . Revision::DELETED_USER . ') != ' . Revision::DELETED_USER,
-                                       '(rc_type != ' . RC_LOG . ') OR ((rc_deleted & ' . LogPage::DELETED_ACTION . ') != ' .
-                                               LogPage::DELETED_ACTION . ')'
-                               ],
-                       ],
-                       [
-                               [ 'onlyByUser' => 'SomeOtherUser' ],
-                               'suppressrevision',
-                               [
-                                       'rc_user_text' => 'SomeOtherUser',
-                                       '(rc_deleted & ' . ( Revision::DELETED_USER | Revision::DELETED_RESTRICTED ) . ') != ' .
-                                               ( Revision::DELETED_USER | Revision::DELETED_RESTRICTED ),
-                                       '(rc_type != ' . RC_LOG . ') OR (' .
-                                               '(rc_deleted & ' . ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ') != ' .
-                                               ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ')'
-                               ],
-                       ],
-                       [
-                               [ 'onlyByUser' => 'SomeOtherUser' ],
-                               'viewsuppressed',
-                               [
-                                       'rc_user_text' => 'SomeOtherUser',
-                                       '(rc_deleted & ' . ( Revision::DELETED_USER | Revision::DELETED_RESTRICTED ) . ') != ' .
-                                               ( Revision::DELETED_USER | Revision::DELETED_RESTRICTED ),
-                                       '(rc_type != ' . RC_LOG . ') OR (' .
-                                               '(rc_deleted & ' . ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ') != ' .
-                                               ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ')'
-                               ],
-                       ],
-               ];
-       }
-
-       /**
-        * @dataProvider userPermissionRelatedExtraChecksProvider
-        */
-       public function testGetWatchedItemsWithRecentChangeInfo_userPermissionRelatedExtraChecks(
-               array $options,
-               $notAllowedAction,
-               array $expectedExtraConds
-       ) {
-               $commonConds = [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)' ];
-               $conds = array_merge( $commonConds, $expectedExtraConds );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               [ 'recentchanges', 'watchlist', 'page' ],
-                               $this->isType( 'array' ),
-                               $conds,
-                               $this->isType( 'string' ),
-                               $this->isType( 'array' ),
-                               $this->isType( 'array' )
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $user = $this->getMockNonAnonUserWithIdAndRestrictedPermissions( 1, $notAllowedAction );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo( $user, $options );
-
-               $this->assertEmpty( $items );
-       }
-
-       public function testGetWatchedItemsWithRecentChangeInfo_allRevisionsOptionAndEmptyResult() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               [ 'recentchanges', 'watchlist' ],
-                               [
-                                       'rc_id',
-                                       'rc_namespace',
-                                       'rc_title',
-                                       'rc_timestamp',
-                                       'rc_type',
-                                       'rc_deleted',
-                                       'wl_notificationtimestamp',
-
-                                       'rc_cur_id',
-                                       'rc_this_oldid',
-                                       'rc_last_oldid',
-                               ],
-                               [ 'wl_user' => 1, ],
-                               $this->isType( 'string' ),
-                               [],
-                               [
-                                       'watchlist' => [
-                                               'INNER JOIN',
-                                               [
-                                                       'wl_namespace=rc_namespace',
-                                                       'wl_title=rc_title'
-                                               ]
-                                       ],
-                               ]
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo( $user, [ 'allRevisions' => true ] );
-
-               $this->assertEmpty( $items );
-       }
-
-       public function getWatchedItemsWithRecentChangeInfoInvalidOptionsProvider() {
-               return [
-                       [
-                               [ 'rcTypes' => [ 1337 ] ],
-                               null,
-                               'Bad value for parameter $options[\'rcTypes\']',
-                       ],
-                       [
-                               [ 'rcTypes' => [ 'edit' ] ],
-                               null,
-                               'Bad value for parameter $options[\'rcTypes\']',
-                       ],
-                       [
-                               [ 'rcTypes' => [ RC_EDIT, 1337 ] ],
-                               null,
-                               'Bad value for parameter $options[\'rcTypes\']',
-                       ],
-                       [
-                               [ 'dir' => 'foo' ],
-                               null,
-                               'Bad value for parameter $options[\'dir\']',
-                       ],
-                       [
-                               [ 'start' => '20151212010101' ],
-                               null,
-                               'Bad value for parameter $options[\'dir\']: must be provided',
-                       ],
-                       [
-                               [ 'end' => '20151212010101' ],
-                               null,
-                               'Bad value for parameter $options[\'dir\']: must be provided',
-                       ],
-                       [
-                               [],
-                               [ '20151212010101', 123 ],
-                               'Bad value for parameter $options[\'dir\']: must be provided',
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
-                               '20151212010101',
-                               'Bad value for parameter $startFrom: must be a two-element array',
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
-                               [ '20151212010101' ],
-                               'Bad value for parameter $startFrom: must be a two-element array',
-                       ],
-                       [
-                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
-                               [ '20151212010101', 123, 'foo' ],
-                               'Bad value for parameter $startFrom: must be a two-element array',
-                       ],
-                       [
-                               [ 'watchlistOwner' => $this->getMockUnrestrictedNonAnonUserWithId( 2 ) ],
-                               null,
-                               'Bad value for parameter $options[\'watchlistOwnerToken\']',
-                       ],
-                       [
-                               [ 'watchlistOwner' => 'Other User', 'watchlistOwnerToken' => 'some-token' ],
-                               null,
-                               'Bad value for parameter $options[\'watchlistOwner\']',
-                       ],
-               ];
-       }
-
-       /**
-        * @dataProvider getWatchedItemsWithRecentChangeInfoInvalidOptionsProvider
-        */
-       public function testGetWatchedItemsWithRecentChangeInfo_invalidOptions(
-               array $options,
-               $startFrom,
-               $expectedInExceptionMessage
-       ) {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( $this->anything() );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-
-               $this->setExpectedException( InvalidArgumentException::class, $expectedInExceptionMessage );
-               $queryService->getWatchedItemsWithRecentChangeInfo( $user, $options, $startFrom );
-       }
-
-       public function testGetWatchedItemsWithRecentChangeInfo_usedInGeneratorOptionAndEmptyResult() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               [ 'recentchanges', 'watchlist', 'page' ],
-                               [
-                                       'rc_id',
-                                       'rc_namespace',
-                                       'rc_title',
-                                       'rc_timestamp',
-                                       'rc_type',
-                                       'rc_deleted',
-                                       'wl_notificationtimestamp',
-                                       'rc_cur_id',
-                               ],
-                               [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)' ],
-                               $this->isType( 'string' ),
-                               [],
-                               [
-                                       'watchlist' => [
-                                               'INNER JOIN',
-                                               [
-                                                       'wl_namespace=rc_namespace',
-                                                       'wl_title=rc_title'
-                                               ]
-                                       ],
-                                       'page' => [
-                                               'LEFT JOIN',
-                                               'rc_cur_id=page_id',
-                                       ],
-                               ]
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
-                       $user,
-                       [ 'usedInGenerator' => true ]
-               );
-
-               $this->assertEmpty( $items );
-       }
-
-       public function testGetWatchedItemsWithRecentChangeInfo_usedInGeneratorAllRevisionsOptions() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               [ 'recentchanges', 'watchlist' ],
-                               [
-                                       'rc_id',
-                                       'rc_namespace',
-                                       'rc_title',
-                                       'rc_timestamp',
-                                       'rc_type',
-                                       'rc_deleted',
-                                       'wl_notificationtimestamp',
-                                       'rc_this_oldid',
-                               ],
-                               [ 'wl_user' => 1 ],
-                               $this->isType( 'string' ),
-                               [],
-                               [
-                                       'watchlist' => [
-                                               'INNER JOIN',
-                                               [
-                                                       'wl_namespace=rc_namespace',
-                                                       'wl_title=rc_title'
-                                               ]
-                                       ],
-                               ]
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
-                       $user,
-                       [ 'usedInGenerator' => true, 'allRevisions' => true, ]
-               );
-
-               $this->assertEmpty( $items );
-       }
-
-       public function testGetWatchedItemsWithRecentChangeInfo_watchlistOwnerOptionAndEmptyResult() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               $this->isType( 'array' ),
-                               $this->isType( 'array' ),
-                               [
-                                       'wl_user' => 2,
-                                       '(rc_this_oldid=page_latest) OR (rc_type=3)',
-                               ],
-                               $this->isType( 'string' ),
-                               $this->isType( 'array' ),
-                               $this->isType( 'array' )
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-               $otherUser = $this->getMockUnrestrictedNonAnonUserWithId( 2 );
-               $otherUser->expects( $this->once() )
-                       ->method( 'getOption' )
-                       ->with( 'watchlisttoken' )
-                       ->willReturn( '0123456789abcdef' );
-
-               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
-                       $user,
-                       [ 'watchlistOwner' => $otherUser, 'watchlistOwnerToken' => '0123456789abcdef' ]
-               );
-
-               $this->assertEmpty( $items );
-       }
-
-       public function invalidWatchlistTokenProvider() {
-               return [
-                       [ 'wrongToken' ],
-                       [ '' ],
-               ];
-       }
-
-       /**
-        * @dataProvider invalidWatchlistTokenProvider
-        */
-       public function testGetWatchedItemsWithRecentChangeInfo_watchlistOwnerAndInvalidToken( $token ) {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( $this->anything() );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
-               $otherUser = $this->getMockUnrestrictedNonAnonUserWithId( 2 );
-               $otherUser->expects( $this->once() )
-                       ->method( 'getOption' )
-                       ->with( 'watchlisttoken' )
-                       ->willReturn( '0123456789abcdef' );
-
-               $this->setExpectedException( ApiUsageException::class, 'Incorrect watchlist token provided' );
-               $queryService->getWatchedItemsWithRecentChangeInfo(
-                       $user,
-                       [ 'watchlistOwner' => $otherUser, 'watchlistOwnerToken' => $token ]
-               );
-       }
-
-       public function testGetWatchedItemsForUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                               [ 'wl_user' => 1 ]
-                       )
-                       ->will( $this->returnValue( [
-                               $this->getFakeRow( [
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'Foo1',
-                                       'wl_notificationtimestamp' => '20151212010101',
-                               ] ),
-                               $this->getFakeRow( [
-                                       'wl_namespace' => 1,
-                                       'wl_title' => 'Foo2',
-                                       'wl_notificationtimestamp' => null,
-                               ] ),
-                       ] ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-               $user = $this->getMockNonAnonUserWithId( 1 );
-
-               $items = $queryService->getWatchedItemsForUser( $user );
-
-               $this->assertInternalType( 'array', $items );
-               $this->assertCount( 2, $items );
-               $this->assertContainsOnlyInstancesOf( WatchedItem::class, $items );
-               $this->assertEquals(
-                       new WatchedItem( $user, new TitleValue( 0, 'Foo1' ), '20151212010101' ),
-                       $items[0]
-               );
-               $this->assertEquals(
-                       new WatchedItem( $user, new TitleValue( 1, 'Foo2' ), null ),
-                       $items[1]
-               );
-       }
-
-       public function provideGetWatchedItemsForUserOptions() {
-               return [
-                       [
-                               [ 'namespaceIds' => [ 0, 1 ], ],
-                               [ 'wl_namespace' => [ 0, 1 ], ],
-                               []
-                       ],
-                       [
-                               [ 'sort' => WatchedItemQueryService::SORT_ASC, ],
-                               [],
-                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
-                       ],
-                       [
-                               [
-                                       'namespaceIds' => [ 0 ],
-                                       'sort' => WatchedItemQueryService::SORT_ASC,
-                               ],
-                               [ 'wl_namespace' => [ 0 ], ],
-                               [ 'ORDER BY' => 'wl_title ASC' ]
-                       ],
-                       [
-                               [ 'limit' => 10 ],
-                               [],
-                               [ 'LIMIT' => 10 ]
-                       ],
-                       [
-                               [
-                                       'namespaceIds' => [ 0, "1; DROP TABLE watchlist;\n--" ],
-                                       'limit' => "10; DROP TABLE watchlist;\n--",
-                               ],
-                               [ 'wl_namespace' => [ 0, 1 ], ],
-                               [ 'LIMIT' => 10 ]
-                       ],
-                       [
-                               [ 'filter' => WatchedItemQueryService::FILTER_CHANGED ],
-                               [ 'wl_notificationtimestamp IS NOT NULL' ],
-                               []
-                       ],
-                       [
-                               [ 'filter' => WatchedItemQueryService::FILTER_NOT_CHANGED ],
-                               [ 'wl_notificationtimestamp IS NULL' ],
-                               []
-                       ],
-                       [
-                               [ 'sort' => WatchedItemQueryService::SORT_DESC, ],
-                               [],
-                               [ 'ORDER BY' => [ 'wl_namespace DESC', 'wl_title DESC' ] ]
-                       ],
-                       [
-                               [
-                                       'namespaceIds' => [ 0 ],
-                                       'sort' => WatchedItemQueryService::SORT_DESC,
-                               ],
-                               [ 'wl_namespace' => [ 0 ], ],
-                               [ 'ORDER BY' => 'wl_title DESC' ]
-                       ],
-               ];
-       }
-
-       /**
-        * @dataProvider provideGetWatchedItemsForUserOptions
-        */
-       public function testGetWatchedItemsForUser_optionsAndEmptyResult(
-               array $options,
-               array $expectedConds,
-               array $expectedDbOptions
-       ) {
-               $mockDb = $this->getMockDb();
-               $user = $this->getMockNonAnonUserWithId( 1 );
-
-               $expectedConds = array_merge( [ 'wl_user' => 1 ], $expectedConds );
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                               $expectedConds,
-                               $this->isType( 'string' ),
-                               $expectedDbOptions
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-
-               $items = $queryService->getWatchedItemsForUser( $user, $options );
-               $this->assertEmpty( $items );
-       }
-
-       public function provideGetWatchedItemsForUser_fromUntilStartFromOptions() {
-               return [
-                       [
-                               [
-                                       'from' => new TitleValue( 0, 'SomeDbKey' ),
-                                       'sort' => WatchedItemQueryService::SORT_ASC
-                               ],
-                               [ "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'SomeDbKey'))", ],
-                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
-                       ],
-                       [
-                               [
-                                       'from' => new TitleValue( 0, 'SomeDbKey' ),
-                                       'sort' => WatchedItemQueryService::SORT_DESC,
-                               ],
-                               [ "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeDbKey'))", ],
-                               [ 'ORDER BY' => [ 'wl_namespace DESC', 'wl_title DESC' ] ]
-                       ],
-                       [
-                               [
-                                       'until' => new TitleValue( 0, 'SomeDbKey' ),
-                                       'sort' => WatchedItemQueryService::SORT_ASC
-                               ],
-                               [ "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeDbKey'))", ],
-                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
-                       ],
-                       [
-                               [
-                                       'until' => new TitleValue( 0, 'SomeDbKey' ),
-                                       'sort' => WatchedItemQueryService::SORT_DESC
-                               ],
-                               [ "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'SomeDbKey'))", ],
-                               [ 'ORDER BY' => [ 'wl_namespace DESC', 'wl_title DESC' ] ]
-                       ],
-                       [
-                               [
-                                       'from' => new TitleValue( 0, 'AnotherDbKey' ),
-                                       'until' => new TitleValue( 0, 'SomeOtherDbKey' ),
-                                       'startFrom' => new TitleValue( 0, 'SomeDbKey' ),
-                                       'sort' => WatchedItemQueryService::SORT_ASC
-                               ],
-                               [
-                                       "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'AnotherDbKey'))",
-                                       "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeOtherDbKey'))",
-                                       "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'SomeDbKey'))",
-                               ],
-                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
-                       ],
-                       [
-                               [
-                                       'from' => new TitleValue( 0, 'SomeOtherDbKey' ),
-                                       'until' => new TitleValue( 0, 'AnotherDbKey' ),
-                                       'startFrom' => new TitleValue( 0, 'SomeDbKey' ),
-                                       'sort' => WatchedItemQueryService::SORT_DESC
-                               ],
-                               [
-                                       "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeOtherDbKey'))",
-                                       "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'AnotherDbKey'))",
-                                       "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeDbKey'))",
-                               ],
-                               [ 'ORDER BY' => [ 'wl_namespace DESC', 'wl_title DESC' ] ]
-                       ],
-               ];
-       }
-
-       /**
-        * @dataProvider provideGetWatchedItemsForUser_fromUntilStartFromOptions
-        */
-       public function testGetWatchedItemsForUser_fromUntilStartFromOptions(
-               array $options,
-               array $expectedConds,
-               array $expectedDbOptions
-       ) {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-
-               $expectedConds = array_merge( [ 'wl_user' => 1 ], $expectedConds );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->any() )
-                       ->method( 'addQuotes' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return "'$value'";
-                       } ) );
-               $mockDb->expects( $this->any() )
-                       ->method( 'makeList' )
-                       ->with(
-                               $this->isType( 'array' ),
-                               $this->isType( 'int' )
-                       )
-                       ->will( $this->returnCallback( function ( $a, $conj ) {
-                               $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
-                               return join( $sqlConj, array_map( function ( $s ) {
-                                       return '(' . $s . ')';
-                               }, $a
-                               ) );
-                       } ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                               $expectedConds,
-                               $this->isType( 'string' ),
-                               $expectedDbOptions
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-
-               $items = $queryService->getWatchedItemsForUser( $user, $options );
-               $this->assertEmpty( $items );
-       }
-
-       public function getWatchedItemsForUserInvalidOptionsProvider() {
-               return [
-                       [
-                               [ 'sort' => 'foo' ],
-                               'Bad value for parameter $options[\'sort\']'
-                       ],
-                       [
-                               [ 'filter' => 'foo' ],
-                               'Bad value for parameter $options[\'filter\']'
-                       ],
-                       [
-                               [ 'from' => new TitleValue( 0, 'SomeDbKey' ), ],
-                               'Bad value for parameter $options[\'sort\']: must be provided'
-                       ],
-                       [
-                               [ 'until' => new TitleValue( 0, 'SomeDbKey' ), ],
-                               'Bad value for parameter $options[\'sort\']: must be provided'
-                       ],
-                       [
-                               [ 'startFrom' => new TitleValue( 0, 'SomeDbKey' ), ],
-                               'Bad value for parameter $options[\'sort\']: must be provided'
-                       ],
-               ];
-       }
-
-       /**
-        * @dataProvider getWatchedItemsForUserInvalidOptionsProvider
-        */
-       public function testGetWatchedItemsForUser_invalidOptionThrowsException(
-               array $options,
-               $expectedInExceptionMessage
-       ) {
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $this->getMockDb() ) );
-
-               $this->setExpectedException( InvalidArgumentException::class, $expectedInExceptionMessage );
-               $queryService->getWatchedItemsForUser( $this->getMockNonAnonUserWithId( 1 ), $options );
-       }
-
-       public function testGetWatchedItemsForUser_userNotAllowedToViewWatchlist() {
-               $mockDb = $this->getMockDb();
-
-               $mockDb->expects( $this->never() )
-                       ->method( $this->anything() );
-
-               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
-
-               $items = $queryService->getWatchedItemsForUser( $this->getMockAnonUser() );
-               $this->assertEmpty( $items );
-       }
-
-}
diff --git a/tests/phpunit/includes/WatchedItemStoreIntegrationTest.php b/tests/phpunit/includes/WatchedItemStoreIntegrationTest.php
deleted file mode 100644 (file)
index 61b62aa..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-
-use MediaWiki\MediaWikiServices;
-
-/**
- * @author Addshore
- *
- * @group Database
- *
- * @covers WatchedItemStore
- */
-class WatchedItemStoreIntegrationTest extends MediaWikiTestCase {
-
-       public function setUp() {
-               parent::setUp();
-               self::$users['WatchedItemStoreIntegrationTestUser']
-                       = new TestUser( 'WatchedItemStoreIntegrationTestUser' );
-       }
-
-       private function getUser() {
-               return self::$users['WatchedItemStoreIntegrationTestUser']->getUser();
-       }
-
-       public function testWatchAndUnWatchItem() {
-               $user = $this->getUser();
-               $title = Title::newFromText( 'WatchedItemStoreIntegrationTestPage' );
-               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
-               // Cleanup after previous tests
-               $store->removeWatch( $user, $title );
-               $initialWatchers = $store->countWatchers( $title );
-               $initialUserWatchedItems = $store->countWatchedItems( $user );
-
-               $this->assertFalse(
-                       $store->isWatched( $user, $title ),
-                       'Page should not initially be watched'
-               );
-
-               $store->addWatch( $user, $title );
-               $this->assertTrue(
-                       $store->isWatched( $user, $title ),
-                       'Page should be watched'
-               );
-               $this->assertEquals( $initialUserWatchedItems + 1, $store->countWatchedItems( $user ) );
-               $watchedItemsForUser = $store->getWatchedItemsForUser( $user );
-               $this->assertCount( $initialUserWatchedItems + 1, $watchedItemsForUser );
-               $watchedItemsForUserHasExpectedItem = false;
-               foreach ( $watchedItemsForUser as $watchedItem ) {
-                       if (
-                               $watchedItem->getUser()->equals( $user ) &&
-                               $watchedItem->getLinkTarget() == $title->getTitleValue()
-                       ) {
-                               $watchedItemsForUserHasExpectedItem = true;
-                       }
-               }
-               $this->assertTrue(
-                       $watchedItemsForUserHasExpectedItem,
-                       'getWatchedItemsForUser should contain the page'
-               );
-               $this->assertEquals( $initialWatchers + 1, $store->countWatchers( $title ) );
-               $this->assertEquals(
-                       $initialWatchers + 1,
-                       $store->countWatchersMultiple( [ $title ] )[$title->getNamespace()][$title->getDBkey()]
-               );
-               $this->assertEquals(
-                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => $initialWatchers + 1 ] ],
-                       $store->countWatchersMultiple( [ $title ], [ 'minimumWatchers' => $initialWatchers + 1 ] )
-               );
-               $this->assertEquals(
-                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => 0 ] ],
-                       $store->countWatchersMultiple( [ $title ], [ 'minimumWatchers' => $initialWatchers + 2 ] )
-               );
-               $this->assertEquals(
-                       [ $title->getNamespace() => [ $title->getDBkey() => null ] ],
-                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
-               );
-
-               $store->removeWatch( $user, $title );
-               $this->assertFalse(
-                       $store->isWatched( $user, $title ),
-                       'Page should be unwatched'
-               );
-               $this->assertEquals( $initialUserWatchedItems, $store->countWatchedItems( $user ) );
-               $watchedItemsForUser = $store->getWatchedItemsForUser( $user );
-               $this->assertCount( $initialUserWatchedItems, $watchedItemsForUser );
-               $watchedItemsForUserHasExpectedItem = false;
-               foreach ( $watchedItemsForUser as $watchedItem ) {
-                       if (
-                               $watchedItem->getUser()->equals( $user ) &&
-                               $watchedItem->getLinkTarget() == $title->getTitleValue()
-                       ) {
-                               $watchedItemsForUserHasExpectedItem = true;
-                       }
-               }
-               $this->assertFalse(
-                       $watchedItemsForUserHasExpectedItem,
-                       'getWatchedItemsForUser should not contain the page'
-               );
-               $this->assertEquals( $initialWatchers, $store->countWatchers( $title ) );
-               $this->assertEquals(
-                       $initialWatchers,
-                       $store->countWatchersMultiple( [ $title ] )[$title->getNamespace()][$title->getDBkey()]
-               );
-               $this->assertEquals(
-                       [ $title->getNamespace() => [ $title->getDBkey() => false ] ],
-                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
-               );
-       }
-
-       public function testUpdateResetAndSetNotificationTimestamp() {
-               $user = $this->getUser();
-               $otherUser = ( new TestUser( 'WatchedItemStoreIntegrationTestUser_otherUser' ) )->getUser();
-               $title = Title::newFromText( 'WatchedItemStoreIntegrationTestPage' );
-               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
-               $store->addWatch( $user, $title );
-               $this->assertNull( $store->loadWatchedItem( $user, $title )->getNotificationTimestamp() );
-               $initialVisitingWatchers = $store->countVisitingWatchers( $title, '20150202020202' );
-               $initialUnreadNotifications = $store->countUnreadNotifications( $user );
-
-               $store->updateNotificationTimestamp( $otherUser, $title, '20150202010101' );
-               $this->assertEquals(
-                       '20150202010101',
-                       $store->loadWatchedItem( $user, $title )->getNotificationTimestamp()
-               );
-               $this->assertEquals(
-                       [ $title->getNamespace() => [ $title->getDBkey() => '20150202010101' ] ],
-                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
-               );
-               $this->assertEquals(
-                       $initialVisitingWatchers - 1,
-                       $store->countVisitingWatchers( $title, '20150202020202' )
-               );
-               $this->assertEquals(
-                       $initialVisitingWatchers - 1,
-                       $store->countVisitingWatchersMultiple(
-                               [ [ $title, '20150202020202' ] ]
-                       )[$title->getNamespace()][$title->getDBkey()]
-               );
-               $this->assertEquals(
-                       $initialUnreadNotifications + 1,
-                       $store->countUnreadNotifications( $user )
-               );
-               $this->assertSame(
-                       true,
-                       $store->countUnreadNotifications( $user, $initialUnreadNotifications + 1 )
-               );
-
-               $this->assertTrue( $store->resetNotificationTimestamp( $user, $title ) );
-               $this->assertNull( $store->getWatchedItem( $user, $title )->getNotificationTimestamp() );
-               $this->assertEquals(
-                       [ $title->getNamespace() => [ $title->getDBkey() => null ] ],
-                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
-               );
-               $this->assertEquals(
-                       $initialVisitingWatchers,
-                       $store->countVisitingWatchers( $title, '20150202020202' )
-               );
-               $this->assertEquals(
-                       $initialVisitingWatchers,
-                       $store->countVisitingWatchersMultiple(
-                               [ [ $title, '20150202020202' ] ]
-                       )[$title->getNamespace()][$title->getDBkey()]
-               );
-               $this->assertEquals(
-                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => $initialVisitingWatchers ] ],
-                       $store->countVisitingWatchersMultiple(
-                               [ [ $title, '20150202020202' ] ], $initialVisitingWatchers
-                       )
-               );
-               $this->assertEquals(
-                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => 0 ] ],
-                       $store->countVisitingWatchersMultiple(
-                               [ [ $title, '20150202020202' ] ], $initialVisitingWatchers + 1
-                       )
-               );
-
-               // setNotificationTimestampsForUser specifying a title
-               $this->assertTrue(
-                       $store->setNotificationTimestampsForUser( $user, '20200202020202', [ $title ] )
-               );
-               $this->assertEquals(
-                       '20200202020202',
-                       $store->getWatchedItem( $user, $title )->getNotificationTimestamp()
-               );
-
-               // setNotificationTimestampsForUser not specifying a title
-               $this->assertTrue(
-                       $store->setNotificationTimestampsForUser( $user, '20210202020202' )
-               );
-               $this->assertEquals(
-                       '20210202020202',
-                       $store->getWatchedItem( $user, $title )->getNotificationTimestamp()
-               );
-       }
-
-       public function testDuplicateAllAssociatedEntries() {
-               $user = $this->getUser();
-               $titleOld = Title::newFromText( 'WatchedItemStoreIntegrationTestPageOld' );
-               $titleNew = Title::newFromText( 'WatchedItemStoreIntegrationTestPageNew' );
-               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
-               $store->addWatch( $user, $titleOld->getSubjectPage() );
-               $store->addWatch( $user, $titleOld->getTalkPage() );
-               // Cleanup after previous tests
-               $store->removeWatch( $user, $titleNew->getSubjectPage() );
-               $store->removeWatch( $user, $titleNew->getTalkPage() );
-
-               $store->duplicateAllAssociatedEntries( $titleOld, $titleNew );
-
-               $this->assertTrue( $store->isWatched( $user, $titleOld->getSubjectPage() ) );
-               $this->assertTrue( $store->isWatched( $user, $titleOld->getTalkPage() ) );
-               $this->assertTrue( $store->isWatched( $user, $titleNew->getSubjectPage() ) );
-               $this->assertTrue( $store->isWatched( $user, $titleNew->getTalkPage() ) );
-       }
-
-}
diff --git a/tests/phpunit/includes/WatchedItemStoreUnitTest.php b/tests/phpunit/includes/WatchedItemStoreUnitTest.php
deleted file mode 100644 (file)
index 950e220..0000000
+++ /dev/null
@@ -1,2674 +0,0 @@
-<?php
-use MediaWiki\Linker\LinkTarget;
-use Wikimedia\ScopedCallback;
-
-/**
- * @author Addshore
- *
- * @covers WatchedItemStore
- */
-class WatchedItemStoreUnitTest extends MediaWikiTestCase {
-
-       /**
-        * @return PHPUnit_Framework_MockObject_MockObject|IDatabase
-        */
-       private function getMockDb() {
-               return $this->createMock( IDatabase::class );
-       }
-
-       /**
-        * @return PHPUnit_Framework_MockObject_MockObject|LoadBalancer
-        */
-       private function getMockLoadBalancer(
-               $mockDb,
-               $expectedConnectionType = null
-       ) {
-               $mock = $this->getMockBuilder( LoadBalancer::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-               if ( $expectedConnectionType !== null ) {
-                       $mock->expects( $this->any() )
-                               ->method( 'getConnectionRef' )
-                               ->with( $expectedConnectionType )
-                               ->will( $this->returnValue( $mockDb ) );
-               } else {
-                       $mock->expects( $this->any() )
-                               ->method( 'getConnectionRef' )
-                               ->will( $this->returnValue( $mockDb ) );
-               }
-               return $mock;
-       }
-
-       /**
-        * @return PHPUnit_Framework_MockObject_MockObject|HashBagOStuff
-        */
-       private function getMockCache() {
-               $mock = $this->getMockBuilder( HashBagOStuff::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-               $mock->expects( $this->any() )
-                       ->method( 'makeKey' )
-                       ->will( $this->returnCallback( function () {
-                               return implode( ':', func_get_args() );
-                       } ) );
-               return $mock;
-       }
-
-       /**
-        * @return PHPUnit_Framework_MockObject_MockObject|ReadOnlyMode
-        */
-       private function getMockReadOnlyMode( $readOnly = false ) {
-               $mock = $this->getMockBuilder( ReadOnlyMode::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-               $mock->expects( $this->any() )
-                       ->method( 'isReadOnly' )
-                       ->will( $this->returnValue( $readOnly ) );
-               return $mock;
-       }
-
-       /**
-        * @param int $id
-        * @return PHPUnit_Framework_MockObject_MockObject|User
-        */
-       private function getMockNonAnonUserWithId( $id ) {
-               $mock = $this->createMock( User::class );
-               $mock->expects( $this->any() )
-                       ->method( 'isAnon' )
-                       ->will( $this->returnValue( false ) );
-               $mock->expects( $this->any() )
-                       ->method( 'getId' )
-                       ->will( $this->returnValue( $id ) );
-               return $mock;
-       }
-
-       /**
-        * @return User
-        */
-       private function getAnonUser() {
-               return User::newFromName( 'Anon_User' );
-       }
-
-       private function getFakeRow( array $rowValues ) {
-               $fakeRow = new stdClass();
-               foreach ( $rowValues as $valueName => $value ) {
-                       $fakeRow->$valueName = $value;
-               }
-               return $fakeRow;
-       }
-
-       private function newWatchedItemStore( LoadBalancer $loadBalancer, HashBagOStuff $cache,
-               ReadOnlyMode $readOnlyMode
-       ) {
-               return new WatchedItemStore(
-                       $loadBalancer,
-                       $cache,
-                       $readOnlyMode
-               );
-       }
-
-       public function testCountWatchedItems() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'selectField' )
-                       ->with(
-                               'watchlist',
-                               'COUNT(*)',
-                               [
-                                       'wl_user' => $user->getId(),
-                               ],
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 12 ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals( 12, $store->countWatchedItems( $user ) );
-       }
-
-       public function testCountWatchers() {
-               $titleValue = new TitleValue( 0, 'SomeDbKey' );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'selectField' )
-                       ->with(
-                               'watchlist',
-                               'COUNT(*)',
-                               [
-                                       'wl_namespace' => $titleValue->getNamespace(),
-                                       'wl_title' => $titleValue->getDBkey(),
-                               ],
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 7 ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals( 7, $store->countWatchers( $titleValue ) );
-       }
-
-       public function testCountWatchersMultiple() {
-               $titleValues = [
-                       new TitleValue( 0, 'SomeDbKey' ),
-                       new TitleValue( 0, 'OtherDbKey' ),
-                       new TitleValue( 1, 'AnotherDbKey' ),
-               ];
-
-               $mockDb = $this->getMockDb();
-
-               $dbResult = [
-                       $this->getFakeRow( [ 'wl_title' => 'SomeDbKey', 'wl_namespace' => 0, 'watchers' => 100 ] ),
-                       $this->getFakeRow( [ 'wl_title' => 'OtherDbKey', 'wl_namespace' => 0, 'watchers' => 300 ] ),
-                       $this->getFakeRow( [ 'wl_title' => 'AnotherDbKey', 'wl_namespace' => 1, 'watchers' => 500 ]
-                       ),
-               ];
-               $mockDb->expects( $this->once() )
-                       ->method( 'makeWhereFrom2d' )
-                       ->with(
-                               [ [ 'SomeDbKey' => 1, 'OtherDbKey' => 1 ], [ 'AnotherDbKey' => 1 ] ],
-                               $this->isType( 'string' ),
-                               $this->isType( 'string' )
-                               )
-                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_title', 'wl_namespace', 'watchers' => 'COUNT(*)' ],
-                               [ 'makeWhereFrom2d return value' ],
-                               $this->isType( 'string' ),
-                               [
-                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
-                               ]
-                       )
-                       ->will(
-                               $this->returnValue( $dbResult )
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $expected = [
-                       0 => [ 'SomeDbKey' => 100, 'OtherDbKey' => 300 ],
-                       1 => [ 'AnotherDbKey' => 500 ],
-               ];
-               $this->assertEquals( $expected, $store->countWatchersMultiple( $titleValues ) );
-       }
-
-       public function provideIntWithDbUnsafeVersion() {
-               return [
-                       [ 50 ],
-                       [ "50; DROP TABLE watchlist;\n--" ],
-               ];
-       }
-
-       /**
-        * @dataProvider provideIntWithDbUnsafeVersion
-        */
-       public function testCountWatchersMultiple_withMinimumWatchers( $minWatchers ) {
-               $titleValues = [
-                       new TitleValue( 0, 'SomeDbKey' ),
-                       new TitleValue( 0, 'OtherDbKey' ),
-                       new TitleValue( 1, 'AnotherDbKey' ),
-               ];
-
-               $mockDb = $this->getMockDb();
-
-               $dbResult = [
-                       $this->getFakeRow( [ 'wl_title' => 'SomeDbKey', 'wl_namespace' => 0, 'watchers' => 100 ] ),
-                       $this->getFakeRow( [ 'wl_title' => 'OtherDbKey', 'wl_namespace' => 0, 'watchers' => 300 ] ),
-                       $this->getFakeRow( [ 'wl_title' => 'AnotherDbKey', 'wl_namespace' => 1, 'watchers' => 500 ]
-                       ),
-               ];
-               $mockDb->expects( $this->once() )
-                       ->method( 'makeWhereFrom2d' )
-                       ->with(
-                               [ [ 'SomeDbKey' => 1, 'OtherDbKey' => 1 ], [ 'AnotherDbKey' => 1 ] ],
-                               $this->isType( 'string' ),
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_title', 'wl_namespace', 'watchers' => 'COUNT(*)' ],
-                               [ 'makeWhereFrom2d return value' ],
-                               $this->isType( 'string' ),
-                               [
-                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
-                                       'HAVING' => 'COUNT(*) >= 50',
-                               ]
-                       )
-                       ->will(
-                               $this->returnValue( $dbResult )
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $expected = [
-                       0 => [ 'SomeDbKey' => 100, 'OtherDbKey' => 300 ],
-                       1 => [ 'AnotherDbKey' => 500 ],
-               ];
-               $this->assertEquals(
-                       $expected,
-                       $store->countWatchersMultiple( $titleValues, [ 'minimumWatchers' => $minWatchers ] )
-               );
-       }
-
-       public function testCountVisitingWatchers() {
-               $titleValue = new TitleValue( 0, 'SomeDbKey' );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'selectField' )
-                       ->with(
-                               'watchlist',
-                               'COUNT(*)',
-                               [
-                                       'wl_namespace' => $titleValue->getNamespace(),
-                                       'wl_title' => $titleValue->getDBkey(),
-                                       'wl_notificationtimestamp >= \'TS111TS\' OR wl_notificationtimestamp IS NULL',
-                               ],
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 7 ) );
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'addQuotes' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return "'$value'";
-                       } ) );
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'timestamp' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return 'TS' . $value . 'TS';
-                       } ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals( 7, $store->countVisitingWatchers( $titleValue, '111' ) );
-       }
-
-       public function testCountVisitingWatchersMultiple() {
-               $titleValuesWithThresholds = [
-                       [ new TitleValue( 0, 'SomeDbKey' ), '111' ],
-                       [ new TitleValue( 0, 'OtherDbKey' ), '111' ],
-                       [ new TitleValue( 1, 'AnotherDbKey' ), '123' ],
-               ];
-
-               $dbResult = [
-                       $this->getFakeRow( [ 'wl_title' => 'SomeDbKey', 'wl_namespace' => 0, 'watchers' => 100 ] ),
-                       $this->getFakeRow( [ 'wl_title' => 'OtherDbKey', 'wl_namespace' => 0, 'watchers' => 300 ] ),
-                       $this->getFakeRow( [ 'wl_title' => 'AnotherDbKey', 'wl_namespace' => 1, 'watchers' => 500 ] ),
-               ];
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->exactly( 2 * 3 ) )
-                       ->method( 'addQuotes' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return "'$value'";
-                       } ) );
-               $mockDb->expects( $this->exactly( 3 ) )
-                       ->method( 'timestamp' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return 'TS' . $value . 'TS';
-                       } ) );
-               $mockDb->expects( $this->any() )
-                       ->method( 'makeList' )
-                       ->with(
-                               $this->isType( 'array' ),
-                               $this->isType( 'int' )
-                       )
-                       ->will( $this->returnCallback( function ( $a, $conj ) {
-                               $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
-                               return join( $sqlConj, array_map( function ( $s ) {
-                                       return '(' . $s . ')';
-                               }, $a
-                               ) );
-                       } ) );
-               $mockDb->expects( $this->never() )
-                       ->method( 'makeWhereFrom2d' );
-
-               $expectedCond =
-                       '((wl_namespace = 0) AND (' .
-                       "(((wl_title = 'SomeDbKey') AND (" .
-                       "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
-                       ')) OR (' .
-                       "(wl_title = 'OtherDbKey') AND (" .
-                       "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
-                       '))))' .
-                       ') OR ((wl_namespace = 1) AND (' .
-                       "(((wl_title = 'AnotherDbKey') AND (".
-                       "(wl_notificationtimestamp >= 'TS123TS') OR (wl_notificationtimestamp IS NULL)" .
-                       ')))))';
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'watchers' => 'COUNT(*)' ],
-                               $expectedCond,
-                               $this->isType( 'string' ),
-                               [
-                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
-                               ]
-                       )
-                       ->will(
-                               $this->returnValue( $dbResult )
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $expected = [
-                       0 => [ 'SomeDbKey' => 100, 'OtherDbKey' => 300 ],
-                       1 => [ 'AnotherDbKey' => 500 ],
-               ];
-               $this->assertEquals(
-                       $expected,
-                       $store->countVisitingWatchersMultiple( $titleValuesWithThresholds )
-               );
-       }
-
-       public function testCountVisitingWatchersMultiple_withMissingTargets() {
-               $titleValuesWithThresholds = [
-                       [ new TitleValue( 0, 'SomeDbKey' ), '111' ],
-                       [ new TitleValue( 0, 'OtherDbKey' ), '111' ],
-                       [ new TitleValue( 1, 'AnotherDbKey' ), '123' ],
-                       [ new TitleValue( 0, 'SomeNotExisitingDbKey' ), null ],
-                       [ new TitleValue( 0, 'OtherNotExisitingDbKey' ), null ],
-               ];
-
-               $dbResult = [
-                       $this->getFakeRow( [ 'wl_title' => 'SomeDbKey', 'wl_namespace' => 0, 'watchers' => 100 ] ),
-                       $this->getFakeRow( [ 'wl_title' => 'OtherDbKey', 'wl_namespace' => 0, 'watchers' => 300 ] ),
-                       $this->getFakeRow( [ 'wl_title' => 'AnotherDbKey', 'wl_namespace' => 1, 'watchers' => 500 ] ),
-                       $this->getFakeRow(
-                               [ 'wl_title' => 'SomeNotExisitingDbKey', 'wl_namespace' => 0, 'watchers' => 100 ]
-                       ),
-                       $this->getFakeRow(
-                               [ 'wl_title' => 'OtherNotExisitingDbKey', 'wl_namespace' => 0, 'watchers' => 200 ]
-                       ),
-               ];
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->exactly( 2 * 3 ) )
-                       ->method( 'addQuotes' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return "'$value'";
-                       } ) );
-               $mockDb->expects( $this->exactly( 3 ) )
-                       ->method( 'timestamp' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return 'TS' . $value . 'TS';
-                       } ) );
-               $mockDb->expects( $this->any() )
-                       ->method( 'makeList' )
-                       ->with(
-                               $this->isType( 'array' ),
-                               $this->isType( 'int' )
-                       )
-                       ->will( $this->returnCallback( function ( $a, $conj ) {
-                               $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
-                               return join( $sqlConj, array_map( function ( $s ) {
-                                       return '(' . $s . ')';
-                               }, $a
-                               ) );
-                       } ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'makeWhereFrom2d' )
-                       ->with(
-                               [ [ 'SomeNotExisitingDbKey' => 1, 'OtherNotExisitingDbKey' => 1 ] ],
-                               $this->isType( 'string' ),
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
-
-               $expectedCond =
-                       '((wl_namespace = 0) AND (' .
-                       "(((wl_title = 'SomeDbKey') AND (" .
-                       "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
-                       ')) OR (' .
-                       "(wl_title = 'OtherDbKey') AND (" .
-                       "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
-                       '))))' .
-                       ') OR ((wl_namespace = 1) AND (' .
-                       "(((wl_title = 'AnotherDbKey') AND (".
-                       "(wl_notificationtimestamp >= 'TS123TS') OR (wl_notificationtimestamp IS NULL)" .
-                       '))))' .
-                       ') OR ' .
-                       '(makeWhereFrom2d return value)';
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'watchers' => 'COUNT(*)' ],
-                               $expectedCond,
-                               $this->isType( 'string' ),
-                               [
-                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
-                               ]
-                       )
-                       ->will(
-                               $this->returnValue( $dbResult )
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $expected = [
-                       0 => [
-                               'SomeDbKey' => 100, 'OtherDbKey' => 300,
-                               'SomeNotExisitingDbKey' => 100, 'OtherNotExisitingDbKey' => 200
-                       ],
-                       1 => [ 'AnotherDbKey' => 500 ],
-               ];
-               $this->assertEquals(
-                       $expected,
-                       $store->countVisitingWatchersMultiple( $titleValuesWithThresholds )
-               );
-       }
-
-       /**
-        * @dataProvider provideIntWithDbUnsafeVersion
-        */
-       public function testCountVisitingWatchersMultiple_withMinimumWatchers( $minWatchers ) {
-               $titleValuesWithThresholds = [
-                       [ new TitleValue( 0, 'SomeDbKey' ), '111' ],
-                       [ new TitleValue( 0, 'OtherDbKey' ), '111' ],
-                       [ new TitleValue( 1, 'AnotherDbKey' ), '123' ],
-               ];
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->any() )
-                       ->method( 'makeList' )
-                       ->will( $this->returnValue( 'makeList return value' ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'watchers' => 'COUNT(*)' ],
-                               'makeList return value',
-                               $this->isType( 'string' ),
-                               [
-                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
-                                       'HAVING' => 'COUNT(*) >= 50',
-                               ]
-                       )
-                       ->will(
-                               $this->returnValue( [] )
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $expected = [
-                       0 => [ 'SomeDbKey' => 0, 'OtherDbKey' => 0 ],
-                       1 => [ 'AnotherDbKey' => 0 ],
-               ];
-               $this->assertEquals(
-                       $expected,
-                       $store->countVisitingWatchersMultiple( $titleValuesWithThresholds, $minWatchers )
-               );
-       }
-
-       public function testCountUnreadNotifications() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'selectRowCount' )
-                       ->with(
-                               'watchlist',
-                               '1',
-                               [
-                                       "wl_notificationtimestamp IS NOT NULL",
-                                       'wl_user' => 1,
-                               ],
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 9 ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals( 9, $store->countUnreadNotifications( $user ) );
-       }
-
-       /**
-        * @dataProvider provideIntWithDbUnsafeVersion
-        */
-       public function testCountUnreadNotifications_withUnreadLimit_overLimit( $limit ) {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'selectRowCount' )
-                       ->with(
-                               'watchlist',
-                               '1',
-                               [
-                                       "wl_notificationtimestamp IS NOT NULL",
-                                       'wl_user' => 1,
-                               ],
-                               $this->isType( 'string' ),
-                               [ 'LIMIT' => 50 ]
-                       )
-                       ->will( $this->returnValue( 50 ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertSame(
-                       true,
-                       $store->countUnreadNotifications( $user, $limit )
-               );
-       }
-
-       /**
-        * @dataProvider provideIntWithDbUnsafeVersion
-        */
-       public function testCountUnreadNotifications_withUnreadLimit_underLimit( $limit ) {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'selectRowCount' )
-                       ->with(
-                               'watchlist',
-                               '1',
-                               [
-                                       "wl_notificationtimestamp IS NOT NULL",
-                                       'wl_user' => 1,
-                               ],
-                               $this->isType( 'string' ),
-                               [ 'LIMIT' => 50 ]
-                       )
-                       ->will( $this->returnValue( 9 ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals(
-                       9,
-                       $store->countUnreadNotifications( $user, $limit )
-               );
-       }
-
-       public function testDuplicateEntry_nothingToDuplicate() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       'wl_user',
-                                       'wl_notificationtimestamp',
-                               ],
-                               [
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'Old_Title',
-                               ],
-                               'WatchedItemStore::duplicateEntry',
-                               [ 'FOR UPDATE' ]
-                       )
-                       ->will( $this->returnValue( new FakeResultWrapper( [] ) ) );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $this->getMockCache(),
-                       $this->getMockReadOnlyMode()
-               );
-
-               $store->duplicateEntry(
-                       Title::newFromText( 'Old_Title' ),
-                       Title::newFromText( 'New_Title' )
-               );
-       }
-
-       public function testDuplicateEntry_somethingToDuplicate() {
-               $fakeRows = [
-                       $this->getFakeRow( [ 'wl_user' => 1, 'wl_notificationtimestamp' => '20151212010101' ] ),
-                       $this->getFakeRow( [ 'wl_user' => 2, 'wl_notificationtimestamp' => null ] ),
-               ];
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->at( 0 ) )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       'wl_user',
-                                       'wl_notificationtimestamp',
-                               ],
-                               [
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'Old_Title',
-                               ]
-                       )
-                       ->will( $this->returnValue( new FakeResultWrapper( $fakeRows ) ) );
-               $mockDb->expects( $this->at( 1 ) )
-                       ->method( 'replace' )
-                       ->with(
-                               'watchlist',
-                               [ [ 'wl_user', 'wl_namespace', 'wl_title' ] ],
-                               [
-                                       [
-                                               'wl_user' => 1,
-                                               'wl_namespace' => 0,
-                                               'wl_title' => 'New_Title',
-                                               'wl_notificationtimestamp' => '20151212010101',
-                                       ],
-                                       [
-                                               'wl_user' => 2,
-                                               'wl_namespace' => 0,
-                                               'wl_title' => 'New_Title',
-                                               'wl_notificationtimestamp' => null,
-                                       ],
-                               ],
-                               $this->isType( 'string' )
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $store->duplicateEntry(
-                       Title::newFromText( 'Old_Title' ),
-                       Title::newFromText( 'New_Title' )
-               );
-       }
-
-       public function testDuplicateAllAssociatedEntries_nothingToDuplicate() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->at( 0 ) )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       'wl_user',
-                                       'wl_notificationtimestamp',
-                               ],
-                               [
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'Old_Title',
-                               ]
-                       )
-                       ->will( $this->returnValue( new FakeResultWrapper( [] ) ) );
-               $mockDb->expects( $this->at( 1 ) )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       'wl_user',
-                                       'wl_notificationtimestamp',
-                               ],
-                               [
-                                       'wl_namespace' => 1,
-                                       'wl_title' => 'Old_Title',
-                               ]
-                       )
-                       ->will( $this->returnValue( new FakeResultWrapper( [] ) ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $store->duplicateAllAssociatedEntries(
-                       Title::newFromText( 'Old_Title' ),
-                       Title::newFromText( 'New_Title' )
-               );
-       }
-
-       public function provideLinkTargetPairs() {
-               return [
-                       [ Title::newFromText( 'Old_Title' ), Title::newFromText( 'New_Title' ) ],
-                       [ new TitleValue( 0, 'Old_Title' ),  new TitleValue( 0, 'New_Title' ) ],
-               ];
-       }
-
-       /**
-        * @dataProvider provideLinkTargetPairs
-        */
-       public function testDuplicateAllAssociatedEntries_somethingToDuplicate(
-               LinkTarget $oldTarget,
-               LinkTarget $newTarget
-       ) {
-               $fakeRows = [
-                       $this->getFakeRow( [ 'wl_user' => 1, 'wl_notificationtimestamp' => '20151212010101' ] ),
-               ];
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->at( 0 ) )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       'wl_user',
-                                       'wl_notificationtimestamp',
-                               ],
-                               [
-                                       'wl_namespace' => $oldTarget->getNamespace(),
-                                       'wl_title' => $oldTarget->getDBkey(),
-                               ]
-                       )
-                       ->will( $this->returnValue( new FakeResultWrapper( $fakeRows ) ) );
-               $mockDb->expects( $this->at( 1 ) )
-                       ->method( 'replace' )
-                       ->with(
-                               'watchlist',
-                               [ [ 'wl_user', 'wl_namespace', 'wl_title' ] ],
-                               [
-                                       [
-                                               'wl_user' => 1,
-                                               'wl_namespace' => $newTarget->getNamespace(),
-                                               'wl_title' => $newTarget->getDBkey(),
-                                               'wl_notificationtimestamp' => '20151212010101',
-                                       ],
-                               ],
-                               $this->isType( 'string' )
-                       );
-               $mockDb->expects( $this->at( 2 ) )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       'wl_user',
-                                       'wl_notificationtimestamp',
-                               ],
-                               [
-                                       'wl_namespace' => $oldTarget->getNamespace() + 1,
-                                       'wl_title' => $oldTarget->getDBkey(),
-                               ]
-                       )
-                       ->will( $this->returnValue( new FakeResultWrapper( $fakeRows ) ) );
-               $mockDb->expects( $this->at( 3 ) )
-                       ->method( 'replace' )
-                       ->with(
-                               'watchlist',
-                               [ [ 'wl_user', 'wl_namespace', 'wl_title' ] ],
-                               [
-                                       [
-                                               'wl_user' => 1,
-                                               'wl_namespace' => $newTarget->getNamespace() + 1,
-                                               'wl_title' => $newTarget->getDBkey(),
-                                               'wl_notificationtimestamp' => '20151212010101',
-                                       ],
-                               ],
-                               $this->isType( 'string' )
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $store->duplicateAllAssociatedEntries(
-                       $oldTarget,
-                       $newTarget
-               );
-       }
-
-       public function testAddWatch_nonAnonymousUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'insert' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       [
-                                               'wl_user' => 1,
-                                               'wl_namespace' => 0,
-                                               'wl_title' => 'Some_Page',
-                                               'wl_notificationtimestamp' => null,
-                                       ]
-                               ]
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->once() )
-                       ->method( 'delete' )
-                       ->with( '0:Some_Page:1' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $store->addWatch(
-                       $this->getMockNonAnonUserWithId( 1 ),
-                       Title::newFromText( 'Some_Page' )
-               );
-       }
-
-       public function testAddWatch_anonymousUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'insert' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $store->addWatch(
-                       $this->getAnonUser(),
-                       Title::newFromText( 'Some_Page' )
-               );
-       }
-
-       public function testAddWatchBatchForUser_readOnlyDBReturnsFalse() {
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $this->getMockDb() ),
-                       $this->getMockCache(),
-                       $this->getMockReadOnlyMode( true )
-               );
-
-               $this->assertFalse(
-                       $store->addWatchBatchForUser(
-                               $this->getMockNonAnonUserWithId( 1 ),
-                               [ new TitleValue( 0, 'Some_Page' ), new TitleValue( 1, 'Some_Page' ) ]
-                       )
-               );
-       }
-
-       public function testAddWatchBatchForUser_nonAnonymousUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'insert' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       [
-                                               'wl_user' => 1,
-                                               'wl_namespace' => 0,
-                                               'wl_title' => 'Some_Page',
-                                               'wl_notificationtimestamp' => null,
-                                       ],
-                                       [
-                                               'wl_user' => 1,
-                                               'wl_namespace' => 1,
-                                               'wl_title' => 'Some_Page',
-                                               'wl_notificationtimestamp' => null,
-                                       ]
-                               ]
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->exactly( 2 ) )
-                       ->method( 'delete' );
-               $mockCache->expects( $this->at( 1 ) )
-                       ->method( 'delete' )
-                       ->with( '0:Some_Page:1' );
-               $mockCache->expects( $this->at( 3 ) )
-                       ->method( 'delete' )
-                       ->with( '1:Some_Page:1' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $mockUser = $this->getMockNonAnonUserWithId( 1 );
-
-               $this->assertTrue(
-                       $store->addWatchBatchForUser(
-                               $mockUser,
-                               [ new TitleValue( 0, 'Some_Page' ), new TitleValue( 1, 'Some_Page' ) ]
-                       )
-               );
-       }
-
-       public function testAddWatchBatchForUser_anonymousUsersAreSkipped() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'insert' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->addWatchBatchForUser(
-                               $this->getAnonUser(),
-                               [ new TitleValue( 0, 'Other_Page' ) ]
-                       )
-               );
-       }
-
-       public function testAddWatchBatchReturnsTrue_whenGivenEmptyList() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'insert' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertTrue(
-                       $store->addWatchBatchForUser( $user, [] )
-               );
-       }
-
-       public function testLoadWatchedItem_existingItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue(
-                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
-                       ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->once() )
-                       ->method( 'set' )
-                       ->with(
-                               '0:SomeDbKey:1'
-                       );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $watchedItem = $store->loadWatchedItem(
-                       $this->getMockNonAnonUserWithId( 1 ),
-                       new TitleValue( 0, 'SomeDbKey' )
-               );
-               $this->assertInstanceOf( 'WatchedItem', $watchedItem );
-               $this->assertEquals( 1, $watchedItem->getUser()->getId() );
-               $this->assertEquals( 'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
-               $this->assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
-       }
-
-       public function testLoadWatchedItem_noItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->loadWatchedItem(
-                               $this->getMockNonAnonUserWithId( 1 ),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testLoadWatchedItem_anonymousUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'selectRow' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->loadWatchedItem(
-                               $this->getAnonUser(),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testRemoveWatch_existingItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'delete' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       );
-               $mockDb->expects( $this->once() )
-                       ->method( 'affectedRows' )
-                       ->will( $this->returnValue( 1 ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->once() )
-                       ->method( 'delete' )
-                       ->with( '0:SomeDbKey:1' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertTrue(
-                       $store->removeWatch(
-                               $this->getMockNonAnonUserWithId( 1 ),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testRemoveWatch_noItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'delete' )
-                       ->with(
-                               'watchlist',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       );
-               $mockDb->expects( $this->once() )
-                       ->method( 'affectedRows' )
-                       ->will( $this->returnValue( 0 ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->once() )
-                       ->method( 'delete' )
-                       ->with( '0:SomeDbKey:1' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->removeWatch(
-                               $this->getMockNonAnonUserWithId( 1 ),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testRemoveWatch_anonymousUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->removeWatch(
-                               $this->getAnonUser(),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testGetWatchedItem_existingItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue(
-                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
-                       ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'delete' );
-               $mockCache->expects( $this->once() )
-                       ->method( 'get' )
-                       ->with(
-                               '0:SomeDbKey:1'
-                       )
-                       ->will( $this->returnValue( null ) );
-               $mockCache->expects( $this->once() )
-                       ->method( 'set' )
-                       ->with(
-                               '0:SomeDbKey:1'
-                       );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $watchedItem = $store->getWatchedItem(
-                       $this->getMockNonAnonUserWithId( 1 ),
-                       new TitleValue( 0, 'SomeDbKey' )
-               );
-               $this->assertInstanceOf( 'WatchedItem', $watchedItem );
-               $this->assertEquals( 1, $watchedItem->getUser()->getId() );
-               $this->assertEquals( 'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
-               $this->assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
-       }
-
-       public function testGetWatchedItem_cachedItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'selectRow' );
-
-               $mockUser = $this->getMockNonAnonUserWithId( 1 );
-               $linkTarget = new TitleValue( 0, 'SomeDbKey' );
-               $cachedItem = new WatchedItem( $mockUser, $linkTarget, '20151212010101' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'delete' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->once() )
-                       ->method( 'get' )
-                       ->with(
-                               '0:SomeDbKey:1'
-                       )
-                       ->will( $this->returnValue( $cachedItem ) );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals(
-                       $cachedItem,
-                       $store->getWatchedItem(
-                               $mockUser,
-                               $linkTarget
-                       )
-               );
-       }
-
-       public function testGetWatchedItem_noItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-               $mockCache->expects( $this->once() )
-                       ->method( 'get' )
-                       ->with( '0:SomeDbKey:1' )
-                       ->will( $this->returnValue( false ) );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->getWatchedItem(
-                               $this->getMockNonAnonUserWithId( 1 ),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testGetWatchedItem_anonymousUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'selectRow' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->getWatchedItem(
-                               $this->getAnonUser(),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testGetWatchedItemsForUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                               [ 'wl_user' => 1 ]
-                       )
-                       ->will( $this->returnValue( [
-                               $this->getFakeRow( [
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'Foo1',
-                                       'wl_notificationtimestamp' => '20151212010101',
-                               ] ),
-                               $this->getFakeRow( [
-                                       'wl_namespace' => 1,
-                                       'wl_title' => 'Foo2',
-                                       'wl_notificationtimestamp' => null,
-                               ] ),
-                       ] ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'delete' );
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-               $user = $this->getMockNonAnonUserWithId( 1 );
-
-               $watchedItems = $store->getWatchedItemsForUser( $user );
-
-               $this->assertInternalType( 'array', $watchedItems );
-               $this->assertCount( 2, $watchedItems );
-               foreach ( $watchedItems as $watchedItem ) {
-                       $this->assertInstanceOf( 'WatchedItem', $watchedItem );
-               }
-               $this->assertEquals(
-                       new WatchedItem( $user, new TitleValue( 0, 'Foo1' ), '20151212010101' ),
-                       $watchedItems[0]
-               );
-               $this->assertEquals(
-                       new WatchedItem( $user, new TitleValue( 1, 'Foo2' ), null ),
-                       $watchedItems[1]
-               );
-       }
-
-       public function provideDbTypes() {
-               return [
-                       [ false, DB_REPLICA ],
-                       [ true, DB_MASTER ],
-               ];
-       }
-
-       /**
-        * @dataProvider provideDbTypes
-        */
-       public function testGetWatchedItemsForUser_optionsAndEmptyResult( $forWrite, $dbType ) {
-               $mockDb = $this->getMockDb();
-               $mockCache = $this->getMockCache();
-               $mockLoadBalancer = $this->getMockLoadBalancer( $mockDb, $dbType );
-               $user = $this->getMockNonAnonUserWithId( 1 );
-
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                               [ 'wl_user' => 1 ],
-                               $this->isType( 'string' ),
-                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $store = $this->newWatchedItemStore(
-                       $mockLoadBalancer,
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $watchedItems = $store->getWatchedItemsForUser(
-                       $user,
-                       [ 'forWrite' => $forWrite, 'sort' => WatchedItemStore::SORT_ASC ]
-               );
-               $this->assertEquals( [], $watchedItems );
-       }
-
-       public function testGetWatchedItemsForUser_badSortOptionThrowsException() {
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $this->getMockDb() ),
-                       $this->getMockCache(),
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->setExpectedException( 'InvalidArgumentException' );
-               $store->getWatchedItemsForUser(
-                       $this->getMockNonAnonUserWithId( 1 ),
-                       [ 'sort' => 'foo' ]
-               );
-       }
-
-       public function testIsWatchedItem_existingItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue(
-                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
-                       ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'delete' );
-               $mockCache->expects( $this->once() )
-                       ->method( 'get' )
-                       ->with( '0:SomeDbKey:1' )
-                       ->will( $this->returnValue( false ) );
-               $mockCache->expects( $this->once() )
-                       ->method( 'set' )
-                       ->with(
-                               '0:SomeDbKey:1'
-                       );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertTrue(
-                       $store->isWatched(
-                               $this->getMockNonAnonUserWithId( 1 ),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testIsWatchedItem_noItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-               $mockCache->expects( $this->once() )
-                       ->method( 'get' )
-                       ->with( '0:SomeDbKey:1' )
-                       ->will( $this->returnValue( false ) );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->isWatched(
-                               $this->getMockNonAnonUserWithId( 1 ),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testIsWatchedItem_anonymousUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'selectRow' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->isWatched(
-                               $this->getAnonUser(),
-                               new TitleValue( 0, 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testGetNotificationTimestampsBatch() {
-               $targets = [
-                       new TitleValue( 0, 'SomeDbKey' ),
-                       new TitleValue( 1, 'AnotherDbKey' ),
-               ];
-
-               $mockDb = $this->getMockDb();
-               $dbResult = [
-                       $this->getFakeRow( [
-                               'wl_namespace' => 0,
-                               'wl_title' => 'SomeDbKey',
-                               'wl_notificationtimestamp' => '20151212010101',
-                       ] ),
-                       $this->getFakeRow(
-                               [
-                                       'wl_namespace' => 1,
-                                       'wl_title' => 'AnotherDbKey',
-                                       'wl_notificationtimestamp' => null,
-                               ]
-                       ),
-               ];
-
-               $mockDb->expects( $this->once() )
-                       ->method( 'makeWhereFrom2d' )
-                       ->with(
-                               [ [ 'SomeDbKey' => 1 ], [ 'AnotherDbKey' => 1 ] ],
-                               $this->isType( 'string' ),
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                               [
-                                       'makeWhereFrom2d return value',
-                                       'wl_user' => 1
-                               ],
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( $dbResult ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->exactly( 2 ) )
-                       ->method( 'get' )
-                       ->withConsecutive(
-                               [ '0:SomeDbKey:1' ],
-                               [ '1:AnotherDbKey:1' ]
-                       )
-                       ->will( $this->returnValue( null ) );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals(
-                       [
-                               0 => [ 'SomeDbKey' => '20151212010101', ],
-                               1 => [ 'AnotherDbKey' => null, ],
-                       ],
-                       $store->getNotificationTimestampsBatch( $this->getMockNonAnonUserWithId( 1 ), $targets )
-               );
-       }
-
-       public function testGetNotificationTimestampsBatch_notWatchedTarget() {
-               $targets = [
-                       new TitleValue( 0, 'OtherDbKey' ),
-               ];
-
-               $mockDb = $this->getMockDb();
-
-               $mockDb->expects( $this->once() )
-                       ->method( 'makeWhereFrom2d' )
-                       ->with(
-                               [ [ 'OtherDbKey' => 1 ] ],
-                               $this->isType( 'string' ),
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                               [
-                                       'makeWhereFrom2d return value',
-                                       'wl_user' => 1
-                               ],
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( $this->getFakeRow( [] ) ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->once() )
-                       ->method( 'get' )
-                       ->with( '0:OtherDbKey:1' )
-                       ->will( $this->returnValue( null ) );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals(
-                       [
-                               0 => [ 'OtherDbKey' => false, ],
-                       ],
-                       $store->getNotificationTimestampsBatch( $this->getMockNonAnonUserWithId( 1 ), $targets )
-               );
-       }
-
-       public function testGetNotificationTimestampsBatch_cachedItem() {
-               $targets = [
-                       new TitleValue( 0, 'SomeDbKey' ),
-                       new TitleValue( 1, 'AnotherDbKey' ),
-               ];
-
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $cachedItem = new WatchedItem( $user, $targets[0], '20151212010101' );
-
-               $mockDb = $this->getMockDb();
-
-               $mockDb->expects( $this->once() )
-                       ->method( 'makeWhereFrom2d' )
-                       ->with(
-                               [ 1 => [ 'AnotherDbKey' => 1 ] ],
-                               $this->isType( 'string' ),
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'select' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                               [
-                                       'makeWhereFrom2d return value',
-                                       'wl_user' => 1
-                               ],
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( [
-                               $this->getFakeRow(
-                                       [ 'wl_namespace' => 1, 'wl_title' => 'AnotherDbKey', 'wl_notificationtimestamp' => null, ]
-                               )
-                       ] ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->at( 1 ) )
-                       ->method( 'get' )
-                       ->with( '0:SomeDbKey:1' )
-                       ->will( $this->returnValue( $cachedItem ) );
-               $mockCache->expects( $this->at( 3 ) )
-                       ->method( 'get' )
-                       ->with( '1:AnotherDbKey:1' )
-                       ->will( $this->returnValue( null ) );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals(
-                       [
-                               0 => [ 'SomeDbKey' => '20151212010101', ],
-                               1 => [ 'AnotherDbKey' => null, ],
-                       ],
-                       $store->getNotificationTimestampsBatch( $user, $targets )
-               );
-       }
-
-       public function testGetNotificationTimestampsBatch_allItemsCached() {
-               $targets = [
-                       new TitleValue( 0, 'SomeDbKey' ),
-                       new TitleValue( 1, 'AnotherDbKey' ),
-               ];
-
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $cachedItems = [
-                       new WatchedItem( $user, $targets[0], '20151212010101' ),
-                       new WatchedItem( $user, $targets[1], null ),
-               ];
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )->method( $this->anything() );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->at( 1 ) )
-                       ->method( 'get' )
-                       ->with( '0:SomeDbKey:1' )
-                       ->will( $this->returnValue( $cachedItems[0] ) );
-               $mockCache->expects( $this->at( 3 ) )
-                       ->method( 'get' )
-                       ->with( '1:AnotherDbKey:1' )
-                       ->will( $this->returnValue( $cachedItems[1] ) );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals(
-                       [
-                               0 => [ 'SomeDbKey' => '20151212010101', ],
-                               1 => [ 'AnotherDbKey' => null, ],
-                       ],
-                       $store->getNotificationTimestampsBatch( $user, $targets )
-               );
-       }
-
-       public function testGetNotificationTimestampsBatch_anonymousUser() {
-               $targets = [
-                       new TitleValue( 0, 'SomeDbKey' ),
-                       new TitleValue( 1, 'AnotherDbKey' ),
-               ];
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )->method( $this->anything() );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( $this->anything() );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals(
-                       [
-                               0 => [ 'SomeDbKey' => false, ],
-                               1 => [ 'AnotherDbKey' => false, ],
-                       ],
-                       $store->getNotificationTimestampsBatch( $this->getAnonUser(), $targets )
-               );
-       }
-
-       public function testResetNotificationTimestamp_anonymousUser() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'selectRow' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->resetNotificationTimestamp(
-                               $this->getAnonUser(),
-                               Title::newFromText( 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testResetNotificationTimestamp_noItem() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue( [] ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertFalse(
-                       $store->resetNotificationTimestamp(
-                               $this->getMockNonAnonUserWithId( 1 ),
-                               Title::newFromText( 'SomeDbKey' )
-                       )
-               );
-       }
-
-       public function testResetNotificationTimestamp_item() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $title = Title::newFromText( 'SomeDbKey' );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue(
-                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
-                       ) );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->once() )
-                       ->method( 'set' )
-                       ->with(
-                               '0:SomeDbKey:1',
-                               $this->isInstanceOf( WatchedItem::class )
-                       );
-               $mockCache->expects( $this->once() )
-                       ->method( 'delete' )
-                       ->with( '0:SomeDbKey:1' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               // Note: This does not actually assert the job is correct
-               $callableCallCounter = 0;
-               $mockCallback = function ( $callable ) use ( &$callableCallCounter ) {
-                       $callableCallCounter++;
-                       $this->assertInternalType( 'callable', $callable );
-               };
-               $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback( $mockCallback );
-
-               $this->assertTrue(
-                       $store->resetNotificationTimestamp(
-                               $user,
-                               $title
-                       )
-               );
-               $this->assertEquals( 1, $callableCallCounter );
-
-               ScopedCallback::consume( $scopedOverride );
-       }
-
-       public function testResetNotificationTimestamp_noItemForced() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $title = Title::newFromText( 'SomeDbKey' );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'selectRow' );
-
-               $mockCache = $this->getMockCache();
-               $mockDb->expects( $this->never() )
-                       ->method( 'get' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'set' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               // Note: This does not actually assert the job is correct
-               $callableCallCounter = 0;
-               $mockCallback = function ( $callable ) use ( &$callableCallCounter ) {
-                       $callableCallCounter++;
-                       $this->assertInternalType( 'callable', $callable );
-               };
-               $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback( $mockCallback );
-
-               $this->assertTrue(
-                       $store->resetNotificationTimestamp(
-                               $user,
-                               $title,
-                               'force'
-                       )
-               );
-               $this->assertEquals( 1, $callableCallCounter );
-
-               ScopedCallback::consume( $scopedOverride );
-       }
-
-       /**
-        * @param string $text
-        * @param int $ns
-        *
-        * @return PHPUnit_Framework_MockObject_MockObject|Title
-        */
-       private function getMockTitle( $text, $ns = 0 ) {
-               $title = $this->createMock( Title::class );
-               $title->expects( $this->any() )
-                       ->method( 'getText' )
-                       ->will( $this->returnValue( str_replace( '_', ' ', $text ) ) );
-               $title->expects( $this->any() )
-                       ->method( 'getDbKey' )
-                       ->will( $this->returnValue( str_replace( '_', ' ', $text ) ) );
-               $title->expects( $this->any() )
-                       ->method( 'getNamespace' )
-                       ->will( $this->returnValue( $ns ) );
-               return $title;
-       }
-
-       private function verifyCallbackJob(
-               $callback,
-               LinkTarget $expectedTitle,
-               $expectedUserId,
-               callable $notificationTimestampCondition
-       ) {
-               $this->assertInternalType( 'callable', $callback );
-
-               $callbackReflector = new ReflectionFunction( $callback );
-               $vars = $callbackReflector->getStaticVariables();
-               $this->assertArrayHasKey( 'job', $vars );
-               $this->assertInstanceOf( ActivityUpdateJob::class, $vars['job'] );
-
-               /** @var ActivityUpdateJob $job */
-               $job = $vars['job'];
-               $this->assertEquals( $expectedTitle->getDBkey(), $job->getTitle()->getDBkey() );
-               $this->assertEquals( $expectedTitle->getNamespace(), $job->getTitle()->getNamespace() );
-
-               $jobParams = $job->getParams();
-               $this->assertArrayHasKey( 'type', $jobParams );
-               $this->assertEquals( 'updateWatchlistNotification', $jobParams['type'] );
-               $this->assertArrayHasKey( 'userid', $jobParams );
-               $this->assertEquals( $expectedUserId, $jobParams['userid'] );
-               $this->assertArrayHasKey( 'notifTime', $jobParams );
-               $this->assertTrue( $notificationTimestampCondition( $jobParams['notifTime'] ) );
-       }
-
-       public function testResetNotificationTimestamp_oldidSpecifiedLatestRevisionForced() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $oldid = 22;
-               $title = $this->getMockTitle( 'SomeTitle' );
-               $title->expects( $this->once() )
-                       ->method( 'getNextRevisionID' )
-                       ->with( $oldid )
-                       ->will( $this->returnValue( false ) );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )
-                       ->method( 'selectRow' );
-
-               $mockCache = $this->getMockCache();
-               $mockDb->expects( $this->never() )
-                       ->method( 'get' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'set' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $callableCallCounter = 0;
-               $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
-                       function ( $callable ) use ( &$callableCallCounter, $title, $user ) {
-                               $callableCallCounter++;
-                               $this->verifyCallbackJob(
-                                       $callable,
-                                       $title,
-                                       $user->getId(),
-                                       function ( $time ) {
-                                               return $time === null;
-                                       }
-                               );
-                       }
-               );
-
-               $this->assertTrue(
-                       $store->resetNotificationTimestamp(
-                               $user,
-                               $title,
-                               'force',
-                               $oldid
-                       )
-               );
-               $this->assertEquals( 1, $callableCallCounter );
-
-               ScopedCallback::consume( $scopedOverride );
-       }
-
-       public function testResetNotificationTimestamp_oldidSpecifiedNotLatestRevisionForced() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $oldid = 22;
-               $title = $this->getMockTitle( 'SomeDbKey' );
-               $title->expects( $this->once() )
-                       ->method( 'getNextRevisionID' )
-                       ->with( $oldid )
-                       ->will( $this->returnValue( 33 ) );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue(
-                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
-                       ) );
-
-               $mockCache = $this->getMockCache();
-               $mockDb->expects( $this->never() )
-                       ->method( 'get' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'set' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $addUpdateCallCounter = 0;
-               $scopedOverrideDeferred = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
-                       function ( $callable ) use ( &$addUpdateCallCounter, $title, $user ) {
-                               $addUpdateCallCounter++;
-                               $this->verifyCallbackJob(
-                                       $callable,
-                                       $title,
-                                       $user->getId(),
-                                       function ( $time ) {
-                                               return $time !== null && $time > '20151212010101';
-                                       }
-                               );
-                       }
-               );
-
-               $getTimestampCallCounter = 0;
-               $scopedOverrideRevision = $store->overrideRevisionGetTimestampFromIdCallback(
-                       function ( $titleParam, $oldidParam ) use ( &$getTimestampCallCounter, $title, $oldid ) {
-                               $getTimestampCallCounter++;
-                               $this->assertEquals( $title, $titleParam );
-                               $this->assertEquals( $oldid, $oldidParam );
-                       }
-               );
-
-               $this->assertTrue(
-                       $store->resetNotificationTimestamp(
-                               $user,
-                               $title,
-                               'force',
-                               $oldid
-                       )
-               );
-               $this->assertEquals( 1, $addUpdateCallCounter );
-               $this->assertEquals( 1, $getTimestampCallCounter );
-
-               ScopedCallback::consume( $scopedOverrideDeferred );
-               ScopedCallback::consume( $scopedOverrideRevision );
-       }
-
-       public function testResetNotificationTimestamp_notWatchedPageForced() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $oldid = 22;
-               $title = $this->getMockTitle( 'SomeDbKey' );
-               $title->expects( $this->once() )
-                       ->method( 'getNextRevisionID' )
-                       ->with( $oldid )
-                       ->will( $this->returnValue( 33 ) );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue( false ) );
-
-               $mockCache = $this->getMockCache();
-               $mockDb->expects( $this->never() )
-                       ->method( 'get' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'set' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $callableCallCounter = 0;
-               $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
-                       function ( $callable ) use ( &$callableCallCounter, $title, $user ) {
-                               $callableCallCounter++;
-                               $this->verifyCallbackJob(
-                                       $callable,
-                                       $title,
-                                       $user->getId(),
-                                       function ( $time ) {
-                                               return $time === null;
-                                       }
-                               );
-                       }
-               );
-
-               $this->assertTrue(
-                       $store->resetNotificationTimestamp(
-                               $user,
-                               $title,
-                               'force',
-                               $oldid
-                       )
-               );
-               $this->assertEquals( 1, $callableCallCounter );
-
-               ScopedCallback::consume( $scopedOverride );
-       }
-
-       public function testResetNotificationTimestamp_futureNotificationTimestampForced() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $oldid = 22;
-               $title = $this->getMockTitle( 'SomeDbKey' );
-               $title->expects( $this->once() )
-                       ->method( 'getNextRevisionID' )
-                       ->with( $oldid )
-                       ->will( $this->returnValue( 33 ) );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue(
-                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '30151212010101' ] )
-                       ) );
-
-               $mockCache = $this->getMockCache();
-               $mockDb->expects( $this->never() )
-                       ->method( 'get' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'set' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $addUpdateCallCounter = 0;
-               $scopedOverrideDeferred = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
-                       function ( $callable ) use ( &$addUpdateCallCounter, $title, $user ) {
-                               $addUpdateCallCounter++;
-                               $this->verifyCallbackJob(
-                                       $callable,
-                                       $title,
-                                       $user->getId(),
-                                       function ( $time ) {
-                                               return $time === '30151212010101';
-                                       }
-                               );
-                       }
-               );
-
-               $getTimestampCallCounter = 0;
-               $scopedOverrideRevision = $store->overrideRevisionGetTimestampFromIdCallback(
-                       function ( $titleParam, $oldidParam ) use ( &$getTimestampCallCounter, $title, $oldid ) {
-                               $getTimestampCallCounter++;
-                               $this->assertEquals( $title, $titleParam );
-                               $this->assertEquals( $oldid, $oldidParam );
-                       }
-               );
-
-               $this->assertTrue(
-                       $store->resetNotificationTimestamp(
-                               $user,
-                               $title,
-                               'force',
-                               $oldid
-                       )
-               );
-               $this->assertEquals( 1, $addUpdateCallCounter );
-               $this->assertEquals( 1, $getTimestampCallCounter );
-
-               ScopedCallback::consume( $scopedOverrideDeferred );
-               ScopedCallback::consume( $scopedOverrideRevision );
-       }
-
-       public function testResetNotificationTimestamp_futureNotificationTimestampNotForced() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $oldid = 22;
-               $title = $this->getMockTitle( 'SomeDbKey' );
-               $title->expects( $this->once() )
-                       ->method( 'getNextRevisionID' )
-                       ->with( $oldid )
-                       ->will( $this->returnValue( 33 ) );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->with(
-                               'watchlist',
-                               'wl_notificationtimestamp',
-                               [
-                                       'wl_user' => 1,
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       )
-                       ->will( $this->returnValue(
-                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '30151212010101' ] )
-                       ) );
-
-               $mockCache = $this->getMockCache();
-               $mockDb->expects( $this->never() )
-                       ->method( 'get' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'set' );
-               $mockDb->expects( $this->never() )
-                       ->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $addUpdateCallCounter = 0;
-               $scopedOverrideDeferred = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
-                       function ( $callable ) use ( &$addUpdateCallCounter, $title, $user ) {
-                               $addUpdateCallCounter++;
-                               $this->verifyCallbackJob(
-                                       $callable,
-                                       $title,
-                                       $user->getId(),
-                                       function ( $time ) {
-                                               return $time === false;
-                                       }
-                               );
-                       }
-               );
-
-               $getTimestampCallCounter = 0;
-               $scopedOverrideRevision = $store->overrideRevisionGetTimestampFromIdCallback(
-                       function ( $titleParam, $oldidParam ) use ( &$getTimestampCallCounter, $title, $oldid ) {
-                               $getTimestampCallCounter++;
-                               $this->assertEquals( $title, $titleParam );
-                               $this->assertEquals( $oldid, $oldidParam );
-                       }
-               );
-
-               $this->assertTrue(
-                       $store->resetNotificationTimestamp(
-                               $user,
-                               $title,
-                               '',
-                               $oldid
-                       )
-               );
-               $this->assertEquals( 1, $addUpdateCallCounter );
-               $this->assertEquals( 1, $getTimestampCallCounter );
-
-               ScopedCallback::consume( $scopedOverrideDeferred );
-               ScopedCallback::consume( $scopedOverrideRevision );
-       }
-
-       public function testSetNotificationTimestampsForUser_anonUser() {
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $this->getMockDb() ),
-                       $this->getMockCache(),
-                       $this->getMockReadOnlyMode()
-               );
-               $this->assertFalse( $store->setNotificationTimestampsForUser( $this->getAnonUser(), '' ) );
-       }
-
-       public function testSetNotificationTimestampsForUser_allRows() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $timestamp = '20100101010101';
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'update' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_notificationtimestamp' => 'TS' . $timestamp . 'TS' ],
-                               [ 'wl_user' => 1 ]
-                       )
-                       ->will( $this->returnValue( true ) );
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'timestamp' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return 'TS' . $value . 'TS';
-                       } ) );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $this->getMockCache(),
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertTrue(
-                       $store->setNotificationTimestampsForUser( $user, $timestamp )
-               );
-       }
-
-       public function testSetNotificationTimestampsForUser_nullTimestamp() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $timestamp = null;
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'update' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_notificationtimestamp' => null ],
-                               [ 'wl_user' => 1 ]
-                       )
-                       ->will( $this->returnValue( true ) );
-               $mockDb->expects( $this->exactly( 0 ) )
-                       ->method( 'timestamp' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return 'TS' . $value . 'TS';
-                       } ) );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $this->getMockCache(),
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertTrue(
-                       $store->setNotificationTimestampsForUser( $user, $timestamp )
-               );
-       }
-
-       public function testSetNotificationTimestampsForUser_specificTargets() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $timestamp = '20100101010101';
-               $targets = [ new TitleValue( 0, 'Foo' ), new TitleValue( 0, 'Bar' ) ];
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'update' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_notificationtimestamp' => 'TS' . $timestamp . 'TS' ],
-                               [ 'wl_user' => 1, 0 => 'makeWhereFrom2d return value' ]
-                       )
-                       ->will( $this->returnValue( true ) );
-               $mockDb->expects( $this->exactly( 1 ) )
-                       ->method( 'timestamp' )
-                       ->will( $this->returnCallback( function ( $value ) {
-                               return 'TS' . $value . 'TS';
-                       } ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'makeWhereFrom2d' )
-                       ->with(
-                               [ [ 'Foo' => 1, 'Bar' => 1 ] ],
-                               $this->isType( 'string' ),
-                               $this->isType( 'string' )
-                       )
-                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $this->getMockCache(),
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertTrue(
-                       $store->setNotificationTimestampsForUser( $user, $timestamp, $targets )
-               );
-       }
-
-       public function testUpdateNotificationTimestamp_watchersExist() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectFieldValues' )
-                       ->with(
-                               'watchlist',
-                               'wl_user',
-                               [
-                                       'wl_user != 1',
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                                       'wl_notificationtimestamp IS NULL'
-                               ]
-                       )
-                       ->will( $this->returnValue( [ '2', '3' ] ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'update' )
-                       ->with(
-                               'watchlist',
-                               [ 'wl_notificationtimestamp' => null ],
-                               [
-                                       'wl_user' => [ 2, 3 ],
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                               ]
-                       );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $this->assertEquals(
-                       [ 2, 3 ],
-                       $store->updateNotificationTimestamp(
-                               $this->getMockNonAnonUserWithId( 1 ),
-                               new TitleValue( 0, 'SomeDbKey' ),
-                               '20151212010101'
-                       )
-               );
-       }
-
-       public function testUpdateNotificationTimestamp_noWatchers() {
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectFieldValues' )
-                       ->with(
-                               'watchlist',
-                               'wl_user',
-                               [
-                                       'wl_user != 1',
-                                       'wl_namespace' => 0,
-                                       'wl_title' => 'SomeDbKey',
-                                       'wl_notificationtimestamp IS NULL'
-                               ]
-                       )
-                       ->will(
-                               $this->returnValue( [] )
-                       );
-               $mockDb->expects( $this->never() )
-                       ->method( 'update' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( 'set' );
-               $mockCache->expects( $this->never() )->method( 'get' );
-               $mockCache->expects( $this->never() )->method( 'delete' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               $watchers = $store->updateNotificationTimestamp(
-                       $this->getMockNonAnonUserWithId( 1 ),
-                       new TitleValue( 0, 'SomeDbKey' ),
-                       '20151212010101'
-               );
-               $this->assertInternalType( 'array', $watchers );
-               $this->assertEmpty( $watchers );
-       }
-
-       public function testUpdateNotificationTimestamp_clearsCachedItems() {
-               $user = $this->getMockNonAnonUserWithId( 1 );
-               $titleValue = new TitleValue( 0, 'SomeDbKey' );
-
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectRow' )
-                       ->will( $this->returnValue(
-                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
-                       ) );
-               $mockDb->expects( $this->once() )
-                       ->method( 'selectFieldValues' )
-                       ->will(
-                               $this->returnValue( [ '2', '3' ] )
-                       );
-               $mockDb->expects( $this->once() )
-                       ->method( 'update' );
-
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->once() )
-                       ->method( 'set' )
-                       ->with( '0:SomeDbKey:1', $this->isType( 'object' ) );
-               $mockCache->expects( $this->once() )
-                       ->method( 'get' )
-                       ->with( '0:SomeDbKey:1' );
-               $mockCache->expects( $this->once() )
-                       ->method( 'delete' )
-                       ->with( '0:SomeDbKey:1' );
-
-               $store = $this->newWatchedItemStore(
-                       $this->getMockLoadBalancer( $mockDb ),
-                       $mockCache,
-                       $this->getMockReadOnlyMode()
-               );
-
-               // This will add the item to the cache
-               $store->getWatchedItem( $user, $titleValue );
-
-               $store->updateNotificationTimestamp(
-                       $this->getMockNonAnonUserWithId( 1 ),
-                       $titleValue,
-                       '20151212010101'
-               );
-       }
-
-}
diff --git a/tests/phpunit/includes/WatchedItemUnitTest.php b/tests/phpunit/includes/WatchedItemUnitTest.php
deleted file mode 100644 (file)
index 8897645..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-use MediaWiki\Linker\LinkTarget;
-
-/**
- * @author Addshore
- *
- * @covers WatchedItem
- */
-class WatchedItemUnitTest extends MediaWikiTestCase {
-
-       /**
-        * @param int $id
-        *
-        * @return PHPUnit_Framework_MockObject_MockObject|User
-        */
-       private function getMockUser( $id ) {
-               $user = $this->createMock( User::class );
-               $user->expects( $this->any() )
-                       ->method( 'getId' )
-                       ->will( $this->returnValue( $id ) );
-               $user->expects( $this->any() )
-                       ->method( 'isAllowed' )
-                       ->will( $this->returnValue( true ) );
-               return $user;
-       }
-
-       public function provideUserTitleTimestamp() {
-               $user = $this->getMockUser( 111 );
-               return [
-                       [ $user, Title::newFromText( 'SomeTitle' ), null ],
-                       [ $user, Title::newFromText( 'SomeTitle' ), '20150101010101' ],
-                       [ $user, new TitleValue( 0, 'TVTitle', 'frag' ), '20150101010101' ],
-               ];
-       }
-
-       /**
-        * @return PHPUnit_Framework_MockObject_MockObject|WatchedItemStore
-        */
-       private function getMockWatchedItemStore() {
-               return $this->getMockBuilder( WatchedItemStore::class )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-       }
-
-       /**
-        * @dataProvider provideUserTitleTimestamp
-        */
-       public function testConstruction( $user, LinkTarget $linkTarget, $notifTimestamp ) {
-               $item = new WatchedItem( $user, $linkTarget, $notifTimestamp );
-
-               $this->assertSame( $user, $item->getUser() );
-               $this->assertSame( $linkTarget, $item->getLinkTarget() );
-               $this->assertSame( $notifTimestamp, $item->getNotificationTimestamp() );
-
-               // The below tests the internal WatchedItem::getTitle method
-               $this->assertInstanceOf( 'Title', $item->getTitle() );
-               $this->assertSame( $linkTarget->getDBkey(), $item->getTitle()->getDBkey() );
-               $this->assertSame( $linkTarget->getFragment(), $item->getTitle()->getFragment() );
-               $this->assertSame( $linkTarget->getNamespace(), $item->getTitle()->getNamespace() );
-               $this->assertSame( $linkTarget->getText(), $item->getTitle()->getText() );
-       }
-
-       /**
-        * @dataProvider provideUserTitleTimestamp
-        */
-       public function testFromUserTitle( $user, $linkTarget, $timestamp ) {
-               $store = $this->getMockWatchedItemStore();
-               $store->expects( $this->once() )
-                       ->method( 'loadWatchedItem' )
-                       ->with( $user, $linkTarget )
-                       ->will( $this->returnValue( new WatchedItem( $user, $linkTarget, $timestamp ) ) );
-               $this->setService( 'WatchedItemStore', $store );
-
-               $item = WatchedItem::fromUserTitle( $user, $linkTarget, User::IGNORE_USER_RIGHTS );
-
-               $this->assertEquals( $user, $item->getUser() );
-               $this->assertEquals( $linkTarget, $item->getLinkTarget() );
-               $this->assertEquals( $timestamp, $item->getNotificationTimestamp() );
-       }
-
-       public function testAddWatch() {
-               $title = Title::newFromText( 'SomeTitle' );
-               $timestamp = null;
-               $checkRights = 0;
-
-               /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->createMock( User::class );
-               $user->expects( $this->once() )
-                       ->method( 'addWatch' )
-                       ->with( $title, $checkRights );
-
-               $item = new WatchedItem( $user, $title, $timestamp, $checkRights );
-               $this->assertTrue( $item->addWatch() );
-       }
-
-       public function testRemoveWatch() {
-               $title = Title::newFromText( 'SomeTitle' );
-               $timestamp = null;
-               $checkRights = 0;
-
-               /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->createMock( User::class );
-               $user->expects( $this->once() )
-                       ->method( 'removeWatch' )
-                       ->with( $title, $checkRights );
-
-               $item = new WatchedItem( $user, $title, $timestamp, $checkRights );
-               $this->assertTrue( $item->removeWatch() );
-       }
-
-       public function provideBooleans() {
-               return [
-                       [ true ],
-                       [ false ],
-               ];
-       }
-
-       /**
-        * @dataProvider provideBooleans
-        */
-       public function testIsWatched( $returnValue ) {
-               $title = Title::newFromText( 'SomeTitle' );
-               $timestamp = null;
-               $checkRights = 0;
-
-               /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->createMock( User::class );
-               $user->expects( $this->once() )
-                       ->method( 'isWatched' )
-                       ->with( $title, $checkRights )
-                       ->will( $this->returnValue( $returnValue ) );
-
-               $item = new WatchedItem( $user, $title, $timestamp, $checkRights );
-               $this->assertEquals( $returnValue, $item->isWatched() );
-       }
-
-       public function testDuplicateEntries() {
-               $oldTitle = Title::newFromText( 'OldTitle' );
-               $newTitle = Title::newFromText( 'NewTitle' );
-
-               $store = $this->getMockWatchedItemStore();
-               $store->expects( $this->once() )
-                       ->method( 'duplicateAllAssociatedEntries' )
-                       ->with( $oldTitle, $newTitle );
-               $this->setService( 'WatchedItemStore', $store );
-
-               WatchedItem::duplicateEntries( $oldTitle, $newTitle );
-       }
-
-}
diff --git a/tests/phpunit/includes/watcheditem/WatchedItemIntegrationTest.php b/tests/phpunit/includes/watcheditem/WatchedItemIntegrationTest.php
new file mode 100644 (file)
index 0000000..01e7ecb
--- /dev/null
@@ -0,0 +1,145 @@
+<?php
+use MediaWiki\MediaWikiServices;
+
+/**
+ * @author Addshore
+ *
+ * @group Database
+ *
+ * @covers WatchedItem
+ */
+class WatchedItemIntegrationTest extends MediaWikiTestCase {
+
+       public function setUp() {
+               parent::setUp();
+               self::$users['WatchedItemIntegrationTestUser']
+                       = new TestUser( 'WatchedItemIntegrationTestUser' );
+
+               $this->hideDeprecated( 'WatchedItem::fromUserTitle' );
+               $this->hideDeprecated( 'WatchedItem::addWatch' );
+               $this->hideDeprecated( 'WatchedItem::removeWatch' );
+               $this->hideDeprecated( 'WatchedItem::isWatched' );
+               $this->hideDeprecated( 'WatchedItem::duplicateEntries' );
+               $this->hideDeprecated( 'WatchedItem::batchAddWatch' );
+       }
+
+       private function getUser() {
+               return self::$users['WatchedItemIntegrationTestUser']->getUser();
+       }
+
+       public function testWatchAndUnWatchItem() {
+               $user = $this->getUser();
+               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
+               // Cleanup after previous tests
+               WatchedItem::fromUserTitle( $user, $title )->removeWatch();
+
+               $this->assertFalse(
+                       WatchedItem::fromUserTitle( $user, $title )->isWatched(),
+                       'Page should not initially be watched'
+               );
+               WatchedItem::fromUserTitle( $user, $title )->addWatch();
+               $this->assertTrue(
+                       WatchedItem::fromUserTitle( $user, $title )->isWatched(),
+                       'Page should be watched'
+               );
+               WatchedItem::fromUserTitle( $user, $title )->removeWatch();
+               $this->assertFalse(
+                       WatchedItem::fromUserTitle( $user, $title )->isWatched(),
+                       'Page should be unwatched'
+               );
+       }
+
+       public function testUpdateAndResetNotificationTimestamp() {
+               $user = $this->getUser();
+               $otherUser = ( new TestUser( 'WatchedItemIntegrationTestUser_otherUser' ) )->getUser();
+               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
+               WatchedItem::fromUserTitle( $user, $title )->addWatch();
+               $this->assertNull( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
+
+               EmailNotification::updateWatchlistTimestamp( $otherUser, $title, '20150202010101' );
+               $this->assertEquals(
+                       '20150202010101',
+                       WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp()
+               );
+
+               MediaWikiServices::getInstance()->getWatchedItemStore()->resetNotificationTimestamp(
+                       $user, $title
+               );
+               $this->assertNull( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
+       }
+
+       public function testDuplicateAllAssociatedEntries() {
+               $user = $this->getUser();
+               $titleOld = Title::newFromText( 'WatchedItemIntegrationTestPageOld' );
+               $titleNew = Title::newFromText( 'WatchedItemIntegrationTestPageNew' );
+               WatchedItem::fromUserTitle( $user, $titleOld->getSubjectPage() )->addWatch();
+               WatchedItem::fromUserTitle( $user, $titleOld->getTalkPage() )->addWatch();
+               // Cleanup after previous tests
+               WatchedItem::fromUserTitle( $user, $titleNew->getSubjectPage() )->removeWatch();
+               WatchedItem::fromUserTitle( $user, $titleNew->getTalkPage() )->removeWatch();
+
+               WatchedItem::duplicateEntries( $titleOld, $titleNew );
+
+               $this->assertTrue(
+                       WatchedItem::fromUserTitle( $user, $titleOld->getSubjectPage() )->isWatched()
+               );
+               $this->assertTrue(
+                       WatchedItem::fromUserTitle( $user, $titleOld->getTalkPage() )->isWatched()
+               );
+               $this->assertTrue(
+                       WatchedItem::fromUserTitle( $user, $titleNew->getSubjectPage() )->isWatched()
+               );
+               $this->assertTrue(
+                       WatchedItem::fromUserTitle( $user, $titleNew->getTalkPage() )->isWatched()
+               );
+       }
+
+       public function testIsWatched_falseOnNotAllowed() {
+               $user = $this->getUser();
+               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
+               WatchedItem::fromUserTitle( $user, $title )->addWatch();
+
+               $this->assertTrue( WatchedItem::fromUserTitle( $user, $title )->isWatched() );
+               $user->mRights = [];
+               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->isWatched() );
+       }
+
+       public function testGetNotificationTimestamp_falseOnNotAllowed() {
+               $user = $this->getUser();
+               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
+               WatchedItem::fromUserTitle( $user, $title )->addWatch();
+               MediaWikiServices::getInstance()->getWatchedItemStore()->resetNotificationTimestamp(
+                       $user, $title
+               );
+
+               $this->assertEquals(
+                       null,
+                       WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp()
+               );
+               $user->mRights = [];
+               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
+       }
+
+       public function testRemoveWatch_falseOnNotAllowed() {
+               $user = $this->getUser();
+               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
+               WatchedItem::fromUserTitle( $user, $title )->addWatch();
+
+               $previousRights = $user->mRights;
+               $user->mRights = [];
+               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->removeWatch() );
+               $user->mRights = $previousRights;
+               $this->assertTrue( WatchedItem::fromUserTitle( $user, $title )->removeWatch() );
+       }
+
+       public function testGetNotificationTimestamp_falseOnNotWatched() {
+               $user = $this->getUser();
+               $title = Title::newFromText( 'WatchedItemIntegrationTestPage' );
+
+               WatchedItem::fromUserTitle( $user, $title )->removeWatch();
+               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->isWatched() );
+
+               $this->assertFalse( WatchedItem::fromUserTitle( $user, $title )->getNotificationTimestamp() );
+       }
+
+}
diff --git a/tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php b/tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php
new file mode 100644 (file)
index 0000000..62ba5f6
--- /dev/null
@@ -0,0 +1,1676 @@
+<?php
+
+use Wikimedia\ScopedCallback;
+use Wikimedia\TestingAccessWrapper;
+
+/**
+ * @covers WatchedItemQueryService
+ */
+class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase {
+
+       /**
+        * @return PHPUnit_Framework_MockObject_MockObject|Database
+        */
+       private function getMockDb() {
+               $mock = $this->getMockBuilder( Database::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+
+               $mock->expects( $this->any() )
+                       ->method( 'makeList' )
+                       ->with(
+                               $this->isType( 'array' ),
+                               $this->isType( 'int' )
+                       )
+                       ->will( $this->returnCallback( function ( $a, $conj ) {
+                               $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
+                               return join( $sqlConj, array_map( function ( $s ) {
+                                       return '(' . $s . ')';
+                               }, $a
+                               ) );
+                       } ) );
+
+               $mock->expects( $this->any() )
+                       ->method( 'addQuotes' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return "'$value'";
+                       } ) );
+
+               $mock->expects( $this->any() )
+                       ->method( 'timestamp' )
+                       ->will( $this->returnArgument( 0 ) );
+
+               $mock->expects( $this->any() )
+                       ->method( 'bitAnd' )
+                       ->willReturnCallback( function ( $a, $b ) {
+                               return "($a & $b)";
+                       } );
+
+               return $mock;
+       }
+
+       /**
+        * @param PHPUnit_Framework_MockObject_MockObject|Database $mockDb
+        * @return PHPUnit_Framework_MockObject_MockObject|LoadBalancer
+        */
+       private function getMockLoadBalancer( $mockDb ) {
+               $mock = $this->getMockBuilder( LoadBalancer::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $mock->expects( $this->any() )
+                       ->method( 'getConnectionRef' )
+                       ->with( DB_REPLICA )
+                       ->will( $this->returnValue( $mockDb ) );
+               return $mock;
+       }
+
+       /**
+        * @param int $id
+        * @return PHPUnit_Framework_MockObject_MockObject|User
+        */
+       private function getMockNonAnonUserWithId( $id ) {
+               $mock = $this->getMockBuilder( User::class )->getMock();
+               $mock->expects( $this->any() )
+                       ->method( 'isAnon' )
+                       ->will( $this->returnValue( false ) );
+               $mock->expects( $this->any() )
+                       ->method( 'getId' )
+                       ->will( $this->returnValue( $id ) );
+               return $mock;
+       }
+
+       /**
+        * @param int $id
+        * @return PHPUnit_Framework_MockObject_MockObject|User
+        */
+       private function getMockUnrestrictedNonAnonUserWithId( $id ) {
+               $mock = $this->getMockNonAnonUserWithId( $id );
+               $mock->expects( $this->any() )
+                       ->method( 'isAllowed' )
+                       ->will( $this->returnValue( true ) );
+               $mock->expects( $this->any() )
+                       ->method( 'isAllowedAny' )
+                       ->will( $this->returnValue( true ) );
+               $mock->expects( $this->any() )
+                       ->method( 'useRCPatrol' )
+                       ->will( $this->returnValue( true ) );
+               return $mock;
+       }
+
+       /**
+        * @param int $id
+        * @param string $notAllowedAction
+        * @return PHPUnit_Framework_MockObject_MockObject|User
+        */
+       private function getMockNonAnonUserWithIdAndRestrictedPermissions( $id, $notAllowedAction ) {
+               $mock = $this->getMockNonAnonUserWithId( $id );
+
+               $mock->expects( $this->any() )
+                       ->method( 'isAllowed' )
+                       ->will( $this->returnCallback( function ( $action ) use ( $notAllowedAction ) {
+                               return $action !== $notAllowedAction;
+                       } ) );
+               $mock->expects( $this->any() )
+                       ->method( 'isAllowedAny' )
+                       ->will( $this->returnCallback( function () use ( $notAllowedAction ) {
+                               $actions = func_get_args();
+                               return !in_array( $notAllowedAction, $actions );
+                       } ) );
+
+               return $mock;
+       }
+
+       /**
+        * @param int $id
+        * @return PHPUnit_Framework_MockObject_MockObject|User
+        */
+       private function getMockNonAnonUserWithIdAndNoPatrolRights( $id ) {
+               $mock = $this->getMockNonAnonUserWithId( $id );
+
+               $mock->expects( $this->any() )
+                       ->method( 'isAllowed' )
+                       ->will( $this->returnValue( true ) );
+               $mock->expects( $this->any() )
+                       ->method( 'isAllowedAny' )
+                       ->will( $this->returnValue( true ) );
+
+               $mock->expects( $this->any() )
+                       ->method( 'useRCPatrol' )
+                       ->will( $this->returnValue( false ) );
+               $mock->expects( $this->any() )
+                       ->method( 'useNPPatrol' )
+                       ->will( $this->returnValue( false ) );
+
+               return $mock;
+       }
+
+       private function getMockAnonUser() {
+               $mock = $this->getMockBuilder( User::class )->getMock();
+               $mock->expects( $this->any() )
+                       ->method( 'isAnon' )
+                       ->will( $this->returnValue( true ) );
+               return $mock;
+       }
+
+       private function getFakeRow( array $rowValues ) {
+               $fakeRow = new stdClass();
+               foreach ( $rowValues as $valueName => $value ) {
+                       $fakeRow->$valueName = $value;
+               }
+               return $fakeRow;
+       }
+
+       public function testGetWatchedItemsWithRecentChangeInfo() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               [ 'recentchanges', 'watchlist', 'page' ],
+                               [
+                                       'rc_id',
+                                       'rc_namespace',
+                                       'rc_title',
+                                       'rc_timestamp',
+                                       'rc_type',
+                                       'rc_deleted',
+                                       'wl_notificationtimestamp',
+                                       'rc_cur_id',
+                                       'rc_this_oldid',
+                                       'rc_last_oldid',
+                               ],
+                               [
+                                       'wl_user' => 1,
+                                       '(rc_this_oldid=page_latest) OR (rc_type=3)',
+                               ],
+                               $this->isType( 'string' ),
+                               [
+                                       'LIMIT' => 3,
+                               ],
+                               [
+                                       'watchlist' => [
+                                               'INNER JOIN',
+                                               [
+                                                       'wl_namespace=rc_namespace',
+                                                       'wl_title=rc_title'
+                                               ]
+                                       ],
+                                       'page' => [
+                                               'LEFT JOIN',
+                                               'rc_cur_id=page_id',
+                                       ],
+                               ]
+                       )
+                       ->will( $this->returnValue( [
+                               $this->getFakeRow( [
+                                       'rc_id' => 1,
+                                       'rc_namespace' => 0,
+                                       'rc_title' => 'Foo1',
+                                       'rc_timestamp' => '20151212010101',
+                                       'rc_type' => RC_NEW,
+                                       'rc_deleted' => 0,
+                                       'wl_notificationtimestamp' => '20151212010101',
+                               ] ),
+                               $this->getFakeRow( [
+                                       'rc_id' => 2,
+                                       'rc_namespace' => 1,
+                                       'rc_title' => 'Foo2',
+                                       'rc_timestamp' => '20151212010102',
+                                       'rc_type' => RC_NEW,
+                                       'rc_deleted' => 0,
+                                       'wl_notificationtimestamp' => null,
+                               ] ),
+                               $this->getFakeRow( [
+                                       'rc_id' => 3,
+                                       'rc_namespace' => 1,
+                                       'rc_title' => 'Foo3',
+                                       'rc_timestamp' => '20151212010103',
+                                       'rc_type' => RC_NEW,
+                                       'rc_deleted' => 0,
+                                       'wl_notificationtimestamp' => null,
+                               ] ),
+                       ] ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+
+               $startFrom = null;
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
+                       $user, [ 'limit' => 2 ], $startFrom
+               );
+
+               $this->assertInternalType( 'array', $items );
+               $this->assertCount( 2, $items );
+
+               foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
+                       $this->assertInstanceOf( WatchedItem::class, $watchedItem );
+                       $this->assertInternalType( 'array', $recentChangeInfo );
+               }
+
+               $this->assertEquals(
+                       new WatchedItem( $user, new TitleValue( 0, 'Foo1' ), '20151212010101' ),
+                       $items[0][0]
+               );
+               $this->assertEquals(
+                       [
+                               'rc_id' => 1,
+                               'rc_namespace' => 0,
+                               'rc_title' => 'Foo1',
+                               'rc_timestamp' => '20151212010101',
+                               'rc_type' => RC_NEW,
+                               'rc_deleted' => 0,
+                       ],
+                       $items[0][1]
+               );
+
+               $this->assertEquals(
+                       new WatchedItem( $user, new TitleValue( 1, 'Foo2' ), null ),
+                       $items[1][0]
+               );
+               $this->assertEquals(
+                       [
+                               'rc_id' => 2,
+                               'rc_namespace' => 1,
+                               'rc_title' => 'Foo2',
+                               'rc_timestamp' => '20151212010102',
+                               'rc_type' => RC_NEW,
+                               'rc_deleted' => 0,
+                       ],
+                       $items[1][1]
+               );
+
+               $this->assertEquals( [ '20151212010103', 3 ], $startFrom );
+       }
+
+       public function testGetWatchedItemsWithRecentChangeInfo_extension() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               [ 'recentchanges', 'watchlist', 'page', 'extension_dummy_table' ],
+                               [
+                                       'rc_id',
+                                       'rc_namespace',
+                                       'rc_title',
+                                       'rc_timestamp',
+                                       'rc_type',
+                                       'rc_deleted',
+                                       'wl_notificationtimestamp',
+                                       'rc_cur_id',
+                                       'rc_this_oldid',
+                                       'rc_last_oldid',
+                                       'extension_dummy_field',
+                               ],
+                               [
+                                       'wl_user' => 1,
+                                       '(rc_this_oldid=page_latest) OR (rc_type=3)',
+                                       'extension_dummy_cond',
+                               ],
+                               $this->isType( 'string' ),
+                               [
+                                       'extension_dummy_option',
+                               ],
+                               [
+                                       'watchlist' => [
+                                               'INNER JOIN',
+                                               [
+                                                       'wl_namespace=rc_namespace',
+                                                       'wl_title=rc_title'
+                                               ]
+                                       ],
+                                       'page' => [
+                                               'LEFT JOIN',
+                                               'rc_cur_id=page_id',
+                                       ],
+                                       'extension_dummy_join_cond' => [],
+                               ]
+                       )
+                       ->will( $this->returnValue( [
+                               $this->getFakeRow( [
+                                       'rc_id' => 1,
+                                       'rc_namespace' => 0,
+                                       'rc_title' => 'Foo1',
+                                       'rc_timestamp' => '20151212010101',
+                                       'rc_type' => RC_NEW,
+                                       'rc_deleted' => 0,
+                                       'wl_notificationtimestamp' => '20151212010101',
+                               ] ),
+                               $this->getFakeRow( [
+                                       'rc_id' => 2,
+                                       'rc_namespace' => 1,
+                                       'rc_title' => 'Foo2',
+                                       'rc_timestamp' => '20151212010102',
+                                       'rc_type' => RC_NEW,
+                                       'rc_deleted' => 0,
+                                       'wl_notificationtimestamp' => null,
+                               ] ),
+                       ] ) );
+
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+
+               $mockExtension = $this->getMockBuilder( WatchedItemQueryServiceExtension::class )
+                       ->getMock();
+               $mockExtension->expects( $this->once() )
+                       ->method( 'modifyWatchedItemsWithRCInfoQuery' )
+                       ->with(
+                               $this->identicalTo( $user ),
+                               $this->isType( 'array' ),
+                               $this->isInstanceOf( IDatabase::class ),
+                               $this->isType( 'array' ),
+                               $this->isType( 'array' ),
+                               $this->isType( 'array' ),
+                               $this->isType( 'array' ),
+                               $this->isType( 'array' )
+                       )
+                       ->will( $this->returnCallback( function (
+                               $user, $options, $db, &$tables, &$fields, &$conds, &$dbOptions, &$joinConds
+                       ) {
+                               $tables[] = 'extension_dummy_table';
+                               $fields[] = 'extension_dummy_field';
+                               $conds[] = 'extension_dummy_cond';
+                               $dbOptions[] = 'extension_dummy_option';
+                               $joinConds['extension_dummy_join_cond'] = [];
+                       } ) );
+               $mockExtension->expects( $this->once() )
+                       ->method( 'modifyWatchedItemsWithRCInfo' )
+                       ->with(
+                               $this->identicalTo( $user ),
+                               $this->isType( 'array' ),
+                               $this->isInstanceOf( IDatabase::class ),
+                               $this->isType( 'array' ),
+                               $this->anything(),
+                               $this->anything() // Can't test for null here, PHPUnit applies this after the callback
+                       )
+                       ->will( $this->returnCallback( function ( $user, $options, $db, &$items, $res, &$startFrom ) {
+                               foreach ( $items as $i => &$item ) {
+                                       $item[1]['extension_dummy_field'] = $i;
+                               }
+                               unset( $item );
+
+                               $this->assertNull( $startFrom );
+                               $startFrom = [ '20160203123456', 42 ];
+                       } ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               TestingAccessWrapper::newFromObject( $queryService )->extensions = [ $mockExtension ];
+
+               $startFrom = null;
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
+                       $user, [], $startFrom
+               );
+
+               $this->assertInternalType( 'array', $items );
+               $this->assertCount( 2, $items );
+
+               foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
+                       $this->assertInstanceOf( WatchedItem::class, $watchedItem );
+                       $this->assertInternalType( 'array', $recentChangeInfo );
+               }
+
+               $this->assertEquals(
+                       new WatchedItem( $user, new TitleValue( 0, 'Foo1' ), '20151212010101' ),
+                       $items[0][0]
+               );
+               $this->assertEquals(
+                       [
+                               'rc_id' => 1,
+                               'rc_namespace' => 0,
+                               'rc_title' => 'Foo1',
+                               'rc_timestamp' => '20151212010101',
+                               'rc_type' => RC_NEW,
+                               'rc_deleted' => 0,
+                               'extension_dummy_field' => 0,
+                       ],
+                       $items[0][1]
+               );
+
+               $this->assertEquals(
+                       new WatchedItem( $user, new TitleValue( 1, 'Foo2' ), null ),
+                       $items[1][0]
+               );
+               $this->assertEquals(
+                       [
+                               'rc_id' => 2,
+                               'rc_namespace' => 1,
+                               'rc_title' => 'Foo2',
+                               'rc_timestamp' => '20151212010102',
+                               'rc_type' => RC_NEW,
+                               'rc_deleted' => 0,
+                               'extension_dummy_field' => 1,
+                       ],
+                       $items[1][1]
+               );
+
+               $this->assertEquals( [ '20160203123456', 42 ], $startFrom );
+       }
+
+       public function getWatchedItemsWithRecentChangeInfoOptionsProvider() {
+               return [
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_FLAGS ] ],
+                               null,
+                               [],
+                               [ 'rc_type', 'rc_minor', 'rc_bot' ],
+                               [],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_USER ] ],
+                               null,
+                               [],
+                               [ 'rc_user_text' ],
+                               [],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_USER_ID ] ],
+                               null,
+                               [],
+                               [ 'rc_user' ],
+                               [],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_COMMENT ] ],
+                               null,
+                               [],
+                               [
+                                       'rc_comment_text' => 'rc_comment',
+                                       'rc_comment_data' => 'NULL',
+                                       'rc_comment_cid' => 'NULL',
+                               ],
+                               [],
+                               [],
+                               [],
+                               [ 'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD ],
+                       ],
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_COMMENT ] ],
+                               null,
+                               [ 'comment_rc_comment' => 'comment' ],
+                               [
+                                       'rc_comment_text' => 'COALESCE( comment_rc_comment.comment_text, rc_comment )',
+                                       'rc_comment_data' => 'comment_rc_comment.comment_data',
+                                       'rc_comment_cid' => 'comment_rc_comment.comment_id',
+                               ],
+                               [],
+                               [],
+                               [ 'comment_rc_comment' => [ 'LEFT JOIN', 'comment_rc_comment.comment_id = rc_comment_id' ] ],
+                               [ 'wgCommentTableSchemaMigrationStage' => MIGRATION_WRITE_BOTH ],
+                       ],
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_COMMENT ] ],
+                               null,
+                               [ 'comment_rc_comment' => 'comment' ],
+                               [
+                                       'rc_comment_text' => 'COALESCE( comment_rc_comment.comment_text, rc_comment )',
+                                       'rc_comment_data' => 'comment_rc_comment.comment_data',
+                                       'rc_comment_cid' => 'comment_rc_comment.comment_id',
+                               ],
+                               [],
+                               [],
+                               [ 'comment_rc_comment' => [ 'LEFT JOIN', 'comment_rc_comment.comment_id = rc_comment_id' ] ],
+                               [ 'wgCommentTableSchemaMigrationStage' => MIGRATION_WRITE_NEW ],
+                       ],
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_COMMENT ] ],
+                               null,
+                               [ 'comment_rc_comment' => 'comment' ],
+                               [
+                                       'rc_comment_text' => 'comment_rc_comment.comment_text',
+                                       'rc_comment_data' => 'comment_rc_comment.comment_data',
+                                       'rc_comment_cid' => 'comment_rc_comment.comment_id',
+                               ],
+                               [],
+                               [],
+                               [ 'comment_rc_comment' => [ 'JOIN', 'comment_rc_comment.comment_id = rc_comment_id' ] ],
+                               [ 'wgCommentTableSchemaMigrationStage' => MIGRATION_NEW ],
+                       ],
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_PATROL_INFO ] ],
+                               null,
+                               [],
+                               [ 'rc_patrolled', 'rc_log_type' ],
+                               [],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_SIZES ] ],
+                               null,
+                               [],
+                               [ 'rc_old_len', 'rc_new_len' ],
+                               [],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'includeFields' => [ WatchedItemQueryService::INCLUDE_LOG_INFO ] ],
+                               null,
+                               [],
+                               [ 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ],
+                               [],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'namespaceIds' => [ 0, 1 ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'wl_namespace' => [ 0, 1 ] ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'namespaceIds' => [ 0, "1; DROP TABLE watchlist;\n--" ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'wl_namespace' => [ 0, 1 ] ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'rcTypes' => [ RC_EDIT, RC_NEW ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_type' => [ RC_EDIT, RC_NEW ] ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
+                               null,
+                               [],
+                               [],
+                               [],
+                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
+                               [],
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_NEWER ],
+                               null,
+                               [],
+                               [],
+                               [],
+                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
+                               [],
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_OLDER, 'start' => '20151212010101' ],
+                               null,
+                               [],
+                               [],
+                               [ "rc_timestamp <= '20151212010101'" ],
+                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
+                               [],
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_OLDER, 'end' => '20151212010101' ],
+                               null,
+                               [],
+                               [],
+                               [ "rc_timestamp >= '20151212010101'" ],
+                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
+                               [],
+                       ],
+                       [
+                               [
+                                       'dir' => WatchedItemQueryService::DIR_OLDER,
+                                       'start' => '20151212020101',
+                                       'end' => '20151212010101'
+                               ],
+                               null,
+                               [],
+                               [],
+                               [ "rc_timestamp <= '20151212020101'", "rc_timestamp >= '20151212010101'" ],
+                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
+                               [],
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_NEWER, 'start' => '20151212010101' ],
+                               null,
+                               [],
+                               [],
+                               [ "rc_timestamp >= '20151212010101'" ],
+                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
+                               [],
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_NEWER, 'end' => '20151212010101' ],
+                               null,
+                               [],
+                               [],
+                               [ "rc_timestamp <= '20151212010101'" ],
+                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
+                               [],
+                       ],
+                       [
+                               [
+                                       'dir' => WatchedItemQueryService::DIR_NEWER,
+                                       'start' => '20151212010101',
+                                       'end' => '20151212020101'
+                               ],
+                               null,
+                               [],
+                               [],
+                               [ "rc_timestamp >= '20151212010101'", "rc_timestamp <= '20151212020101'" ],
+                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
+                               [],
+                       ],
+                       [
+                               [ 'limit' => 10 ],
+                               null,
+                               [],
+                               [],
+                               [],
+                               [ 'LIMIT' => 11 ],
+                               [],
+                       ],
+                       [
+                               [ 'limit' => "10; DROP TABLE watchlist;\n--" ],
+                               null,
+                               [],
+                               [],
+                               [],
+                               [ 'LIMIT' => 11 ],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_MINOR ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_minor != 0' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_MINOR ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_minor = 0' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_BOT ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_bot != 0' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_BOT ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_bot = 0' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_ANON ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_user = 0' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_ANON ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_user != 0' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_PATROLLED ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_patrolled != 0' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_PATROLLED ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_patrolled = 0' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_UNREAD ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_timestamp >= wl_notificationtimestamp' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'filters' => [ WatchedItemQueryService::FILTER_NOT_UNREAD ] ],
+                               null,
+                               [],
+                               [],
+                               [ 'wl_notificationtimestamp IS NULL OR rc_timestamp < wl_notificationtimestamp' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'onlyByUser' => 'SomeOtherUser' ],
+                               null,
+                               [],
+                               [],
+                               [ 'rc_user_text' => 'SomeOtherUser' ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'notByUser' => 'SomeOtherUser' ],
+                               null,
+                               [],
+                               [],
+                               [ "rc_user_text != 'SomeOtherUser'" ],
+                               [],
+                               [],
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
+                               [ '20151212010101', 123 ],
+                               [],
+                               [],
+                               [
+                                       "(rc_timestamp < '20151212010101') OR ((rc_timestamp = '20151212010101') AND (rc_id <= 123))"
+                               ],
+                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
+                               [],
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_NEWER ],
+                               [ '20151212010101', 123 ],
+                               [],
+                               [],
+                               [
+                                       "(rc_timestamp > '20151212010101') OR ((rc_timestamp = '20151212010101') AND (rc_id >= 123))"
+                               ],
+                               [ 'ORDER BY' => [ 'rc_timestamp', 'rc_id' ] ],
+                               [],
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
+                               [ '20151212010101', "123; DROP TABLE watchlist;\n--" ],
+                               [],
+                               [],
+                               [
+                                       "(rc_timestamp < '20151212010101') OR ((rc_timestamp = '20151212010101') AND (rc_id <= 123))"
+                               ],
+                               [ 'ORDER BY' => [ 'rc_timestamp DESC', 'rc_id DESC' ] ],
+                               [],
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider getWatchedItemsWithRecentChangeInfoOptionsProvider
+        */
+       public function testGetWatchedItemsWithRecentChangeInfo_optionsAndEmptyResult(
+               array $options,
+               $startFrom,
+               array $expectedExtraTables,
+               array $expectedExtraFields,
+               array $expectedExtraConds,
+               array $expectedDbOptions,
+               array $expectedExtraJoinConds,
+               array $globals = []
+       ) {
+               // Sigh. This test class doesn't extend MediaWikiTestCase, so we have to reinvent setMwGlobals().
+               if ( $globals ) {
+                       $resetGlobals = [];
+                       foreach ( $globals as $k => $v ) {
+                               $resetGlobals[$k] = $GLOBALS[$k];
+                               $GLOBALS[$k] = $v;
+                       }
+                       $reset = new ScopedCallback( function () use ( $resetGlobals ) {
+                               foreach ( $resetGlobals as $k => $v ) {
+                                       $GLOBALS[$k] = $v;
+                               }
+                       } );
+               }
+
+               $expectedTables = array_merge( [ 'recentchanges', 'watchlist', 'page' ], $expectedExtraTables );
+               $expectedFields = array_merge(
+                       [
+                               'rc_id',
+                               'rc_namespace',
+                               'rc_title',
+                               'rc_timestamp',
+                               'rc_type',
+                               'rc_deleted',
+                               'wl_notificationtimestamp',
+
+                               'rc_cur_id',
+                               'rc_this_oldid',
+                               'rc_last_oldid',
+                       ],
+                       $expectedExtraFields
+               );
+               $expectedConds = array_merge(
+                       [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)', ],
+                       $expectedExtraConds
+               );
+               $expectedJoinConds = array_merge(
+                       [
+                               'watchlist' => [
+                                       'INNER JOIN',
+                                       [
+                                               'wl_namespace=rc_namespace',
+                                               'wl_title=rc_title'
+                                       ]
+                               ],
+                               'page' => [
+                                       'LEFT JOIN',
+                                       'rc_cur_id=page_id',
+                               ],
+                       ],
+                       $expectedExtraJoinConds
+               );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               $expectedTables,
+                               $expectedFields,
+                               $expectedConds,
+                               $this->isType( 'string' ),
+                               $expectedDbOptions,
+                               $expectedJoinConds
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo( $user, $options, $startFrom );
+
+               $this->assertEmpty( $items );
+               $this->assertNull( $startFrom );
+       }
+
+       public function filterPatrolledOptionProvider() {
+               return [
+                       [ WatchedItemQueryService::FILTER_PATROLLED ],
+                       [ WatchedItemQueryService::FILTER_NOT_PATROLLED ],
+               ];
+       }
+
+       /**
+        * @dataProvider filterPatrolledOptionProvider
+        */
+       public function testGetWatchedItemsWithRecentChangeInfo_filterPatrolledAndUserWithNoPatrolRights(
+               $filtersOption
+       ) {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               [ 'recentchanges', 'watchlist', 'page' ],
+                               $this->isType( 'array' ),
+                               [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)' ],
+                               $this->isType( 'string' ),
+                               $this->isType( 'array' ),
+                               $this->isType( 'array' )
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $user = $this->getMockNonAnonUserWithIdAndNoPatrolRights( 1 );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
+                       $user,
+                       [ 'filters' => [ $filtersOption ] ]
+               );
+
+               $this->assertEmpty( $items );
+       }
+
+       public function mysqlIndexOptimizationProvider() {
+               return [
+                       [
+                               'mysql',
+                               [],
+                               [ "rc_timestamp > ''" ],
+                       ],
+                       [
+                               'mysql',
+                               [ 'start' => '20151212010101', 'dir' => WatchedItemQueryService::DIR_OLDER ],
+                               [ "rc_timestamp <= '20151212010101'" ],
+                       ],
+                       [
+                               'mysql',
+                               [ 'end' => '20151212010101', 'dir' => WatchedItemQueryService::DIR_OLDER ],
+                               [ "rc_timestamp >= '20151212010101'" ],
+                       ],
+                       [
+                               'postgres',
+                               [],
+                               [],
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider mysqlIndexOptimizationProvider
+        */
+       public function testGetWatchedItemsWithRecentChangeInfo_mysqlIndexOptimization(
+               $dbType,
+               array $options,
+               array $expectedExtraConds
+       ) {
+               $commonConds = [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)' ];
+               $conds = array_merge( $commonConds, $expectedExtraConds );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               [ 'recentchanges', 'watchlist', 'page' ],
+                               $this->isType( 'array' ),
+                               $conds,
+                               $this->isType( 'string' ),
+                               $this->isType( 'array' ),
+                               $this->isType( 'array' )
+                       )
+                       ->will( $this->returnValue( [] ) );
+               $mockDb->expects( $this->any() )
+                       ->method( 'getType' )
+                       ->will( $this->returnValue( $dbType ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo( $user, $options );
+
+               $this->assertEmpty( $items );
+       }
+
+       public function userPermissionRelatedExtraChecksProvider() {
+               return [
+                       [
+                               [],
+                               'deletedhistory',
+                               [
+                                       '(rc_type != ' . RC_LOG . ') OR ((rc_deleted & ' . LogPage::DELETED_ACTION . ') != ' .
+                                               LogPage::DELETED_ACTION . ')'
+                               ],
+                       ],
+                       [
+                               [],
+                               'suppressrevision',
+                               [
+                                       '(rc_type != ' . RC_LOG . ') OR (' .
+                                               '(rc_deleted & ' . ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ') != ' .
+                                               ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ')'
+                               ],
+                       ],
+                       [
+                               [],
+                               'viewsuppressed',
+                               [
+                                       '(rc_type != ' . RC_LOG . ') OR (' .
+                                               '(rc_deleted & ' . ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ') != ' .
+                                               ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ')'
+                               ],
+                       ],
+                       [
+                               [ 'onlyByUser' => 'SomeOtherUser' ],
+                               'deletedhistory',
+                               [
+                                       'rc_user_text' => 'SomeOtherUser',
+                                       '(rc_deleted & ' . Revision::DELETED_USER . ') != ' . Revision::DELETED_USER,
+                                       '(rc_type != ' . RC_LOG . ') OR ((rc_deleted & ' . LogPage::DELETED_ACTION . ') != ' .
+                                               LogPage::DELETED_ACTION . ')'
+                               ],
+                       ],
+                       [
+                               [ 'onlyByUser' => 'SomeOtherUser' ],
+                               'suppressrevision',
+                               [
+                                       'rc_user_text' => 'SomeOtherUser',
+                                       '(rc_deleted & ' . ( Revision::DELETED_USER | Revision::DELETED_RESTRICTED ) . ') != ' .
+                                               ( Revision::DELETED_USER | Revision::DELETED_RESTRICTED ),
+                                       '(rc_type != ' . RC_LOG . ') OR (' .
+                                               '(rc_deleted & ' . ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ') != ' .
+                                               ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ')'
+                               ],
+                       ],
+                       [
+                               [ 'onlyByUser' => 'SomeOtherUser' ],
+                               'viewsuppressed',
+                               [
+                                       'rc_user_text' => 'SomeOtherUser',
+                                       '(rc_deleted & ' . ( Revision::DELETED_USER | Revision::DELETED_RESTRICTED ) . ') != ' .
+                                               ( Revision::DELETED_USER | Revision::DELETED_RESTRICTED ),
+                                       '(rc_type != ' . RC_LOG . ') OR (' .
+                                               '(rc_deleted & ' . ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ') != ' .
+                                               ( LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED ) . ')'
+                               ],
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider userPermissionRelatedExtraChecksProvider
+        */
+       public function testGetWatchedItemsWithRecentChangeInfo_userPermissionRelatedExtraChecks(
+               array $options,
+               $notAllowedAction,
+               array $expectedExtraConds
+       ) {
+               $commonConds = [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)' ];
+               $conds = array_merge( $commonConds, $expectedExtraConds );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               [ 'recentchanges', 'watchlist', 'page' ],
+                               $this->isType( 'array' ),
+                               $conds,
+                               $this->isType( 'string' ),
+                               $this->isType( 'array' ),
+                               $this->isType( 'array' )
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $user = $this->getMockNonAnonUserWithIdAndRestrictedPermissions( 1, $notAllowedAction );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo( $user, $options );
+
+               $this->assertEmpty( $items );
+       }
+
+       public function testGetWatchedItemsWithRecentChangeInfo_allRevisionsOptionAndEmptyResult() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               [ 'recentchanges', 'watchlist' ],
+                               [
+                                       'rc_id',
+                                       'rc_namespace',
+                                       'rc_title',
+                                       'rc_timestamp',
+                                       'rc_type',
+                                       'rc_deleted',
+                                       'wl_notificationtimestamp',
+
+                                       'rc_cur_id',
+                                       'rc_this_oldid',
+                                       'rc_last_oldid',
+                               ],
+                               [ 'wl_user' => 1, ],
+                               $this->isType( 'string' ),
+                               [],
+                               [
+                                       'watchlist' => [
+                                               'INNER JOIN',
+                                               [
+                                                       'wl_namespace=rc_namespace',
+                                                       'wl_title=rc_title'
+                                               ]
+                                       ],
+                               ]
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo( $user, [ 'allRevisions' => true ] );
+
+               $this->assertEmpty( $items );
+       }
+
+       public function getWatchedItemsWithRecentChangeInfoInvalidOptionsProvider() {
+               return [
+                       [
+                               [ 'rcTypes' => [ 1337 ] ],
+                               null,
+                               'Bad value for parameter $options[\'rcTypes\']',
+                       ],
+                       [
+                               [ 'rcTypes' => [ 'edit' ] ],
+                               null,
+                               'Bad value for parameter $options[\'rcTypes\']',
+                       ],
+                       [
+                               [ 'rcTypes' => [ RC_EDIT, 1337 ] ],
+                               null,
+                               'Bad value for parameter $options[\'rcTypes\']',
+                       ],
+                       [
+                               [ 'dir' => 'foo' ],
+                               null,
+                               'Bad value for parameter $options[\'dir\']',
+                       ],
+                       [
+                               [ 'start' => '20151212010101' ],
+                               null,
+                               'Bad value for parameter $options[\'dir\']: must be provided',
+                       ],
+                       [
+                               [ 'end' => '20151212010101' ],
+                               null,
+                               'Bad value for parameter $options[\'dir\']: must be provided',
+                       ],
+                       [
+                               [],
+                               [ '20151212010101', 123 ],
+                               'Bad value for parameter $options[\'dir\']: must be provided',
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
+                               '20151212010101',
+                               'Bad value for parameter $startFrom: must be a two-element array',
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
+                               [ '20151212010101' ],
+                               'Bad value for parameter $startFrom: must be a two-element array',
+                       ],
+                       [
+                               [ 'dir' => WatchedItemQueryService::DIR_OLDER ],
+                               [ '20151212010101', 123, 'foo' ],
+                               'Bad value for parameter $startFrom: must be a two-element array',
+                       ],
+                       [
+                               [ 'watchlistOwner' => $this->getMockUnrestrictedNonAnonUserWithId( 2 ) ],
+                               null,
+                               'Bad value for parameter $options[\'watchlistOwnerToken\']',
+                       ],
+                       [
+                               [ 'watchlistOwner' => 'Other User', 'watchlistOwnerToken' => 'some-token' ],
+                               null,
+                               'Bad value for parameter $options[\'watchlistOwner\']',
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider getWatchedItemsWithRecentChangeInfoInvalidOptionsProvider
+        */
+       public function testGetWatchedItemsWithRecentChangeInfo_invalidOptions(
+               array $options,
+               $startFrom,
+               $expectedInExceptionMessage
+       ) {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( $this->anything() );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+
+               $this->setExpectedException( InvalidArgumentException::class, $expectedInExceptionMessage );
+               $queryService->getWatchedItemsWithRecentChangeInfo( $user, $options, $startFrom );
+       }
+
+       public function testGetWatchedItemsWithRecentChangeInfo_usedInGeneratorOptionAndEmptyResult() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               [ 'recentchanges', 'watchlist', 'page' ],
+                               [
+                                       'rc_id',
+                                       'rc_namespace',
+                                       'rc_title',
+                                       'rc_timestamp',
+                                       'rc_type',
+                                       'rc_deleted',
+                                       'wl_notificationtimestamp',
+                                       'rc_cur_id',
+                               ],
+                               [ 'wl_user' => 1, '(rc_this_oldid=page_latest) OR (rc_type=3)' ],
+                               $this->isType( 'string' ),
+                               [],
+                               [
+                                       'watchlist' => [
+                                               'INNER JOIN',
+                                               [
+                                                       'wl_namespace=rc_namespace',
+                                                       'wl_title=rc_title'
+                                               ]
+                                       ],
+                                       'page' => [
+                                               'LEFT JOIN',
+                                               'rc_cur_id=page_id',
+                                       ],
+                               ]
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
+                       $user,
+                       [ 'usedInGenerator' => true ]
+               );
+
+               $this->assertEmpty( $items );
+       }
+
+       public function testGetWatchedItemsWithRecentChangeInfo_usedInGeneratorAllRevisionsOptions() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               [ 'recentchanges', 'watchlist' ],
+                               [
+                                       'rc_id',
+                                       'rc_namespace',
+                                       'rc_title',
+                                       'rc_timestamp',
+                                       'rc_type',
+                                       'rc_deleted',
+                                       'wl_notificationtimestamp',
+                                       'rc_this_oldid',
+                               ],
+                               [ 'wl_user' => 1 ],
+                               $this->isType( 'string' ),
+                               [],
+                               [
+                                       'watchlist' => [
+                                               'INNER JOIN',
+                                               [
+                                                       'wl_namespace=rc_namespace',
+                                                       'wl_title=rc_title'
+                                               ]
+                                       ],
+                               ]
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
+                       $user,
+                       [ 'usedInGenerator' => true, 'allRevisions' => true, ]
+               );
+
+               $this->assertEmpty( $items );
+       }
+
+       public function testGetWatchedItemsWithRecentChangeInfo_watchlistOwnerOptionAndEmptyResult() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               $this->isType( 'array' ),
+                               $this->isType( 'array' ),
+                               [
+                                       'wl_user' => 2,
+                                       '(rc_this_oldid=page_latest) OR (rc_type=3)',
+                               ],
+                               $this->isType( 'string' ),
+                               $this->isType( 'array' ),
+                               $this->isType( 'array' )
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+               $otherUser = $this->getMockUnrestrictedNonAnonUserWithId( 2 );
+               $otherUser->expects( $this->once() )
+                       ->method( 'getOption' )
+                       ->with( 'watchlisttoken' )
+                       ->willReturn( '0123456789abcdef' );
+
+               $items = $queryService->getWatchedItemsWithRecentChangeInfo(
+                       $user,
+                       [ 'watchlistOwner' => $otherUser, 'watchlistOwnerToken' => '0123456789abcdef' ]
+               );
+
+               $this->assertEmpty( $items );
+       }
+
+       public function invalidWatchlistTokenProvider() {
+               return [
+                       [ 'wrongToken' ],
+                       [ '' ],
+               ];
+       }
+
+       /**
+        * @dataProvider invalidWatchlistTokenProvider
+        */
+       public function testGetWatchedItemsWithRecentChangeInfo_watchlistOwnerAndInvalidToken( $token ) {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( $this->anything() );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockUnrestrictedNonAnonUserWithId( 1 );
+               $otherUser = $this->getMockUnrestrictedNonAnonUserWithId( 2 );
+               $otherUser->expects( $this->once() )
+                       ->method( 'getOption' )
+                       ->with( 'watchlisttoken' )
+                       ->willReturn( '0123456789abcdef' );
+
+               $this->setExpectedException( ApiUsageException::class, 'Incorrect watchlist token provided' );
+               $queryService->getWatchedItemsWithRecentChangeInfo(
+                       $user,
+                       [ 'watchlistOwner' => $otherUser, 'watchlistOwnerToken' => $token ]
+               );
+       }
+
+       public function testGetWatchedItemsForUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                               [ 'wl_user' => 1 ]
+                       )
+                       ->will( $this->returnValue( [
+                               $this->getFakeRow( [
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'Foo1',
+                                       'wl_notificationtimestamp' => '20151212010101',
+                               ] ),
+                               $this->getFakeRow( [
+                                       'wl_namespace' => 1,
+                                       'wl_title' => 'Foo2',
+                                       'wl_notificationtimestamp' => null,
+                               ] ),
+                       ] ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+               $user = $this->getMockNonAnonUserWithId( 1 );
+
+               $items = $queryService->getWatchedItemsForUser( $user );
+
+               $this->assertInternalType( 'array', $items );
+               $this->assertCount( 2, $items );
+               $this->assertContainsOnlyInstancesOf( WatchedItem::class, $items );
+               $this->assertEquals(
+                       new WatchedItem( $user, new TitleValue( 0, 'Foo1' ), '20151212010101' ),
+                       $items[0]
+               );
+               $this->assertEquals(
+                       new WatchedItem( $user, new TitleValue( 1, 'Foo2' ), null ),
+                       $items[1]
+               );
+       }
+
+       public function provideGetWatchedItemsForUserOptions() {
+               return [
+                       [
+                               [ 'namespaceIds' => [ 0, 1 ], ],
+                               [ 'wl_namespace' => [ 0, 1 ], ],
+                               []
+                       ],
+                       [
+                               [ 'sort' => WatchedItemQueryService::SORT_ASC, ],
+                               [],
+                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
+                       ],
+                       [
+                               [
+                                       'namespaceIds' => [ 0 ],
+                                       'sort' => WatchedItemQueryService::SORT_ASC,
+                               ],
+                               [ 'wl_namespace' => [ 0 ], ],
+                               [ 'ORDER BY' => 'wl_title ASC' ]
+                       ],
+                       [
+                               [ 'limit' => 10 ],
+                               [],
+                               [ 'LIMIT' => 10 ]
+                       ],
+                       [
+                               [
+                                       'namespaceIds' => [ 0, "1; DROP TABLE watchlist;\n--" ],
+                                       'limit' => "10; DROP TABLE watchlist;\n--",
+                               ],
+                               [ 'wl_namespace' => [ 0, 1 ], ],
+                               [ 'LIMIT' => 10 ]
+                       ],
+                       [
+                               [ 'filter' => WatchedItemQueryService::FILTER_CHANGED ],
+                               [ 'wl_notificationtimestamp IS NOT NULL' ],
+                               []
+                       ],
+                       [
+                               [ 'filter' => WatchedItemQueryService::FILTER_NOT_CHANGED ],
+                               [ 'wl_notificationtimestamp IS NULL' ],
+                               []
+                       ],
+                       [
+                               [ 'sort' => WatchedItemQueryService::SORT_DESC, ],
+                               [],
+                               [ 'ORDER BY' => [ 'wl_namespace DESC', 'wl_title DESC' ] ]
+                       ],
+                       [
+                               [
+                                       'namespaceIds' => [ 0 ],
+                                       'sort' => WatchedItemQueryService::SORT_DESC,
+                               ],
+                               [ 'wl_namespace' => [ 0 ], ],
+                               [ 'ORDER BY' => 'wl_title DESC' ]
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideGetWatchedItemsForUserOptions
+        */
+       public function testGetWatchedItemsForUser_optionsAndEmptyResult(
+               array $options,
+               array $expectedConds,
+               array $expectedDbOptions
+       ) {
+               $mockDb = $this->getMockDb();
+               $user = $this->getMockNonAnonUserWithId( 1 );
+
+               $expectedConds = array_merge( [ 'wl_user' => 1 ], $expectedConds );
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                               $expectedConds,
+                               $this->isType( 'string' ),
+                               $expectedDbOptions
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+
+               $items = $queryService->getWatchedItemsForUser( $user, $options );
+               $this->assertEmpty( $items );
+       }
+
+       public function provideGetWatchedItemsForUser_fromUntilStartFromOptions() {
+               return [
+                       [
+                               [
+                                       'from' => new TitleValue( 0, 'SomeDbKey' ),
+                                       'sort' => WatchedItemQueryService::SORT_ASC
+                               ],
+                               [ "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'SomeDbKey'))", ],
+                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
+                       ],
+                       [
+                               [
+                                       'from' => new TitleValue( 0, 'SomeDbKey' ),
+                                       'sort' => WatchedItemQueryService::SORT_DESC,
+                               ],
+                               [ "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeDbKey'))", ],
+                               [ 'ORDER BY' => [ 'wl_namespace DESC', 'wl_title DESC' ] ]
+                       ],
+                       [
+                               [
+                                       'until' => new TitleValue( 0, 'SomeDbKey' ),
+                                       'sort' => WatchedItemQueryService::SORT_ASC
+                               ],
+                               [ "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeDbKey'))", ],
+                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
+                       ],
+                       [
+                               [
+                                       'until' => new TitleValue( 0, 'SomeDbKey' ),
+                                       'sort' => WatchedItemQueryService::SORT_DESC
+                               ],
+                               [ "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'SomeDbKey'))", ],
+                               [ 'ORDER BY' => [ 'wl_namespace DESC', 'wl_title DESC' ] ]
+                       ],
+                       [
+                               [
+                                       'from' => new TitleValue( 0, 'AnotherDbKey' ),
+                                       'until' => new TitleValue( 0, 'SomeOtherDbKey' ),
+                                       'startFrom' => new TitleValue( 0, 'SomeDbKey' ),
+                                       'sort' => WatchedItemQueryService::SORT_ASC
+                               ],
+                               [
+                                       "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'AnotherDbKey'))",
+                                       "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeOtherDbKey'))",
+                                       "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'SomeDbKey'))",
+                               ],
+                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
+                       ],
+                       [
+                               [
+                                       'from' => new TitleValue( 0, 'SomeOtherDbKey' ),
+                                       'until' => new TitleValue( 0, 'AnotherDbKey' ),
+                                       'startFrom' => new TitleValue( 0, 'SomeDbKey' ),
+                                       'sort' => WatchedItemQueryService::SORT_DESC
+                               ],
+                               [
+                                       "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeOtherDbKey'))",
+                                       "(wl_namespace > 0) OR ((wl_namespace = 0) AND (wl_title >= 'AnotherDbKey'))",
+                                       "(wl_namespace < 0) OR ((wl_namespace = 0) AND (wl_title <= 'SomeDbKey'))",
+                               ],
+                               [ 'ORDER BY' => [ 'wl_namespace DESC', 'wl_title DESC' ] ]
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideGetWatchedItemsForUser_fromUntilStartFromOptions
+        */
+       public function testGetWatchedItemsForUser_fromUntilStartFromOptions(
+               array $options,
+               array $expectedConds,
+               array $expectedDbOptions
+       ) {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+
+               $expectedConds = array_merge( [ 'wl_user' => 1 ], $expectedConds );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->any() )
+                       ->method( 'addQuotes' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return "'$value'";
+                       } ) );
+               $mockDb->expects( $this->any() )
+                       ->method( 'makeList' )
+                       ->with(
+                               $this->isType( 'array' ),
+                               $this->isType( 'int' )
+                       )
+                       ->will( $this->returnCallback( function ( $a, $conj ) {
+                               $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
+                               return join( $sqlConj, array_map( function ( $s ) {
+                                       return '(' . $s . ')';
+                               }, $a
+                               ) );
+                       } ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                               $expectedConds,
+                               $this->isType( 'string' ),
+                               $expectedDbOptions
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+
+               $items = $queryService->getWatchedItemsForUser( $user, $options );
+               $this->assertEmpty( $items );
+       }
+
+       public function getWatchedItemsForUserInvalidOptionsProvider() {
+               return [
+                       [
+                               [ 'sort' => 'foo' ],
+                               'Bad value for parameter $options[\'sort\']'
+                       ],
+                       [
+                               [ 'filter' => 'foo' ],
+                               'Bad value for parameter $options[\'filter\']'
+                       ],
+                       [
+                               [ 'from' => new TitleValue( 0, 'SomeDbKey' ), ],
+                               'Bad value for parameter $options[\'sort\']: must be provided'
+                       ],
+                       [
+                               [ 'until' => new TitleValue( 0, 'SomeDbKey' ), ],
+                               'Bad value for parameter $options[\'sort\']: must be provided'
+                       ],
+                       [
+                               [ 'startFrom' => new TitleValue( 0, 'SomeDbKey' ), ],
+                               'Bad value for parameter $options[\'sort\']: must be provided'
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider getWatchedItemsForUserInvalidOptionsProvider
+        */
+       public function testGetWatchedItemsForUser_invalidOptionThrowsException(
+               array $options,
+               $expectedInExceptionMessage
+       ) {
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $this->getMockDb() ) );
+
+               $this->setExpectedException( InvalidArgumentException::class, $expectedInExceptionMessage );
+               $queryService->getWatchedItemsForUser( $this->getMockNonAnonUserWithId( 1 ), $options );
+       }
+
+       public function testGetWatchedItemsForUser_userNotAllowedToViewWatchlist() {
+               $mockDb = $this->getMockDb();
+
+               $mockDb->expects( $this->never() )
+                       ->method( $this->anything() );
+
+               $queryService = new WatchedItemQueryService( $this->getMockLoadBalancer( $mockDb ) );
+
+               $items = $queryService->getWatchedItemsForUser( $this->getMockAnonUser() );
+               $this->assertEmpty( $items );
+       }
+
+}
diff --git a/tests/phpunit/includes/watcheditem/WatchedItemStoreIntegrationTest.php b/tests/phpunit/includes/watcheditem/WatchedItemStoreIntegrationTest.php
new file mode 100644 (file)
index 0000000..61b62aa
--- /dev/null
@@ -0,0 +1,214 @@
+<?php
+
+use MediaWiki\MediaWikiServices;
+
+/**
+ * @author Addshore
+ *
+ * @group Database
+ *
+ * @covers WatchedItemStore
+ */
+class WatchedItemStoreIntegrationTest extends MediaWikiTestCase {
+
+       public function setUp() {
+               parent::setUp();
+               self::$users['WatchedItemStoreIntegrationTestUser']
+                       = new TestUser( 'WatchedItemStoreIntegrationTestUser' );
+       }
+
+       private function getUser() {
+               return self::$users['WatchedItemStoreIntegrationTestUser']->getUser();
+       }
+
+       public function testWatchAndUnWatchItem() {
+               $user = $this->getUser();
+               $title = Title::newFromText( 'WatchedItemStoreIntegrationTestPage' );
+               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+               // Cleanup after previous tests
+               $store->removeWatch( $user, $title );
+               $initialWatchers = $store->countWatchers( $title );
+               $initialUserWatchedItems = $store->countWatchedItems( $user );
+
+               $this->assertFalse(
+                       $store->isWatched( $user, $title ),
+                       'Page should not initially be watched'
+               );
+
+               $store->addWatch( $user, $title );
+               $this->assertTrue(
+                       $store->isWatched( $user, $title ),
+                       'Page should be watched'
+               );
+               $this->assertEquals( $initialUserWatchedItems + 1, $store->countWatchedItems( $user ) );
+               $watchedItemsForUser = $store->getWatchedItemsForUser( $user );
+               $this->assertCount( $initialUserWatchedItems + 1, $watchedItemsForUser );
+               $watchedItemsForUserHasExpectedItem = false;
+               foreach ( $watchedItemsForUser as $watchedItem ) {
+                       if (
+                               $watchedItem->getUser()->equals( $user ) &&
+                               $watchedItem->getLinkTarget() == $title->getTitleValue()
+                       ) {
+                               $watchedItemsForUserHasExpectedItem = true;
+                       }
+               }
+               $this->assertTrue(
+                       $watchedItemsForUserHasExpectedItem,
+                       'getWatchedItemsForUser should contain the page'
+               );
+               $this->assertEquals( $initialWatchers + 1, $store->countWatchers( $title ) );
+               $this->assertEquals(
+                       $initialWatchers + 1,
+                       $store->countWatchersMultiple( [ $title ] )[$title->getNamespace()][$title->getDBkey()]
+               );
+               $this->assertEquals(
+                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => $initialWatchers + 1 ] ],
+                       $store->countWatchersMultiple( [ $title ], [ 'minimumWatchers' => $initialWatchers + 1 ] )
+               );
+               $this->assertEquals(
+                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => 0 ] ],
+                       $store->countWatchersMultiple( [ $title ], [ 'minimumWatchers' => $initialWatchers + 2 ] )
+               );
+               $this->assertEquals(
+                       [ $title->getNamespace() => [ $title->getDBkey() => null ] ],
+                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
+               );
+
+               $store->removeWatch( $user, $title );
+               $this->assertFalse(
+                       $store->isWatched( $user, $title ),
+                       'Page should be unwatched'
+               );
+               $this->assertEquals( $initialUserWatchedItems, $store->countWatchedItems( $user ) );
+               $watchedItemsForUser = $store->getWatchedItemsForUser( $user );
+               $this->assertCount( $initialUserWatchedItems, $watchedItemsForUser );
+               $watchedItemsForUserHasExpectedItem = false;
+               foreach ( $watchedItemsForUser as $watchedItem ) {
+                       if (
+                               $watchedItem->getUser()->equals( $user ) &&
+                               $watchedItem->getLinkTarget() == $title->getTitleValue()
+                       ) {
+                               $watchedItemsForUserHasExpectedItem = true;
+                       }
+               }
+               $this->assertFalse(
+                       $watchedItemsForUserHasExpectedItem,
+                       'getWatchedItemsForUser should not contain the page'
+               );
+               $this->assertEquals( $initialWatchers, $store->countWatchers( $title ) );
+               $this->assertEquals(
+                       $initialWatchers,
+                       $store->countWatchersMultiple( [ $title ] )[$title->getNamespace()][$title->getDBkey()]
+               );
+               $this->assertEquals(
+                       [ $title->getNamespace() => [ $title->getDBkey() => false ] ],
+                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
+               );
+       }
+
+       public function testUpdateResetAndSetNotificationTimestamp() {
+               $user = $this->getUser();
+               $otherUser = ( new TestUser( 'WatchedItemStoreIntegrationTestUser_otherUser' ) )->getUser();
+               $title = Title::newFromText( 'WatchedItemStoreIntegrationTestPage' );
+               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+               $store->addWatch( $user, $title );
+               $this->assertNull( $store->loadWatchedItem( $user, $title )->getNotificationTimestamp() );
+               $initialVisitingWatchers = $store->countVisitingWatchers( $title, '20150202020202' );
+               $initialUnreadNotifications = $store->countUnreadNotifications( $user );
+
+               $store->updateNotificationTimestamp( $otherUser, $title, '20150202010101' );
+               $this->assertEquals(
+                       '20150202010101',
+                       $store->loadWatchedItem( $user, $title )->getNotificationTimestamp()
+               );
+               $this->assertEquals(
+                       [ $title->getNamespace() => [ $title->getDBkey() => '20150202010101' ] ],
+                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
+               );
+               $this->assertEquals(
+                       $initialVisitingWatchers - 1,
+                       $store->countVisitingWatchers( $title, '20150202020202' )
+               );
+               $this->assertEquals(
+                       $initialVisitingWatchers - 1,
+                       $store->countVisitingWatchersMultiple(
+                               [ [ $title, '20150202020202' ] ]
+                       )[$title->getNamespace()][$title->getDBkey()]
+               );
+               $this->assertEquals(
+                       $initialUnreadNotifications + 1,
+                       $store->countUnreadNotifications( $user )
+               );
+               $this->assertSame(
+                       true,
+                       $store->countUnreadNotifications( $user, $initialUnreadNotifications + 1 )
+               );
+
+               $this->assertTrue( $store->resetNotificationTimestamp( $user, $title ) );
+               $this->assertNull( $store->getWatchedItem( $user, $title )->getNotificationTimestamp() );
+               $this->assertEquals(
+                       [ $title->getNamespace() => [ $title->getDBkey() => null ] ],
+                       $store->getNotificationTimestampsBatch( $user, [ $title ] )
+               );
+               $this->assertEquals(
+                       $initialVisitingWatchers,
+                       $store->countVisitingWatchers( $title, '20150202020202' )
+               );
+               $this->assertEquals(
+                       $initialVisitingWatchers,
+                       $store->countVisitingWatchersMultiple(
+                               [ [ $title, '20150202020202' ] ]
+                       )[$title->getNamespace()][$title->getDBkey()]
+               );
+               $this->assertEquals(
+                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => $initialVisitingWatchers ] ],
+                       $store->countVisitingWatchersMultiple(
+                               [ [ $title, '20150202020202' ] ], $initialVisitingWatchers
+                       )
+               );
+               $this->assertEquals(
+                       [ 0 => [ 'WatchedItemStoreIntegrationTestPage' => 0 ] ],
+                       $store->countVisitingWatchersMultiple(
+                               [ [ $title, '20150202020202' ] ], $initialVisitingWatchers + 1
+                       )
+               );
+
+               // setNotificationTimestampsForUser specifying a title
+               $this->assertTrue(
+                       $store->setNotificationTimestampsForUser( $user, '20200202020202', [ $title ] )
+               );
+               $this->assertEquals(
+                       '20200202020202',
+                       $store->getWatchedItem( $user, $title )->getNotificationTimestamp()
+               );
+
+               // setNotificationTimestampsForUser not specifying a title
+               $this->assertTrue(
+                       $store->setNotificationTimestampsForUser( $user, '20210202020202' )
+               );
+               $this->assertEquals(
+                       '20210202020202',
+                       $store->getWatchedItem( $user, $title )->getNotificationTimestamp()
+               );
+       }
+
+       public function testDuplicateAllAssociatedEntries() {
+               $user = $this->getUser();
+               $titleOld = Title::newFromText( 'WatchedItemStoreIntegrationTestPageOld' );
+               $titleNew = Title::newFromText( 'WatchedItemStoreIntegrationTestPageNew' );
+               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+               $store->addWatch( $user, $titleOld->getSubjectPage() );
+               $store->addWatch( $user, $titleOld->getTalkPage() );
+               // Cleanup after previous tests
+               $store->removeWatch( $user, $titleNew->getSubjectPage() );
+               $store->removeWatch( $user, $titleNew->getTalkPage() );
+
+               $store->duplicateAllAssociatedEntries( $titleOld, $titleNew );
+
+               $this->assertTrue( $store->isWatched( $user, $titleOld->getSubjectPage() ) );
+               $this->assertTrue( $store->isWatched( $user, $titleOld->getTalkPage() ) );
+               $this->assertTrue( $store->isWatched( $user, $titleNew->getSubjectPage() ) );
+               $this->assertTrue( $store->isWatched( $user, $titleNew->getTalkPage() ) );
+       }
+
+}
diff --git a/tests/phpunit/includes/watcheditem/WatchedItemStoreUnitTest.php b/tests/phpunit/includes/watcheditem/WatchedItemStoreUnitTest.php
new file mode 100644 (file)
index 0000000..43b4fe9
--- /dev/null
@@ -0,0 +1,2675 @@
+<?php
+use MediaWiki\Linker\LinkTarget;
+use Wikimedia\Rdbms\LoadBalancer;
+use Wikimedia\ScopedCallback;
+
+/**
+ * @author Addshore
+ *
+ * @covers WatchedItemStore
+ */
+class WatchedItemStoreUnitTest extends MediaWikiTestCase {
+
+       /**
+        * @return PHPUnit_Framework_MockObject_MockObject|IDatabase
+        */
+       private function getMockDb() {
+               return $this->createMock( IDatabase::class );
+       }
+
+       /**
+        * @return PHPUnit_Framework_MockObject_MockObject|LoadBalancer
+        */
+       private function getMockLoadBalancer(
+               $mockDb,
+               $expectedConnectionType = null
+       ) {
+               $mock = $this->getMockBuilder( LoadBalancer::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               if ( $expectedConnectionType !== null ) {
+                       $mock->expects( $this->any() )
+                               ->method( 'getConnectionRef' )
+                               ->with( $expectedConnectionType )
+                               ->will( $this->returnValue( $mockDb ) );
+               } else {
+                       $mock->expects( $this->any() )
+                               ->method( 'getConnectionRef' )
+                               ->will( $this->returnValue( $mockDb ) );
+               }
+               return $mock;
+       }
+
+       /**
+        * @return PHPUnit_Framework_MockObject_MockObject|HashBagOStuff
+        */
+       private function getMockCache() {
+               $mock = $this->getMockBuilder( HashBagOStuff::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $mock->expects( $this->any() )
+                       ->method( 'makeKey' )
+                       ->will( $this->returnCallback( function () {
+                               return implode( ':', func_get_args() );
+                       } ) );
+               return $mock;
+       }
+
+       /**
+        * @return PHPUnit_Framework_MockObject_MockObject|ReadOnlyMode
+        */
+       private function getMockReadOnlyMode( $readOnly = false ) {
+               $mock = $this->getMockBuilder( ReadOnlyMode::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $mock->expects( $this->any() )
+                       ->method( 'isReadOnly' )
+                       ->will( $this->returnValue( $readOnly ) );
+               return $mock;
+       }
+
+       /**
+        * @param int $id
+        * @return PHPUnit_Framework_MockObject_MockObject|User
+        */
+       private function getMockNonAnonUserWithId( $id ) {
+               $mock = $this->createMock( User::class );
+               $mock->expects( $this->any() )
+                       ->method( 'isAnon' )
+                       ->will( $this->returnValue( false ) );
+               $mock->expects( $this->any() )
+                       ->method( 'getId' )
+                       ->will( $this->returnValue( $id ) );
+               return $mock;
+       }
+
+       /**
+        * @return User
+        */
+       private function getAnonUser() {
+               return User::newFromName( 'Anon_User' );
+       }
+
+       private function getFakeRow( array $rowValues ) {
+               $fakeRow = new stdClass();
+               foreach ( $rowValues as $valueName => $value ) {
+                       $fakeRow->$valueName = $value;
+               }
+               return $fakeRow;
+       }
+
+       private function newWatchedItemStore( LoadBalancer $loadBalancer, HashBagOStuff $cache,
+               ReadOnlyMode $readOnlyMode
+       ) {
+               return new WatchedItemStore(
+                       $loadBalancer,
+                       $cache,
+                       $readOnlyMode
+               );
+       }
+
+       public function testCountWatchedItems() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'selectField' )
+                       ->with(
+                               'watchlist',
+                               'COUNT(*)',
+                               [
+                                       'wl_user' => $user->getId(),
+                               ],
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 12 ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals( 12, $store->countWatchedItems( $user ) );
+       }
+
+       public function testCountWatchers() {
+               $titleValue = new TitleValue( 0, 'SomeDbKey' );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'selectField' )
+                       ->with(
+                               'watchlist',
+                               'COUNT(*)',
+                               [
+                                       'wl_namespace' => $titleValue->getNamespace(),
+                                       'wl_title' => $titleValue->getDBkey(),
+                               ],
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 7 ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals( 7, $store->countWatchers( $titleValue ) );
+       }
+
+       public function testCountWatchersMultiple() {
+               $titleValues = [
+                       new TitleValue( 0, 'SomeDbKey' ),
+                       new TitleValue( 0, 'OtherDbKey' ),
+                       new TitleValue( 1, 'AnotherDbKey' ),
+               ];
+
+               $mockDb = $this->getMockDb();
+
+               $dbResult = [
+                       $this->getFakeRow( [ 'wl_title' => 'SomeDbKey', 'wl_namespace' => 0, 'watchers' => 100 ] ),
+                       $this->getFakeRow( [ 'wl_title' => 'OtherDbKey', 'wl_namespace' => 0, 'watchers' => 300 ] ),
+                       $this->getFakeRow( [ 'wl_title' => 'AnotherDbKey', 'wl_namespace' => 1, 'watchers' => 500 ]
+                       ),
+               ];
+               $mockDb->expects( $this->once() )
+                       ->method( 'makeWhereFrom2d' )
+                       ->with(
+                               [ [ 'SomeDbKey' => 1, 'OtherDbKey' => 1 ], [ 'AnotherDbKey' => 1 ] ],
+                               $this->isType( 'string' ),
+                               $this->isType( 'string' )
+                               )
+                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_title', 'wl_namespace', 'watchers' => 'COUNT(*)' ],
+                               [ 'makeWhereFrom2d return value' ],
+                               $this->isType( 'string' ),
+                               [
+                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
+                               ]
+                       )
+                       ->will(
+                               $this->returnValue( $dbResult )
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $expected = [
+                       0 => [ 'SomeDbKey' => 100, 'OtherDbKey' => 300 ],
+                       1 => [ 'AnotherDbKey' => 500 ],
+               ];
+               $this->assertEquals( $expected, $store->countWatchersMultiple( $titleValues ) );
+       }
+
+       public function provideIntWithDbUnsafeVersion() {
+               return [
+                       [ 50 ],
+                       [ "50; DROP TABLE watchlist;\n--" ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideIntWithDbUnsafeVersion
+        */
+       public function testCountWatchersMultiple_withMinimumWatchers( $minWatchers ) {
+               $titleValues = [
+                       new TitleValue( 0, 'SomeDbKey' ),
+                       new TitleValue( 0, 'OtherDbKey' ),
+                       new TitleValue( 1, 'AnotherDbKey' ),
+               ];
+
+               $mockDb = $this->getMockDb();
+
+               $dbResult = [
+                       $this->getFakeRow( [ 'wl_title' => 'SomeDbKey', 'wl_namespace' => 0, 'watchers' => 100 ] ),
+                       $this->getFakeRow( [ 'wl_title' => 'OtherDbKey', 'wl_namespace' => 0, 'watchers' => 300 ] ),
+                       $this->getFakeRow( [ 'wl_title' => 'AnotherDbKey', 'wl_namespace' => 1, 'watchers' => 500 ]
+                       ),
+               ];
+               $mockDb->expects( $this->once() )
+                       ->method( 'makeWhereFrom2d' )
+                       ->with(
+                               [ [ 'SomeDbKey' => 1, 'OtherDbKey' => 1 ], [ 'AnotherDbKey' => 1 ] ],
+                               $this->isType( 'string' ),
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_title', 'wl_namespace', 'watchers' => 'COUNT(*)' ],
+                               [ 'makeWhereFrom2d return value' ],
+                               $this->isType( 'string' ),
+                               [
+                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
+                                       'HAVING' => 'COUNT(*) >= 50',
+                               ]
+                       )
+                       ->will(
+                               $this->returnValue( $dbResult )
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $expected = [
+                       0 => [ 'SomeDbKey' => 100, 'OtherDbKey' => 300 ],
+                       1 => [ 'AnotherDbKey' => 500 ],
+               ];
+               $this->assertEquals(
+                       $expected,
+                       $store->countWatchersMultiple( $titleValues, [ 'minimumWatchers' => $minWatchers ] )
+               );
+       }
+
+       public function testCountVisitingWatchers() {
+               $titleValue = new TitleValue( 0, 'SomeDbKey' );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'selectField' )
+                       ->with(
+                               'watchlist',
+                               'COUNT(*)',
+                               [
+                                       'wl_namespace' => $titleValue->getNamespace(),
+                                       'wl_title' => $titleValue->getDBkey(),
+                                       'wl_notificationtimestamp >= \'TS111TS\' OR wl_notificationtimestamp IS NULL',
+                               ],
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 7 ) );
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'addQuotes' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return "'$value'";
+                       } ) );
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'timestamp' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return 'TS' . $value . 'TS';
+                       } ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals( 7, $store->countVisitingWatchers( $titleValue, '111' ) );
+       }
+
+       public function testCountVisitingWatchersMultiple() {
+               $titleValuesWithThresholds = [
+                       [ new TitleValue( 0, 'SomeDbKey' ), '111' ],
+                       [ new TitleValue( 0, 'OtherDbKey' ), '111' ],
+                       [ new TitleValue( 1, 'AnotherDbKey' ), '123' ],
+               ];
+
+               $dbResult = [
+                       $this->getFakeRow( [ 'wl_title' => 'SomeDbKey', 'wl_namespace' => 0, 'watchers' => 100 ] ),
+                       $this->getFakeRow( [ 'wl_title' => 'OtherDbKey', 'wl_namespace' => 0, 'watchers' => 300 ] ),
+                       $this->getFakeRow( [ 'wl_title' => 'AnotherDbKey', 'wl_namespace' => 1, 'watchers' => 500 ] ),
+               ];
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->exactly( 2 * 3 ) )
+                       ->method( 'addQuotes' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return "'$value'";
+                       } ) );
+               $mockDb->expects( $this->exactly( 3 ) )
+                       ->method( 'timestamp' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return 'TS' . $value . 'TS';
+                       } ) );
+               $mockDb->expects( $this->any() )
+                       ->method( 'makeList' )
+                       ->with(
+                               $this->isType( 'array' ),
+                               $this->isType( 'int' )
+                       )
+                       ->will( $this->returnCallback( function ( $a, $conj ) {
+                               $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
+                               return join( $sqlConj, array_map( function ( $s ) {
+                                       return '(' . $s . ')';
+                               }, $a
+                               ) );
+                       } ) );
+               $mockDb->expects( $this->never() )
+                       ->method( 'makeWhereFrom2d' );
+
+               $expectedCond =
+                       '((wl_namespace = 0) AND (' .
+                       "(((wl_title = 'SomeDbKey') AND (" .
+                       "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
+                       ')) OR (' .
+                       "(wl_title = 'OtherDbKey') AND (" .
+                       "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
+                       '))))' .
+                       ') OR ((wl_namespace = 1) AND (' .
+                       "(((wl_title = 'AnotherDbKey') AND (".
+                       "(wl_notificationtimestamp >= 'TS123TS') OR (wl_notificationtimestamp IS NULL)" .
+                       ')))))';
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'watchers' => 'COUNT(*)' ],
+                               $expectedCond,
+                               $this->isType( 'string' ),
+                               [
+                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
+                               ]
+                       )
+                       ->will(
+                               $this->returnValue( $dbResult )
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $expected = [
+                       0 => [ 'SomeDbKey' => 100, 'OtherDbKey' => 300 ],
+                       1 => [ 'AnotherDbKey' => 500 ],
+               ];
+               $this->assertEquals(
+                       $expected,
+                       $store->countVisitingWatchersMultiple( $titleValuesWithThresholds )
+               );
+       }
+
+       public function testCountVisitingWatchersMultiple_withMissingTargets() {
+               $titleValuesWithThresholds = [
+                       [ new TitleValue( 0, 'SomeDbKey' ), '111' ],
+                       [ new TitleValue( 0, 'OtherDbKey' ), '111' ],
+                       [ new TitleValue( 1, 'AnotherDbKey' ), '123' ],
+                       [ new TitleValue( 0, 'SomeNotExisitingDbKey' ), null ],
+                       [ new TitleValue( 0, 'OtherNotExisitingDbKey' ), null ],
+               ];
+
+               $dbResult = [
+                       $this->getFakeRow( [ 'wl_title' => 'SomeDbKey', 'wl_namespace' => 0, 'watchers' => 100 ] ),
+                       $this->getFakeRow( [ 'wl_title' => 'OtherDbKey', 'wl_namespace' => 0, 'watchers' => 300 ] ),
+                       $this->getFakeRow( [ 'wl_title' => 'AnotherDbKey', 'wl_namespace' => 1, 'watchers' => 500 ] ),
+                       $this->getFakeRow(
+                               [ 'wl_title' => 'SomeNotExisitingDbKey', 'wl_namespace' => 0, 'watchers' => 100 ]
+                       ),
+                       $this->getFakeRow(
+                               [ 'wl_title' => 'OtherNotExisitingDbKey', 'wl_namespace' => 0, 'watchers' => 200 ]
+                       ),
+               ];
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->exactly( 2 * 3 ) )
+                       ->method( 'addQuotes' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return "'$value'";
+                       } ) );
+               $mockDb->expects( $this->exactly( 3 ) )
+                       ->method( 'timestamp' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return 'TS' . $value . 'TS';
+                       } ) );
+               $mockDb->expects( $this->any() )
+                       ->method( 'makeList' )
+                       ->with(
+                               $this->isType( 'array' ),
+                               $this->isType( 'int' )
+                       )
+                       ->will( $this->returnCallback( function ( $a, $conj ) {
+                               $sqlConj = $conj === LIST_AND ? ' AND ' : ' OR ';
+                               return join( $sqlConj, array_map( function ( $s ) {
+                                       return '(' . $s . ')';
+                               }, $a
+                               ) );
+                       } ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'makeWhereFrom2d' )
+                       ->with(
+                               [ [ 'SomeNotExisitingDbKey' => 1, 'OtherNotExisitingDbKey' => 1 ] ],
+                               $this->isType( 'string' ),
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
+
+               $expectedCond =
+                       '((wl_namespace = 0) AND (' .
+                       "(((wl_title = 'SomeDbKey') AND (" .
+                       "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
+                       ')) OR (' .
+                       "(wl_title = 'OtherDbKey') AND (" .
+                       "(wl_notificationtimestamp >= 'TS111TS') OR (wl_notificationtimestamp IS NULL)" .
+                       '))))' .
+                       ') OR ((wl_namespace = 1) AND (' .
+                       "(((wl_title = 'AnotherDbKey') AND (".
+                       "(wl_notificationtimestamp >= 'TS123TS') OR (wl_notificationtimestamp IS NULL)" .
+                       '))))' .
+                       ') OR ' .
+                       '(makeWhereFrom2d return value)';
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'watchers' => 'COUNT(*)' ],
+                               $expectedCond,
+                               $this->isType( 'string' ),
+                               [
+                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
+                               ]
+                       )
+                       ->will(
+                               $this->returnValue( $dbResult )
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $expected = [
+                       0 => [
+                               'SomeDbKey' => 100, 'OtherDbKey' => 300,
+                               'SomeNotExisitingDbKey' => 100, 'OtherNotExisitingDbKey' => 200
+                       ],
+                       1 => [ 'AnotherDbKey' => 500 ],
+               ];
+               $this->assertEquals(
+                       $expected,
+                       $store->countVisitingWatchersMultiple( $titleValuesWithThresholds )
+               );
+       }
+
+       /**
+        * @dataProvider provideIntWithDbUnsafeVersion
+        */
+       public function testCountVisitingWatchersMultiple_withMinimumWatchers( $minWatchers ) {
+               $titleValuesWithThresholds = [
+                       [ new TitleValue( 0, 'SomeDbKey' ), '111' ],
+                       [ new TitleValue( 0, 'OtherDbKey' ), '111' ],
+                       [ new TitleValue( 1, 'AnotherDbKey' ), '123' ],
+               ];
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->any() )
+                       ->method( 'makeList' )
+                       ->will( $this->returnValue( 'makeList return value' ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'watchers' => 'COUNT(*)' ],
+                               'makeList return value',
+                               $this->isType( 'string' ),
+                               [
+                                       'GROUP BY' => [ 'wl_namespace', 'wl_title' ],
+                                       'HAVING' => 'COUNT(*) >= 50',
+                               ]
+                       )
+                       ->will(
+                               $this->returnValue( [] )
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $expected = [
+                       0 => [ 'SomeDbKey' => 0, 'OtherDbKey' => 0 ],
+                       1 => [ 'AnotherDbKey' => 0 ],
+               ];
+               $this->assertEquals(
+                       $expected,
+                       $store->countVisitingWatchersMultiple( $titleValuesWithThresholds, $minWatchers )
+               );
+       }
+
+       public function testCountUnreadNotifications() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'selectRowCount' )
+                       ->with(
+                               'watchlist',
+                               '1',
+                               [
+                                       "wl_notificationtimestamp IS NOT NULL",
+                                       'wl_user' => 1,
+                               ],
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 9 ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals( 9, $store->countUnreadNotifications( $user ) );
+       }
+
+       /**
+        * @dataProvider provideIntWithDbUnsafeVersion
+        */
+       public function testCountUnreadNotifications_withUnreadLimit_overLimit( $limit ) {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'selectRowCount' )
+                       ->with(
+                               'watchlist',
+                               '1',
+                               [
+                                       "wl_notificationtimestamp IS NOT NULL",
+                                       'wl_user' => 1,
+                               ],
+                               $this->isType( 'string' ),
+                               [ 'LIMIT' => 50 ]
+                       )
+                       ->will( $this->returnValue( 50 ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertSame(
+                       true,
+                       $store->countUnreadNotifications( $user, $limit )
+               );
+       }
+
+       /**
+        * @dataProvider provideIntWithDbUnsafeVersion
+        */
+       public function testCountUnreadNotifications_withUnreadLimit_underLimit( $limit ) {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'selectRowCount' )
+                       ->with(
+                               'watchlist',
+                               '1',
+                               [
+                                       "wl_notificationtimestamp IS NOT NULL",
+                                       'wl_user' => 1,
+                               ],
+                               $this->isType( 'string' ),
+                               [ 'LIMIT' => 50 ]
+                       )
+                       ->will( $this->returnValue( 9 ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals(
+                       9,
+                       $store->countUnreadNotifications( $user, $limit )
+               );
+       }
+
+       public function testDuplicateEntry_nothingToDuplicate() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       'wl_user',
+                                       'wl_notificationtimestamp',
+                               ],
+                               [
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'Old_Title',
+                               ],
+                               'WatchedItemStore::duplicateEntry',
+                               [ 'FOR UPDATE' ]
+                       )
+                       ->will( $this->returnValue( new FakeResultWrapper( [] ) ) );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $this->getMockCache(),
+                       $this->getMockReadOnlyMode()
+               );
+
+               $store->duplicateEntry(
+                       Title::newFromText( 'Old_Title' ),
+                       Title::newFromText( 'New_Title' )
+               );
+       }
+
+       public function testDuplicateEntry_somethingToDuplicate() {
+               $fakeRows = [
+                       $this->getFakeRow( [ 'wl_user' => 1, 'wl_notificationtimestamp' => '20151212010101' ] ),
+                       $this->getFakeRow( [ 'wl_user' => 2, 'wl_notificationtimestamp' => null ] ),
+               ];
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->at( 0 ) )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       'wl_user',
+                                       'wl_notificationtimestamp',
+                               ],
+                               [
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'Old_Title',
+                               ]
+                       )
+                       ->will( $this->returnValue( new FakeResultWrapper( $fakeRows ) ) );
+               $mockDb->expects( $this->at( 1 ) )
+                       ->method( 'replace' )
+                       ->with(
+                               'watchlist',
+                               [ [ 'wl_user', 'wl_namespace', 'wl_title' ] ],
+                               [
+                                       [
+                                               'wl_user' => 1,
+                                               'wl_namespace' => 0,
+                                               'wl_title' => 'New_Title',
+                                               'wl_notificationtimestamp' => '20151212010101',
+                                       ],
+                                       [
+                                               'wl_user' => 2,
+                                               'wl_namespace' => 0,
+                                               'wl_title' => 'New_Title',
+                                               'wl_notificationtimestamp' => null,
+                                       ],
+                               ],
+                               $this->isType( 'string' )
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $store->duplicateEntry(
+                       Title::newFromText( 'Old_Title' ),
+                       Title::newFromText( 'New_Title' )
+               );
+       }
+
+       public function testDuplicateAllAssociatedEntries_nothingToDuplicate() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->at( 0 ) )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       'wl_user',
+                                       'wl_notificationtimestamp',
+                               ],
+                               [
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'Old_Title',
+                               ]
+                       )
+                       ->will( $this->returnValue( new FakeResultWrapper( [] ) ) );
+               $mockDb->expects( $this->at( 1 ) )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       'wl_user',
+                                       'wl_notificationtimestamp',
+                               ],
+                               [
+                                       'wl_namespace' => 1,
+                                       'wl_title' => 'Old_Title',
+                               ]
+                       )
+                       ->will( $this->returnValue( new FakeResultWrapper( [] ) ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $store->duplicateAllAssociatedEntries(
+                       Title::newFromText( 'Old_Title' ),
+                       Title::newFromText( 'New_Title' )
+               );
+       }
+
+       public function provideLinkTargetPairs() {
+               return [
+                       [ Title::newFromText( 'Old_Title' ), Title::newFromText( 'New_Title' ) ],
+                       [ new TitleValue( 0, 'Old_Title' ),  new TitleValue( 0, 'New_Title' ) ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideLinkTargetPairs
+        */
+       public function testDuplicateAllAssociatedEntries_somethingToDuplicate(
+               LinkTarget $oldTarget,
+               LinkTarget $newTarget
+       ) {
+               $fakeRows = [
+                       $this->getFakeRow( [ 'wl_user' => 1, 'wl_notificationtimestamp' => '20151212010101' ] ),
+               ];
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->at( 0 ) )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       'wl_user',
+                                       'wl_notificationtimestamp',
+                               ],
+                               [
+                                       'wl_namespace' => $oldTarget->getNamespace(),
+                                       'wl_title' => $oldTarget->getDBkey(),
+                               ]
+                       )
+                       ->will( $this->returnValue( new FakeResultWrapper( $fakeRows ) ) );
+               $mockDb->expects( $this->at( 1 ) )
+                       ->method( 'replace' )
+                       ->with(
+                               'watchlist',
+                               [ [ 'wl_user', 'wl_namespace', 'wl_title' ] ],
+                               [
+                                       [
+                                               'wl_user' => 1,
+                                               'wl_namespace' => $newTarget->getNamespace(),
+                                               'wl_title' => $newTarget->getDBkey(),
+                                               'wl_notificationtimestamp' => '20151212010101',
+                                       ],
+                               ],
+                               $this->isType( 'string' )
+                       );
+               $mockDb->expects( $this->at( 2 ) )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       'wl_user',
+                                       'wl_notificationtimestamp',
+                               ],
+                               [
+                                       'wl_namespace' => $oldTarget->getNamespace() + 1,
+                                       'wl_title' => $oldTarget->getDBkey(),
+                               ]
+                       )
+                       ->will( $this->returnValue( new FakeResultWrapper( $fakeRows ) ) );
+               $mockDb->expects( $this->at( 3 ) )
+                       ->method( 'replace' )
+                       ->with(
+                               'watchlist',
+                               [ [ 'wl_user', 'wl_namespace', 'wl_title' ] ],
+                               [
+                                       [
+                                               'wl_user' => 1,
+                                               'wl_namespace' => $newTarget->getNamespace() + 1,
+                                               'wl_title' => $newTarget->getDBkey(),
+                                               'wl_notificationtimestamp' => '20151212010101',
+                                       ],
+                               ],
+                               $this->isType( 'string' )
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $store->duplicateAllAssociatedEntries(
+                       $oldTarget,
+                       $newTarget
+               );
+       }
+
+       public function testAddWatch_nonAnonymousUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'insert' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       [
+                                               'wl_user' => 1,
+                                               'wl_namespace' => 0,
+                                               'wl_title' => 'Some_Page',
+                                               'wl_notificationtimestamp' => null,
+                                       ]
+                               ]
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->once() )
+                       ->method( 'delete' )
+                       ->with( '0:Some_Page:1' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $store->addWatch(
+                       $this->getMockNonAnonUserWithId( 1 ),
+                       Title::newFromText( 'Some_Page' )
+               );
+       }
+
+       public function testAddWatch_anonymousUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'insert' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $store->addWatch(
+                       $this->getAnonUser(),
+                       Title::newFromText( 'Some_Page' )
+               );
+       }
+
+       public function testAddWatchBatchForUser_readOnlyDBReturnsFalse() {
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $this->getMockDb() ),
+                       $this->getMockCache(),
+                       $this->getMockReadOnlyMode( true )
+               );
+
+               $this->assertFalse(
+                       $store->addWatchBatchForUser(
+                               $this->getMockNonAnonUserWithId( 1 ),
+                               [ new TitleValue( 0, 'Some_Page' ), new TitleValue( 1, 'Some_Page' ) ]
+                       )
+               );
+       }
+
+       public function testAddWatchBatchForUser_nonAnonymousUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'insert' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       [
+                                               'wl_user' => 1,
+                                               'wl_namespace' => 0,
+                                               'wl_title' => 'Some_Page',
+                                               'wl_notificationtimestamp' => null,
+                                       ],
+                                       [
+                                               'wl_user' => 1,
+                                               'wl_namespace' => 1,
+                                               'wl_title' => 'Some_Page',
+                                               'wl_notificationtimestamp' => null,
+                                       ]
+                               ]
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->exactly( 2 ) )
+                       ->method( 'delete' );
+               $mockCache->expects( $this->at( 1 ) )
+                       ->method( 'delete' )
+                       ->with( '0:Some_Page:1' );
+               $mockCache->expects( $this->at( 3 ) )
+                       ->method( 'delete' )
+                       ->with( '1:Some_Page:1' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $mockUser = $this->getMockNonAnonUserWithId( 1 );
+
+               $this->assertTrue(
+                       $store->addWatchBatchForUser(
+                               $mockUser,
+                               [ new TitleValue( 0, 'Some_Page' ), new TitleValue( 1, 'Some_Page' ) ]
+                       )
+               );
+       }
+
+       public function testAddWatchBatchForUser_anonymousUsersAreSkipped() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'insert' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->addWatchBatchForUser(
+                               $this->getAnonUser(),
+                               [ new TitleValue( 0, 'Other_Page' ) ]
+                       )
+               );
+       }
+
+       public function testAddWatchBatchReturnsTrue_whenGivenEmptyList() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'insert' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertTrue(
+                       $store->addWatchBatchForUser( $user, [] )
+               );
+       }
+
+       public function testLoadWatchedItem_existingItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue(
+                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
+                       ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->once() )
+                       ->method( 'set' )
+                       ->with(
+                               '0:SomeDbKey:1'
+                       );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $watchedItem = $store->loadWatchedItem(
+                       $this->getMockNonAnonUserWithId( 1 ),
+                       new TitleValue( 0, 'SomeDbKey' )
+               );
+               $this->assertInstanceOf( 'WatchedItem', $watchedItem );
+               $this->assertEquals( 1, $watchedItem->getUser()->getId() );
+               $this->assertEquals( 'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
+               $this->assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
+       }
+
+       public function testLoadWatchedItem_noItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->loadWatchedItem(
+                               $this->getMockNonAnonUserWithId( 1 ),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testLoadWatchedItem_anonymousUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'selectRow' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->loadWatchedItem(
+                               $this->getAnonUser(),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testRemoveWatch_existingItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'delete' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       );
+               $mockDb->expects( $this->once() )
+                       ->method( 'affectedRows' )
+                       ->will( $this->returnValue( 1 ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->once() )
+                       ->method( 'delete' )
+                       ->with( '0:SomeDbKey:1' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertTrue(
+                       $store->removeWatch(
+                               $this->getMockNonAnonUserWithId( 1 ),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testRemoveWatch_noItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'delete' )
+                       ->with(
+                               'watchlist',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       );
+               $mockDb->expects( $this->once() )
+                       ->method( 'affectedRows' )
+                       ->will( $this->returnValue( 0 ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->once() )
+                       ->method( 'delete' )
+                       ->with( '0:SomeDbKey:1' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->removeWatch(
+                               $this->getMockNonAnonUserWithId( 1 ),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testRemoveWatch_anonymousUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->removeWatch(
+                               $this->getAnonUser(),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testGetWatchedItem_existingItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue(
+                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
+                       ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'delete' );
+               $mockCache->expects( $this->once() )
+                       ->method( 'get' )
+                       ->with(
+                               '0:SomeDbKey:1'
+                       )
+                       ->will( $this->returnValue( null ) );
+               $mockCache->expects( $this->once() )
+                       ->method( 'set' )
+                       ->with(
+                               '0:SomeDbKey:1'
+                       );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $watchedItem = $store->getWatchedItem(
+                       $this->getMockNonAnonUserWithId( 1 ),
+                       new TitleValue( 0, 'SomeDbKey' )
+               );
+               $this->assertInstanceOf( 'WatchedItem', $watchedItem );
+               $this->assertEquals( 1, $watchedItem->getUser()->getId() );
+               $this->assertEquals( 'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
+               $this->assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
+       }
+
+       public function testGetWatchedItem_cachedItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'selectRow' );
+
+               $mockUser = $this->getMockNonAnonUserWithId( 1 );
+               $linkTarget = new TitleValue( 0, 'SomeDbKey' );
+               $cachedItem = new WatchedItem( $mockUser, $linkTarget, '20151212010101' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'delete' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->once() )
+                       ->method( 'get' )
+                       ->with(
+                               '0:SomeDbKey:1'
+                       )
+                       ->will( $this->returnValue( $cachedItem ) );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals(
+                       $cachedItem,
+                       $store->getWatchedItem(
+                               $mockUser,
+                               $linkTarget
+                       )
+               );
+       }
+
+       public function testGetWatchedItem_noItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+               $mockCache->expects( $this->once() )
+                       ->method( 'get' )
+                       ->with( '0:SomeDbKey:1' )
+                       ->will( $this->returnValue( false ) );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->getWatchedItem(
+                               $this->getMockNonAnonUserWithId( 1 ),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testGetWatchedItem_anonymousUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'selectRow' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->getWatchedItem(
+                               $this->getAnonUser(),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testGetWatchedItemsForUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                               [ 'wl_user' => 1 ]
+                       )
+                       ->will( $this->returnValue( [
+                               $this->getFakeRow( [
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'Foo1',
+                                       'wl_notificationtimestamp' => '20151212010101',
+                               ] ),
+                               $this->getFakeRow( [
+                                       'wl_namespace' => 1,
+                                       'wl_title' => 'Foo2',
+                                       'wl_notificationtimestamp' => null,
+                               ] ),
+                       ] ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'delete' );
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+               $user = $this->getMockNonAnonUserWithId( 1 );
+
+               $watchedItems = $store->getWatchedItemsForUser( $user );
+
+               $this->assertInternalType( 'array', $watchedItems );
+               $this->assertCount( 2, $watchedItems );
+               foreach ( $watchedItems as $watchedItem ) {
+                       $this->assertInstanceOf( 'WatchedItem', $watchedItem );
+               }
+               $this->assertEquals(
+                       new WatchedItem( $user, new TitleValue( 0, 'Foo1' ), '20151212010101' ),
+                       $watchedItems[0]
+               );
+               $this->assertEquals(
+                       new WatchedItem( $user, new TitleValue( 1, 'Foo2' ), null ),
+                       $watchedItems[1]
+               );
+       }
+
+       public function provideDbTypes() {
+               return [
+                       [ false, DB_REPLICA ],
+                       [ true, DB_MASTER ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideDbTypes
+        */
+       public function testGetWatchedItemsForUser_optionsAndEmptyResult( $forWrite, $dbType ) {
+               $mockDb = $this->getMockDb();
+               $mockCache = $this->getMockCache();
+               $mockLoadBalancer = $this->getMockLoadBalancer( $mockDb, $dbType );
+               $user = $this->getMockNonAnonUserWithId( 1 );
+
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                               [ 'wl_user' => 1 ],
+                               $this->isType( 'string' ),
+                               [ 'ORDER BY' => [ 'wl_namespace ASC', 'wl_title ASC' ] ]
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $store = $this->newWatchedItemStore(
+                       $mockLoadBalancer,
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $watchedItems = $store->getWatchedItemsForUser(
+                       $user,
+                       [ 'forWrite' => $forWrite, 'sort' => WatchedItemStore::SORT_ASC ]
+               );
+               $this->assertEquals( [], $watchedItems );
+       }
+
+       public function testGetWatchedItemsForUser_badSortOptionThrowsException() {
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $this->getMockDb() ),
+                       $this->getMockCache(),
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->setExpectedException( 'InvalidArgumentException' );
+               $store->getWatchedItemsForUser(
+                       $this->getMockNonAnonUserWithId( 1 ),
+                       [ 'sort' => 'foo' ]
+               );
+       }
+
+       public function testIsWatchedItem_existingItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue(
+                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
+                       ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'delete' );
+               $mockCache->expects( $this->once() )
+                       ->method( 'get' )
+                       ->with( '0:SomeDbKey:1' )
+                       ->will( $this->returnValue( false ) );
+               $mockCache->expects( $this->once() )
+                       ->method( 'set' )
+                       ->with(
+                               '0:SomeDbKey:1'
+                       );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertTrue(
+                       $store->isWatched(
+                               $this->getMockNonAnonUserWithId( 1 ),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testIsWatchedItem_noItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+               $mockCache->expects( $this->once() )
+                       ->method( 'get' )
+                       ->with( '0:SomeDbKey:1' )
+                       ->will( $this->returnValue( false ) );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->isWatched(
+                               $this->getMockNonAnonUserWithId( 1 ),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testIsWatchedItem_anonymousUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'selectRow' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->isWatched(
+                               $this->getAnonUser(),
+                               new TitleValue( 0, 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testGetNotificationTimestampsBatch() {
+               $targets = [
+                       new TitleValue( 0, 'SomeDbKey' ),
+                       new TitleValue( 1, 'AnotherDbKey' ),
+               ];
+
+               $mockDb = $this->getMockDb();
+               $dbResult = [
+                       $this->getFakeRow( [
+                               'wl_namespace' => 0,
+                               'wl_title' => 'SomeDbKey',
+                               'wl_notificationtimestamp' => '20151212010101',
+                       ] ),
+                       $this->getFakeRow(
+                               [
+                                       'wl_namespace' => 1,
+                                       'wl_title' => 'AnotherDbKey',
+                                       'wl_notificationtimestamp' => null,
+                               ]
+                       ),
+               ];
+
+               $mockDb->expects( $this->once() )
+                       ->method( 'makeWhereFrom2d' )
+                       ->with(
+                               [ [ 'SomeDbKey' => 1 ], [ 'AnotherDbKey' => 1 ] ],
+                               $this->isType( 'string' ),
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                               [
+                                       'makeWhereFrom2d return value',
+                                       'wl_user' => 1
+                               ],
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( $dbResult ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->exactly( 2 ) )
+                       ->method( 'get' )
+                       ->withConsecutive(
+                               [ '0:SomeDbKey:1' ],
+                               [ '1:AnotherDbKey:1' ]
+                       )
+                       ->will( $this->returnValue( null ) );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals(
+                       [
+                               0 => [ 'SomeDbKey' => '20151212010101', ],
+                               1 => [ 'AnotherDbKey' => null, ],
+                       ],
+                       $store->getNotificationTimestampsBatch( $this->getMockNonAnonUserWithId( 1 ), $targets )
+               );
+       }
+
+       public function testGetNotificationTimestampsBatch_notWatchedTarget() {
+               $targets = [
+                       new TitleValue( 0, 'OtherDbKey' ),
+               ];
+
+               $mockDb = $this->getMockDb();
+
+               $mockDb->expects( $this->once() )
+                       ->method( 'makeWhereFrom2d' )
+                       ->with(
+                               [ [ 'OtherDbKey' => 1 ] ],
+                               $this->isType( 'string' ),
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                               [
+                                       'makeWhereFrom2d return value',
+                                       'wl_user' => 1
+                               ],
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( $this->getFakeRow( [] ) ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->once() )
+                       ->method( 'get' )
+                       ->with( '0:OtherDbKey:1' )
+                       ->will( $this->returnValue( null ) );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals(
+                       [
+                               0 => [ 'OtherDbKey' => false, ],
+                       ],
+                       $store->getNotificationTimestampsBatch( $this->getMockNonAnonUserWithId( 1 ), $targets )
+               );
+       }
+
+       public function testGetNotificationTimestampsBatch_cachedItem() {
+               $targets = [
+                       new TitleValue( 0, 'SomeDbKey' ),
+                       new TitleValue( 1, 'AnotherDbKey' ),
+               ];
+
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $cachedItem = new WatchedItem( $user, $targets[0], '20151212010101' );
+
+               $mockDb = $this->getMockDb();
+
+               $mockDb->expects( $this->once() )
+                       ->method( 'makeWhereFrom2d' )
+                       ->with(
+                               [ 1 => [ 'AnotherDbKey' => 1 ] ],
+                               $this->isType( 'string' ),
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'select' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
+                               [
+                                       'makeWhereFrom2d return value',
+                                       'wl_user' => 1
+                               ],
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( [
+                               $this->getFakeRow(
+                                       [ 'wl_namespace' => 1, 'wl_title' => 'AnotherDbKey', 'wl_notificationtimestamp' => null, ]
+                               )
+                       ] ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->at( 1 ) )
+                       ->method( 'get' )
+                       ->with( '0:SomeDbKey:1' )
+                       ->will( $this->returnValue( $cachedItem ) );
+               $mockCache->expects( $this->at( 3 ) )
+                       ->method( 'get' )
+                       ->with( '1:AnotherDbKey:1' )
+                       ->will( $this->returnValue( null ) );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals(
+                       [
+                               0 => [ 'SomeDbKey' => '20151212010101', ],
+                               1 => [ 'AnotherDbKey' => null, ],
+                       ],
+                       $store->getNotificationTimestampsBatch( $user, $targets )
+               );
+       }
+
+       public function testGetNotificationTimestampsBatch_allItemsCached() {
+               $targets = [
+                       new TitleValue( 0, 'SomeDbKey' ),
+                       new TitleValue( 1, 'AnotherDbKey' ),
+               ];
+
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $cachedItems = [
+                       new WatchedItem( $user, $targets[0], '20151212010101' ),
+                       new WatchedItem( $user, $targets[1], null ),
+               ];
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )->method( $this->anything() );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->at( 1 ) )
+                       ->method( 'get' )
+                       ->with( '0:SomeDbKey:1' )
+                       ->will( $this->returnValue( $cachedItems[0] ) );
+               $mockCache->expects( $this->at( 3 ) )
+                       ->method( 'get' )
+                       ->with( '1:AnotherDbKey:1' )
+                       ->will( $this->returnValue( $cachedItems[1] ) );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals(
+                       [
+                               0 => [ 'SomeDbKey' => '20151212010101', ],
+                               1 => [ 'AnotherDbKey' => null, ],
+                       ],
+                       $store->getNotificationTimestampsBatch( $user, $targets )
+               );
+       }
+
+       public function testGetNotificationTimestampsBatch_anonymousUser() {
+               $targets = [
+                       new TitleValue( 0, 'SomeDbKey' ),
+                       new TitleValue( 1, 'AnotherDbKey' ),
+               ];
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )->method( $this->anything() );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( $this->anything() );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals(
+                       [
+                               0 => [ 'SomeDbKey' => false, ],
+                               1 => [ 'AnotherDbKey' => false, ],
+                       ],
+                       $store->getNotificationTimestampsBatch( $this->getAnonUser(), $targets )
+               );
+       }
+
+       public function testResetNotificationTimestamp_anonymousUser() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'selectRow' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->resetNotificationTimestamp(
+                               $this->getAnonUser(),
+                               Title::newFromText( 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testResetNotificationTimestamp_noItem() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue( [] ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertFalse(
+                       $store->resetNotificationTimestamp(
+                               $this->getMockNonAnonUserWithId( 1 ),
+                               Title::newFromText( 'SomeDbKey' )
+                       )
+               );
+       }
+
+       public function testResetNotificationTimestamp_item() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $title = Title::newFromText( 'SomeDbKey' );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue(
+                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
+                       ) );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->once() )
+                       ->method( 'set' )
+                       ->with(
+                               '0:SomeDbKey:1',
+                               $this->isInstanceOf( WatchedItem::class )
+                       );
+               $mockCache->expects( $this->once() )
+                       ->method( 'delete' )
+                       ->with( '0:SomeDbKey:1' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               // Note: This does not actually assert the job is correct
+               $callableCallCounter = 0;
+               $mockCallback = function ( $callable ) use ( &$callableCallCounter ) {
+                       $callableCallCounter++;
+                       $this->assertInternalType( 'callable', $callable );
+               };
+               $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback( $mockCallback );
+
+               $this->assertTrue(
+                       $store->resetNotificationTimestamp(
+                               $user,
+                               $title
+                       )
+               );
+               $this->assertEquals( 1, $callableCallCounter );
+
+               ScopedCallback::consume( $scopedOverride );
+       }
+
+       public function testResetNotificationTimestamp_noItemForced() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $title = Title::newFromText( 'SomeDbKey' );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'selectRow' );
+
+               $mockCache = $this->getMockCache();
+               $mockDb->expects( $this->never() )
+                       ->method( 'get' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'set' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               // Note: This does not actually assert the job is correct
+               $callableCallCounter = 0;
+               $mockCallback = function ( $callable ) use ( &$callableCallCounter ) {
+                       $callableCallCounter++;
+                       $this->assertInternalType( 'callable', $callable );
+               };
+               $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback( $mockCallback );
+
+               $this->assertTrue(
+                       $store->resetNotificationTimestamp(
+                               $user,
+                               $title,
+                               'force'
+                       )
+               );
+               $this->assertEquals( 1, $callableCallCounter );
+
+               ScopedCallback::consume( $scopedOverride );
+       }
+
+       /**
+        * @param string $text
+        * @param int $ns
+        *
+        * @return PHPUnit_Framework_MockObject_MockObject|Title
+        */
+       private function getMockTitle( $text, $ns = 0 ) {
+               $title = $this->createMock( Title::class );
+               $title->expects( $this->any() )
+                       ->method( 'getText' )
+                       ->will( $this->returnValue( str_replace( '_', ' ', $text ) ) );
+               $title->expects( $this->any() )
+                       ->method( 'getDbKey' )
+                       ->will( $this->returnValue( str_replace( '_', ' ', $text ) ) );
+               $title->expects( $this->any() )
+                       ->method( 'getNamespace' )
+                       ->will( $this->returnValue( $ns ) );
+               return $title;
+       }
+
+       private function verifyCallbackJob(
+               $callback,
+               LinkTarget $expectedTitle,
+               $expectedUserId,
+               callable $notificationTimestampCondition
+       ) {
+               $this->assertInternalType( 'callable', $callback );
+
+               $callbackReflector = new ReflectionFunction( $callback );
+               $vars = $callbackReflector->getStaticVariables();
+               $this->assertArrayHasKey( 'job', $vars );
+               $this->assertInstanceOf( ActivityUpdateJob::class, $vars['job'] );
+
+               /** @var ActivityUpdateJob $job */
+               $job = $vars['job'];
+               $this->assertEquals( $expectedTitle->getDBkey(), $job->getTitle()->getDBkey() );
+               $this->assertEquals( $expectedTitle->getNamespace(), $job->getTitle()->getNamespace() );
+
+               $jobParams = $job->getParams();
+               $this->assertArrayHasKey( 'type', $jobParams );
+               $this->assertEquals( 'updateWatchlistNotification', $jobParams['type'] );
+               $this->assertArrayHasKey( 'userid', $jobParams );
+               $this->assertEquals( $expectedUserId, $jobParams['userid'] );
+               $this->assertArrayHasKey( 'notifTime', $jobParams );
+               $this->assertTrue( $notificationTimestampCondition( $jobParams['notifTime'] ) );
+       }
+
+       public function testResetNotificationTimestamp_oldidSpecifiedLatestRevisionForced() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $oldid = 22;
+               $title = $this->getMockTitle( 'SomeTitle' );
+               $title->expects( $this->once() )
+                       ->method( 'getNextRevisionID' )
+                       ->with( $oldid )
+                       ->will( $this->returnValue( false ) );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->never() )
+                       ->method( 'selectRow' );
+
+               $mockCache = $this->getMockCache();
+               $mockDb->expects( $this->never() )
+                       ->method( 'get' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'set' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $callableCallCounter = 0;
+               $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
+                       function ( $callable ) use ( &$callableCallCounter, $title, $user ) {
+                               $callableCallCounter++;
+                               $this->verifyCallbackJob(
+                                       $callable,
+                                       $title,
+                                       $user->getId(),
+                                       function ( $time ) {
+                                               return $time === null;
+                                       }
+                               );
+                       }
+               );
+
+               $this->assertTrue(
+                       $store->resetNotificationTimestamp(
+                               $user,
+                               $title,
+                               'force',
+                               $oldid
+                       )
+               );
+               $this->assertEquals( 1, $callableCallCounter );
+
+               ScopedCallback::consume( $scopedOverride );
+       }
+
+       public function testResetNotificationTimestamp_oldidSpecifiedNotLatestRevisionForced() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $oldid = 22;
+               $title = $this->getMockTitle( 'SomeDbKey' );
+               $title->expects( $this->once() )
+                       ->method( 'getNextRevisionID' )
+                       ->with( $oldid )
+                       ->will( $this->returnValue( 33 ) );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue(
+                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
+                       ) );
+
+               $mockCache = $this->getMockCache();
+               $mockDb->expects( $this->never() )
+                       ->method( 'get' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'set' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $addUpdateCallCounter = 0;
+               $scopedOverrideDeferred = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
+                       function ( $callable ) use ( &$addUpdateCallCounter, $title, $user ) {
+                               $addUpdateCallCounter++;
+                               $this->verifyCallbackJob(
+                                       $callable,
+                                       $title,
+                                       $user->getId(),
+                                       function ( $time ) {
+                                               return $time !== null && $time > '20151212010101';
+                                       }
+                               );
+                       }
+               );
+
+               $getTimestampCallCounter = 0;
+               $scopedOverrideRevision = $store->overrideRevisionGetTimestampFromIdCallback(
+                       function ( $titleParam, $oldidParam ) use ( &$getTimestampCallCounter, $title, $oldid ) {
+                               $getTimestampCallCounter++;
+                               $this->assertEquals( $title, $titleParam );
+                               $this->assertEquals( $oldid, $oldidParam );
+                       }
+               );
+
+               $this->assertTrue(
+                       $store->resetNotificationTimestamp(
+                               $user,
+                               $title,
+                               'force',
+                               $oldid
+                       )
+               );
+               $this->assertEquals( 1, $addUpdateCallCounter );
+               $this->assertEquals( 1, $getTimestampCallCounter );
+
+               ScopedCallback::consume( $scopedOverrideDeferred );
+               ScopedCallback::consume( $scopedOverrideRevision );
+       }
+
+       public function testResetNotificationTimestamp_notWatchedPageForced() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $oldid = 22;
+               $title = $this->getMockTitle( 'SomeDbKey' );
+               $title->expects( $this->once() )
+                       ->method( 'getNextRevisionID' )
+                       ->with( $oldid )
+                       ->will( $this->returnValue( 33 ) );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue( false ) );
+
+               $mockCache = $this->getMockCache();
+               $mockDb->expects( $this->never() )
+                       ->method( 'get' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'set' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $callableCallCounter = 0;
+               $scopedOverride = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
+                       function ( $callable ) use ( &$callableCallCounter, $title, $user ) {
+                               $callableCallCounter++;
+                               $this->verifyCallbackJob(
+                                       $callable,
+                                       $title,
+                                       $user->getId(),
+                                       function ( $time ) {
+                                               return $time === null;
+                                       }
+                               );
+                       }
+               );
+
+               $this->assertTrue(
+                       $store->resetNotificationTimestamp(
+                               $user,
+                               $title,
+                               'force',
+                               $oldid
+                       )
+               );
+               $this->assertEquals( 1, $callableCallCounter );
+
+               ScopedCallback::consume( $scopedOverride );
+       }
+
+       public function testResetNotificationTimestamp_futureNotificationTimestampForced() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $oldid = 22;
+               $title = $this->getMockTitle( 'SomeDbKey' );
+               $title->expects( $this->once() )
+                       ->method( 'getNextRevisionID' )
+                       ->with( $oldid )
+                       ->will( $this->returnValue( 33 ) );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue(
+                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '30151212010101' ] )
+                       ) );
+
+               $mockCache = $this->getMockCache();
+               $mockDb->expects( $this->never() )
+                       ->method( 'get' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'set' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $addUpdateCallCounter = 0;
+               $scopedOverrideDeferred = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
+                       function ( $callable ) use ( &$addUpdateCallCounter, $title, $user ) {
+                               $addUpdateCallCounter++;
+                               $this->verifyCallbackJob(
+                                       $callable,
+                                       $title,
+                                       $user->getId(),
+                                       function ( $time ) {
+                                               return $time === '30151212010101';
+                                       }
+                               );
+                       }
+               );
+
+               $getTimestampCallCounter = 0;
+               $scopedOverrideRevision = $store->overrideRevisionGetTimestampFromIdCallback(
+                       function ( $titleParam, $oldidParam ) use ( &$getTimestampCallCounter, $title, $oldid ) {
+                               $getTimestampCallCounter++;
+                               $this->assertEquals( $title, $titleParam );
+                               $this->assertEquals( $oldid, $oldidParam );
+                       }
+               );
+
+               $this->assertTrue(
+                       $store->resetNotificationTimestamp(
+                               $user,
+                               $title,
+                               'force',
+                               $oldid
+                       )
+               );
+               $this->assertEquals( 1, $addUpdateCallCounter );
+               $this->assertEquals( 1, $getTimestampCallCounter );
+
+               ScopedCallback::consume( $scopedOverrideDeferred );
+               ScopedCallback::consume( $scopedOverrideRevision );
+       }
+
+       public function testResetNotificationTimestamp_futureNotificationTimestampNotForced() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $oldid = 22;
+               $title = $this->getMockTitle( 'SomeDbKey' );
+               $title->expects( $this->once() )
+                       ->method( 'getNextRevisionID' )
+                       ->with( $oldid )
+                       ->will( $this->returnValue( 33 ) );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->with(
+                               'watchlist',
+                               'wl_notificationtimestamp',
+                               [
+                                       'wl_user' => 1,
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       )
+                       ->will( $this->returnValue(
+                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '30151212010101' ] )
+                       ) );
+
+               $mockCache = $this->getMockCache();
+               $mockDb->expects( $this->never() )
+                       ->method( 'get' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'set' );
+               $mockDb->expects( $this->never() )
+                       ->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $addUpdateCallCounter = 0;
+               $scopedOverrideDeferred = $store->overrideDeferredUpdatesAddCallableUpdateCallback(
+                       function ( $callable ) use ( &$addUpdateCallCounter, $title, $user ) {
+                               $addUpdateCallCounter++;
+                               $this->verifyCallbackJob(
+                                       $callable,
+                                       $title,
+                                       $user->getId(),
+                                       function ( $time ) {
+                                               return $time === false;
+                                       }
+                               );
+                       }
+               );
+
+               $getTimestampCallCounter = 0;
+               $scopedOverrideRevision = $store->overrideRevisionGetTimestampFromIdCallback(
+                       function ( $titleParam, $oldidParam ) use ( &$getTimestampCallCounter, $title, $oldid ) {
+                               $getTimestampCallCounter++;
+                               $this->assertEquals( $title, $titleParam );
+                               $this->assertEquals( $oldid, $oldidParam );
+                       }
+               );
+
+               $this->assertTrue(
+                       $store->resetNotificationTimestamp(
+                               $user,
+                               $title,
+                               '',
+                               $oldid
+                       )
+               );
+               $this->assertEquals( 1, $addUpdateCallCounter );
+               $this->assertEquals( 1, $getTimestampCallCounter );
+
+               ScopedCallback::consume( $scopedOverrideDeferred );
+               ScopedCallback::consume( $scopedOverrideRevision );
+       }
+
+       public function testSetNotificationTimestampsForUser_anonUser() {
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $this->getMockDb() ),
+                       $this->getMockCache(),
+                       $this->getMockReadOnlyMode()
+               );
+               $this->assertFalse( $store->setNotificationTimestampsForUser( $this->getAnonUser(), '' ) );
+       }
+
+       public function testSetNotificationTimestampsForUser_allRows() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $timestamp = '20100101010101';
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'update' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_notificationtimestamp' => 'TS' . $timestamp . 'TS' ],
+                               [ 'wl_user' => 1 ]
+                       )
+                       ->will( $this->returnValue( true ) );
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'timestamp' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return 'TS' . $value . 'TS';
+                       } ) );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $this->getMockCache(),
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertTrue(
+                       $store->setNotificationTimestampsForUser( $user, $timestamp )
+               );
+       }
+
+       public function testSetNotificationTimestampsForUser_nullTimestamp() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $timestamp = null;
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'update' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_notificationtimestamp' => null ],
+                               [ 'wl_user' => 1 ]
+                       )
+                       ->will( $this->returnValue( true ) );
+               $mockDb->expects( $this->exactly( 0 ) )
+                       ->method( 'timestamp' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return 'TS' . $value . 'TS';
+                       } ) );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $this->getMockCache(),
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertTrue(
+                       $store->setNotificationTimestampsForUser( $user, $timestamp )
+               );
+       }
+
+       public function testSetNotificationTimestampsForUser_specificTargets() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $timestamp = '20100101010101';
+               $targets = [ new TitleValue( 0, 'Foo' ), new TitleValue( 0, 'Bar' ) ];
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'update' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_notificationtimestamp' => 'TS' . $timestamp . 'TS' ],
+                               [ 'wl_user' => 1, 0 => 'makeWhereFrom2d return value' ]
+                       )
+                       ->will( $this->returnValue( true ) );
+               $mockDb->expects( $this->exactly( 1 ) )
+                       ->method( 'timestamp' )
+                       ->will( $this->returnCallback( function ( $value ) {
+                               return 'TS' . $value . 'TS';
+                       } ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'makeWhereFrom2d' )
+                       ->with(
+                               [ [ 'Foo' => 1, 'Bar' => 1 ] ],
+                               $this->isType( 'string' ),
+                               $this->isType( 'string' )
+                       )
+                       ->will( $this->returnValue( 'makeWhereFrom2d return value' ) );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $this->getMockCache(),
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertTrue(
+                       $store->setNotificationTimestampsForUser( $user, $timestamp, $targets )
+               );
+       }
+
+       public function testUpdateNotificationTimestamp_watchersExist() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectFieldValues' )
+                       ->with(
+                               'watchlist',
+                               'wl_user',
+                               [
+                                       'wl_user != 1',
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                                       'wl_notificationtimestamp IS NULL'
+                               ]
+                       )
+                       ->will( $this->returnValue( [ '2', '3' ] ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'update' )
+                       ->with(
+                               'watchlist',
+                               [ 'wl_notificationtimestamp' => null ],
+                               [
+                                       'wl_user' => [ 2, 3 ],
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                               ]
+                       );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $this->assertEquals(
+                       [ 2, 3 ],
+                       $store->updateNotificationTimestamp(
+                               $this->getMockNonAnonUserWithId( 1 ),
+                               new TitleValue( 0, 'SomeDbKey' ),
+                               '20151212010101'
+                       )
+               );
+       }
+
+       public function testUpdateNotificationTimestamp_noWatchers() {
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectFieldValues' )
+                       ->with(
+                               'watchlist',
+                               'wl_user',
+                               [
+                                       'wl_user != 1',
+                                       'wl_namespace' => 0,
+                                       'wl_title' => 'SomeDbKey',
+                                       'wl_notificationtimestamp IS NULL'
+                               ]
+                       )
+                       ->will(
+                               $this->returnValue( [] )
+                       );
+               $mockDb->expects( $this->never() )
+                       ->method( 'update' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->never() )->method( 'set' );
+               $mockCache->expects( $this->never() )->method( 'get' );
+               $mockCache->expects( $this->never() )->method( 'delete' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               $watchers = $store->updateNotificationTimestamp(
+                       $this->getMockNonAnonUserWithId( 1 ),
+                       new TitleValue( 0, 'SomeDbKey' ),
+                       '20151212010101'
+               );
+               $this->assertInternalType( 'array', $watchers );
+               $this->assertEmpty( $watchers );
+       }
+
+       public function testUpdateNotificationTimestamp_clearsCachedItems() {
+               $user = $this->getMockNonAnonUserWithId( 1 );
+               $titleValue = new TitleValue( 0, 'SomeDbKey' );
+
+               $mockDb = $this->getMockDb();
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectRow' )
+                       ->will( $this->returnValue(
+                               $this->getFakeRow( [ 'wl_notificationtimestamp' => '20151212010101' ] )
+                       ) );
+               $mockDb->expects( $this->once() )
+                       ->method( 'selectFieldValues' )
+                       ->will(
+                               $this->returnValue( [ '2', '3' ] )
+                       );
+               $mockDb->expects( $this->once() )
+                       ->method( 'update' );
+
+               $mockCache = $this->getMockCache();
+               $mockCache->expects( $this->once() )
+                       ->method( 'set' )
+                       ->with( '0:SomeDbKey:1', $this->isType( 'object' ) );
+               $mockCache->expects( $this->once() )
+                       ->method( 'get' )
+                       ->with( '0:SomeDbKey:1' );
+               $mockCache->expects( $this->once() )
+                       ->method( 'delete' )
+                       ->with( '0:SomeDbKey:1' );
+
+               $store = $this->newWatchedItemStore(
+                       $this->getMockLoadBalancer( $mockDb ),
+                       $mockCache,
+                       $this->getMockReadOnlyMode()
+               );
+
+               // This will add the item to the cache
+               $store->getWatchedItem( $user, $titleValue );
+
+               $store->updateNotificationTimestamp(
+                       $this->getMockNonAnonUserWithId( 1 ),
+                       $titleValue,
+                       '20151212010101'
+               );
+       }
+
+}
diff --git a/tests/phpunit/includes/watcheditem/WatchedItemUnitTest.php b/tests/phpunit/includes/watcheditem/WatchedItemUnitTest.php
new file mode 100644 (file)
index 0000000..8897645
--- /dev/null
@@ -0,0 +1,150 @@
+<?php
+use MediaWiki\Linker\LinkTarget;
+
+/**
+ * @author Addshore
+ *
+ * @covers WatchedItem
+ */
+class WatchedItemUnitTest extends MediaWikiTestCase {
+
+       /**
+        * @param int $id
+        *
+        * @return PHPUnit_Framework_MockObject_MockObject|User
+        */
+       private function getMockUser( $id ) {
+               $user = $this->createMock( User::class );
+               $user->expects( $this->any() )
+                       ->method( 'getId' )
+                       ->will( $this->returnValue( $id ) );
+               $user->expects( $this->any() )
+                       ->method( 'isAllowed' )
+                       ->will( $this->returnValue( true ) );
+               return $user;
+       }
+
+       public function provideUserTitleTimestamp() {
+               $user = $this->getMockUser( 111 );
+               return [
+                       [ $user, Title::newFromText( 'SomeTitle' ), null ],
+                       [ $user, Title::newFromText( 'SomeTitle' ), '20150101010101' ],
+                       [ $user, new TitleValue( 0, 'TVTitle', 'frag' ), '20150101010101' ],
+               ];
+       }
+
+       /**
+        * @return PHPUnit_Framework_MockObject_MockObject|WatchedItemStore
+        */
+       private function getMockWatchedItemStore() {
+               return $this->getMockBuilder( WatchedItemStore::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+       }
+
+       /**
+        * @dataProvider provideUserTitleTimestamp
+        */
+       public function testConstruction( $user, LinkTarget $linkTarget, $notifTimestamp ) {
+               $item = new WatchedItem( $user, $linkTarget, $notifTimestamp );
+
+               $this->assertSame( $user, $item->getUser() );
+               $this->assertSame( $linkTarget, $item->getLinkTarget() );
+               $this->assertSame( $notifTimestamp, $item->getNotificationTimestamp() );
+
+               // The below tests the internal WatchedItem::getTitle method
+               $this->assertInstanceOf( 'Title', $item->getTitle() );
+               $this->assertSame( $linkTarget->getDBkey(), $item->getTitle()->getDBkey() );
+               $this->assertSame( $linkTarget->getFragment(), $item->getTitle()->getFragment() );
+               $this->assertSame( $linkTarget->getNamespace(), $item->getTitle()->getNamespace() );
+               $this->assertSame( $linkTarget->getText(), $item->getTitle()->getText() );
+       }
+
+       /**
+        * @dataProvider provideUserTitleTimestamp
+        */
+       public function testFromUserTitle( $user, $linkTarget, $timestamp ) {
+               $store = $this->getMockWatchedItemStore();
+               $store->expects( $this->once() )
+                       ->method( 'loadWatchedItem' )
+                       ->with( $user, $linkTarget )
+                       ->will( $this->returnValue( new WatchedItem( $user, $linkTarget, $timestamp ) ) );
+               $this->setService( 'WatchedItemStore', $store );
+
+               $item = WatchedItem::fromUserTitle( $user, $linkTarget, User::IGNORE_USER_RIGHTS );
+
+               $this->assertEquals( $user, $item->getUser() );
+               $this->assertEquals( $linkTarget, $item->getLinkTarget() );
+               $this->assertEquals( $timestamp, $item->getNotificationTimestamp() );
+       }
+
+       public function testAddWatch() {
+               $title = Title::newFromText( 'SomeTitle' );
+               $timestamp = null;
+               $checkRights = 0;
+
+               /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
+               $user = $this->createMock( User::class );
+               $user->expects( $this->once() )
+                       ->method( 'addWatch' )
+                       ->with( $title, $checkRights );
+
+               $item = new WatchedItem( $user, $title, $timestamp, $checkRights );
+               $this->assertTrue( $item->addWatch() );
+       }
+
+       public function testRemoveWatch() {
+               $title = Title::newFromText( 'SomeTitle' );
+               $timestamp = null;
+               $checkRights = 0;
+
+               /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
+               $user = $this->createMock( User::class );
+               $user->expects( $this->once() )
+                       ->method( 'removeWatch' )
+                       ->with( $title, $checkRights );
+
+               $item = new WatchedItem( $user, $title, $timestamp, $checkRights );
+               $this->assertTrue( $item->removeWatch() );
+       }
+
+       public function provideBooleans() {
+               return [
+                       [ true ],
+                       [ false ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideBooleans
+        */
+       public function testIsWatched( $returnValue ) {
+               $title = Title::newFromText( 'SomeTitle' );
+               $timestamp = null;
+               $checkRights = 0;
+
+               /** @var User|PHPUnit_Framework_MockObject_MockObject $user */
+               $user = $this->createMock( User::class );
+               $user->expects( $this->once() )
+                       ->method( 'isWatched' )
+                       ->with( $title, $checkRights )
+                       ->will( $this->returnValue( $returnValue ) );
+
+               $item = new WatchedItem( $user, $title, $timestamp, $checkRights );
+               $this->assertEquals( $returnValue, $item->isWatched() );
+       }
+
+       public function testDuplicateEntries() {
+               $oldTitle = Title::newFromText( 'OldTitle' );
+               $newTitle = Title::newFromText( 'NewTitle' );
+
+               $store = $this->getMockWatchedItemStore();
+               $store->expects( $this->once() )
+                       ->method( 'duplicateAllAssociatedEntries' )
+                       ->with( $oldTitle, $newTitle );
+               $this->setService( 'WatchedItemStore', $store );
+
+               WatchedItem::duplicateEntries( $oldTitle, $newTitle );
+       }
+
+}