Merge "Fix how "Live updates" behave when user logs out"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 18 Dec 2017 16:06:14 +0000 (16:06 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 18 Dec 2017 16:06:14 +0000 (16:06 +0000)
123 files changed:
RELEASE-NOTES-1.31
autoload.php
docs/hooks.txt
includes/AutoLoader.php
includes/Feed.php
includes/MediaWikiServices.php
includes/MergeHistory.php
includes/Revision.php
includes/ServiceWiring.php
includes/Storage/BlobAccessException.php [new file with mode: 0644]
includes/Storage/BlobStore.php [new file with mode: 0644]
includes/Storage/IncompleteRevisionException.php [new file with mode: 0644]
includes/Storage/MutableRevisionRecord.php [new file with mode: 0644]
includes/Storage/MutableRevisionSlots.php [new file with mode: 0644]
includes/Storage/RevisionAccessException.php [new file with mode: 0644]
includes/Storage/RevisionArchiveRecord.php [new file with mode: 0644]
includes/Storage/RevisionFactory.php [new file with mode: 0644]
includes/Storage/RevisionLookup.php [new file with mode: 0644]
includes/Storage/RevisionRecord.php [new file with mode: 0644]
includes/Storage/RevisionSlots.php [new file with mode: 0644]
includes/Storage/RevisionStore.php [new file with mode: 0644]
includes/Storage/RevisionStoreRecord.php [new file with mode: 0644]
includes/Storage/SlotRecord.php [new file with mode: 0644]
includes/Storage/SqlBlobStore.php [new file with mode: 0644]
includes/Storage/SuppressedDataException.php [new file with mode: 0644]
includes/actions/HistoryAction.php
includes/api/ApiMain.php
includes/api/i18n/de.json
includes/api/i18n/es.json
includes/api/i18n/fr.json
includes/api/i18n/gl.json
includes/api/i18n/lt.json
includes/api/i18n/nb.json
includes/api/i18n/pt.json
includes/api/i18n/zh-hans.json
includes/cache/MessageCache.php
includes/changes/ChangesListFilter.php
includes/content/ContentHandler.php
includes/editpage/TextConflictHelper.php
includes/htmlform/fields/HTMLCheckMatrix.php
includes/installer/PostgresUpdater.php
includes/installer/i18n/es.json
includes/installer/i18n/gl.json
includes/jobqueue/jobs/EnqueueJob.php
includes/libs/xmp/XMP.php
includes/media/BitmapMetadataHandler.php
includes/page/WikiPage.php
includes/parser/Parser.php
includes/parser/ParserOutput.php
includes/registration/ExtensionProcessor.php
includes/registration/ExtensionRegistry.php
includes/resourceloader/ResourceLoaderWikiModule.php
includes/specials/SpecialNewpages.php
includes/templates/AtomHeader.mustache [new file with mode: 0644]
includes/templates/AtomItem.mustache [new file with mode: 0644]
includes/templates/RSSHeader.mustache [new file with mode: 0644]
includes/templates/RSSItem.mustache [new file with mode: 0644]
includes/user/UserIdentityValue.php [new file with mode: 0644]
includes/utils/AutoloadGenerator.php
includes/watcheditem/WatchedItem.php
languages/i18n/af.json
languages/i18n/ar.json
languages/i18n/be-tarask.json
languages/i18n/bg.json
languages/i18n/bn.json
languages/i18n/ca.json
languages/i18n/ce.json
languages/i18n/cs.json
languages/i18n/csb.json
languages/i18n/da.json
languages/i18n/dty.json
languages/i18n/en.json
languages/i18n/eo.json
languages/i18n/es.json
languages/i18n/fa.json
languages/i18n/fr.json
languages/i18n/gl.json
languages/i18n/hi.json
languages/i18n/hr.json
languages/i18n/jv.json
languages/i18n/ka.json
languages/i18n/ko.json
languages/i18n/lb.json
languages/i18n/lt.json
languages/i18n/lv.json
languages/i18n/mk.json
languages/i18n/mr.json
languages/i18n/mt.json
languages/i18n/nb.json
languages/i18n/nl.json
languages/i18n/nn.json
languages/i18n/ps.json
languages/i18n/pt.json
languages/i18n/qqq.json
languages/i18n/ru.json
languages/i18n/sl.json
languages/i18n/sv.json
languages/i18n/th.json
languages/i18n/tr.json
languages/i18n/zh-hans.json
languages/messages/MessagesKo.php
maintenance/storage/checkStorage.php
resources/lib/oojs-ui/oojs-ui-core.js
resources/src/mediawiki.legacy/shared.css
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.MenuSelectWidget.js
resources/src/mediawiki/mediawiki.js
tests/phpunit/includes/MediaWikiServicesTest.php
tests/phpunit/includes/RevisionDbTestBase.php
tests/phpunit/includes/RevisionTest.php
tests/phpunit/includes/Storage/MutableRevisionRecordTest.php [new file with mode: 0644]
tests/phpunit/includes/Storage/MutableRevisionSlotsTest.php [new file with mode: 0644]
tests/phpunit/includes/Storage/RevisionRecordTest.php [new file with mode: 0644]
tests/phpunit/includes/Storage/RevisionSlotsTest.php [new file with mode: 0644]
tests/phpunit/includes/Storage/RevisionStoreDbTest.php [new file with mode: 0644]
tests/phpunit/includes/Storage/RevisionStoreRecordTest.php [new file with mode: 0644]
tests/phpunit/includes/Storage/RevisionStoreTest.php [new file with mode: 0644]
tests/phpunit/includes/Storage/SlotRecordTest.php [new file with mode: 0644]
tests/phpunit/includes/Storage/SqlBlobStoreTest.php [new file with mode: 0644]
tests/phpunit/includes/jobqueue/JobTest.php
tests/phpunit/includes/page/WikiPageDbTestBase.php
tests/phpunit/includes/watcheditem/WatchedItemIntegrationTest.php [deleted file]
tests/phpunit/includes/watcheditem/WatchedItemUnitTest.php [deleted file]
tests/phpunit/structure/ResourcesTest.php

index 4a2876d..67026f4 100644 (file)
@@ -123,6 +123,9 @@ changes to languages because of Phabricator reports.
 * The Block class will no longer accept usable-but-missing usernames for
   'byText' or ->setBlocker(). Callers should either ensure the blocker exists
   locally or use a new interwiki-format username like "iw>Example".
+* The RevisionInsertComplete hook is now deprecated, use RevisionRecordInserted instead.
+  RevisionInsertComplete is still called, but the second and third parameter will always be null.
+  Hard deprecation is scheduled for 1.32.
 * The following methods that get and set ParserOutput state are deprecated.
   Callers should use the new stateless $options parameter to
   ParserOutput::getText() instead.
@@ -135,6 +138,17 @@ changes to languages because of Phabricator reports.
   * OutputPage::enableSectionEditLinks()
   * OutputPage::sectionEditLinksEnabled()
   * The public ParserOutput state fields $mTOCEnabled and $mEditSectionTokens are also deprecated.
+* The following methods and constants from the WatchedItem class were deprecated in
+  1.27 have been removed.
+  * WatchedItem::getTitle()
+  * WatchedItem::fromUserTitle()
+  * WatchedItem::addWatch()
+  * WatchedItem::removeWatch()
+  * WatchedItem::isWatched()
+  * WatchedItem::duplicateEntries()
+  * WatchedItem::IGNORE_USER_RIGHTS
+  * WatchedItem::CHECK_USER_RIGHTS
+  * WatchedItem::DEPRECATED_USAGE_TIMESTAMP
 
 == Compatibility ==
 MediaWiki 1.31 requires PHP 5.5.9 or later. There is experimental support for
index 5580bed..6b8387b 100644 (file)
@@ -942,6 +942,22 @@ $wgAutoloadLocalClasses = [
        'MediaWiki\\Shell\\Result' => __DIR__ . '/includes/shell/Result.php',
        'MediaWiki\\Shell\\Shell' => __DIR__ . '/includes/shell/Shell.php',
        'MediaWiki\\Site\\MediaWikiPageNameNormalizer' => __DIR__ . '/includes/site/MediaWikiPageNameNormalizer.php',
+       'MediaWiki\\Storage\\BlobAccessException' => __DIR__ . '/includes/Storage/BlobAccessException.php',
+       'MediaWiki\\Storage\\BlobStore' => __DIR__ . '/includes/Storage/BlobStore.php',
+       'MediaWiki\\Storage\\IncompleteRevisionException' => __DIR__ . '/includes/Storage/IncompleteRevisionException.php',
+       'MediaWiki\\Storage\\MutableRevisionRecord' => __DIR__ . '/includes/Storage/MutableRevisionRecord.php',
+       'MediaWiki\\Storage\\MutableRevisionSlots' => __DIR__ . '/includes/Storage/MutableRevisionSlots.php',
+       'MediaWiki\\Storage\\RevisionAccessException' => __DIR__ . '/includes/Storage/RevisionAccessException.php',
+       'MediaWiki\\Storage\\RevisionArchiveRecord' => __DIR__ . '/includes/Storage/RevisionArchiveRecord.php',
+       'MediaWiki\\Storage\\RevisionFactory' => __DIR__ . '/includes/Storage/RevisionFactory.php',
+       'MediaWiki\\Storage\\RevisionLookup' => __DIR__ . '/includes/Storage/RevisionLookup.php',
+       'MediaWiki\\Storage\\RevisionRecord' => __DIR__ . '/includes/Storage/RevisionRecord.php',
+       'MediaWiki\\Storage\\RevisionSlots' => __DIR__ . '/includes/Storage/RevisionSlots.php',
+       'MediaWiki\\Storage\\RevisionStore' => __DIR__ . '/includes/Storage/RevisionStore.php',
+       'MediaWiki\\Storage\\RevisionStoreRecord' => __DIR__ . '/includes/Storage/RevisionStoreRecord.php',
+       'MediaWiki\\Storage\\SlotRecord' => __DIR__ . '/includes/Storage/SlotRecord.php',
+       'MediaWiki\\Storage\\SqlBlobStore' => __DIR__ . '/includes/Storage/SqlBlobStore.php',
+       'MediaWiki\\Storage\\SuppressedDataException' => __DIR__ . '/includes/Storage/SuppressedDataException.php',
        'MediaWiki\\Tidy\\BalanceActiveFormattingElements' => __DIR__ . '/includes/tidy/Balancer.php',
        'MediaWiki\\Tidy\\BalanceElement' => __DIR__ . '/includes/tidy/Balancer.php',
        'MediaWiki\\Tidy\\BalanceMarker' => __DIR__ . '/includes/tidy/Balancer.php',
@@ -961,6 +977,7 @@ $wgAutoloadLocalClasses = [
        'MediaWiki\\Tidy\\RemexMungerData' => __DIR__ . '/includes/tidy/RemexMungerData.php',
        'MediaWiki\\Tidy\\TidyDriverBase' => __DIR__ . '/includes/tidy/TidyDriverBase.php',
        'MediaWiki\\User\\UserIdentity' => __DIR__ . '/includes/user/UserIdentity.php',
+       'MediaWiki\\User\\UserIdentityValue' => __DIR__ . '/includes/user/UserIdentityValue.php',
        'MediaWiki\\Widget\\ComplexNamespaceInputWidget' => __DIR__ . '/includes/widget/ComplexNamespaceInputWidget.php',
        'MediaWiki\\Widget\\ComplexTitleInputWidget' => __DIR__ . '/includes/widget/ComplexTitleInputWidget.php',
        'MediaWiki\\Widget\\DateInputWidget' => __DIR__ . '/includes/widget/DateInputWidget.php',
index 29883b2..1f4a5f4 100644 (file)
@@ -1840,7 +1840,7 @@ $revisionInfo: Array of revision information
 Return false to stop further processing of the tag
 $reader: XMLReader object
 
-'ImportHandleUnknownUser': When a user does exist locally, this hook is called
+'ImportHandleUnknownUser': When a user doesn't exist locally, this hook is called
 to give extensions an opportunity to auto-create it. If the auto-creation is
 successful, return false.
 $name: User name
@@ -2810,14 +2810,14 @@ called after the addition of 'qunit' and MediaWiki testing resources.
   added to any module.
 &$ResourceLoader: object
 
-'RevisionInsertComplete': Called after a revision is inserted into the database.
-&$revision: the Revision
-$data: the data stored in old_text.  The meaning depends on $flags: if external
-  is set, it's the URL of the revision text in external storage; otherwise,
-  it's the revision text itself.  In either case, if gzip is set, the revision
-  text is gzipped.
-$flags: a comma-delimited list of strings representing the options used.  May
-  include: utf8 (this will always be set for new revisions); gzip; external.
+'RevisionRecordInserted': Called after a revision is inserted into the database.
+$revisionRecord: the RevisionRecord that has just been inserted.
+
+'RevisionInsertComplete': DEPRECATED! Use RevisionRecordInserted hook instead.
+Called after a revision is inserted into the database.
+$revision: the Revision
+$data: DEPRECATED! Always null!
+$flags: DEPRECATED! Always null!
 
 'SearchableNamespaces': An option to modify which namespaces are searchable.
 &$arr: Array of namespaces ($nsId => $name) which will be used.
index 675e347..52410fe 100644 (file)
@@ -133,5 +133,5 @@ class AutoLoader {
        }
 }
 
-Autoloader::$psr4Namespaces = AutoLoader::getAutoloadNamespaces();
+AutoLoader::$psr4Namespaces = AutoLoader::getAutoloadNamespaces();
 spl_autoload_register( [ 'AutoLoader', 'autoload' ] );
index 35f2ce9..0e715df 100644 (file)
@@ -84,13 +84,23 @@ class FeedItem {
        }
 
        /**
-        * Get the unique id of this item
-        *
+        * Get the unique id of this item; already xml-encoded
+        * @return string
+        */
+       public function getUniqueID() {
+               $id = $this->getUniqueIDUnescaped();
+               if ( $id ) {
+                       return $this->xmlEncode( $id );
+               }
+       }
+
+       /**
+        * Get the unique id of this item, without any escaping
         * @return string
         */
-       public function getUniqueId() {
+       public function getUniqueIdUnescaped() {
                if ( $this->uniqueId ) {
-                       return $this->xmlEncode( wfExpandUrl( $this->uniqueId, PROTO_CURRENT ) );
+                       return wfExpandUrl( $this->uniqueId, PROTO_CURRENT );
                }
        }
 
@@ -123,6 +133,14 @@ class FeedItem {
                return $this->xmlEncode( $this->url );
        }
 
+       /** Get the URL of this item without any escaping
+        *
+        * @return string
+        */
+       public function getUrlUnescaped() {
+               return $this->url;
+       }
+
        /**
         * Get the description of this item; already xml-encoded
         *
@@ -132,6 +150,14 @@ class FeedItem {
                return $this->xmlEncode( $this->description );
        }
 
+       /**
+        * Get the description of this item without any escaping
+        *
+        */
+       public function getDescriptionUnescaped() {
+               return $this->description;
+       }
+
        /**
         * Get the language of this item
         *
@@ -160,6 +186,15 @@ class FeedItem {
                return $this->xmlEncode( $this->author );
        }
 
+       /**
+        * Get the author of this item without any escaping
+        *
+        * @return string
+        */
+       public function getAuthorUnescaped() {
+               return $this->author;
+       }
+
        /**
         * Get the comment of this item; already xml-encoded
         *
@@ -169,6 +204,15 @@ class FeedItem {
                return $this->xmlEncode( $this->comments );
        }
 
+       /**
+        * Get the comment of this item without any escaping
+        *
+        * @return string
+        */
+       public function getCommentsUnescaped() {
+               return $this->comments;
+       }
+
        /**
         * Quickie hack... strip out wikilinks to more legible form from the comment.
         *
@@ -187,6 +231,23 @@ class FeedItem {
  * @ingroup Feed
  */
 abstract class ChannelFeed extends FeedItem {
+
+       /** @var TemplateParser */
+       protected $templateParser;
+
+       /**
+        * @param string|Title $title Feed's title
+        * @param string $description
+        * @param string $url URL uniquely designating the feed.
+        * @param string $date Feed's date
+        * @param string $author Author's user name
+        * @param string $comments
+        */
+       function __construct( $title, $description, $url, $date = '', $author = '', $comments = '' ) {
+               parent::__construct( $title, $description, $url, $date, $author, $comments );
+               $this->templateParser = new TemplateParser();
+       }
+
        /**
         * Generate Header of the feed
         * @par Example:
@@ -279,13 +340,15 @@ abstract class ChannelFeed extends FeedItem {
 class RSSFeed extends ChannelFeed {
 
        /**
-        * Format a date given a timestamp
+        * Format a date given a timestamp. If a timestamp is not given, nothing is returned
         *
-        * @param int $ts Timestamp
-        * @return string Date string
+        * @param int|null $ts Timestamp
+        * @return string|null Date string
         */
        function formatTime( $ts ) {
-               return gmdate( 'D, d M Y H:i:s \G\M\T', wfTimestamp( TS_UNIX, $ts ) );
+               if ( $ts ) {
+                       return gmdate( 'D, d M Y H:i:s \G\M\T', wfTimestamp( TS_UNIX, $ts ) );
+               }
        }
 
        /**
@@ -295,15 +358,17 @@ class RSSFeed extends ChannelFeed {
                global $wgVersion;
 
                $this->outXmlHeader();
-               ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
-       <channel>
-               <title><?php print $this->getTitle() ?></title>
-               <link><?php print wfExpandUrl( $this->getUrl(), PROTO_CURRENT ) ?></link>
-               <description><?php print $this->getDescription() ?></description>
-               <language><?php print $this->getLanguage() ?></language>
-               <generator>MediaWiki <?php print $wgVersion ?></generator>
-               <lastBuildDate><?php print $this->formatTime( wfTimestampNow() ) ?></lastBuildDate>
-<?php
+               // Manually escaping rather than letting Mustache do it because Mustache
+               // uses htmlentities, which does not work with XML
+               $templateParams = [
+                       'title' => $this->getTitle(),
+                       'url' => $this->xmlEncode( wfExpandUrl( $this->getUrlUnescaped(), PROTO_CURRENT ) ),
+                       'description' => $this->getDescription(),
+                       'language' => $this->xmlEncode( $this->getLanguage() ),
+                       'version' => $this->xmlEncode( $wgVersion ),
+                       'timestamp' => $this->xmlEncode( $this->formatTime( wfTimestampNow() ) )
+               ];
+               print $this->templateParser->processTemplate( 'RSSHeader', $templateParams );
        }
 
        /**
@@ -311,28 +376,30 @@ class RSSFeed extends ChannelFeed {
         * @param FeedItem $item Item to be output
         */
        function outItem( $item ) {
-               // @codingStandardsIgnoreStart Ignore long lines and formatting issues.
-       ?>
-               <item>
-                       <title><?php print $item->getTitle(); ?></title>
-                       <link><?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ); ?></link>
-                       <guid<?php if ( !$item->rssIsPermalink ) { print ' isPermaLink="false"'; } ?>><?php print $item->getUniqueId(); ?></guid>
-                       <description><?php print $item->getDescription() ?></description>
-                       <?php if ( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ); ?></pubDate><?php } ?>
-                       <?php if ( $item->getAuthor() ) { ?><dc:creator><?php print $item->getAuthor(); ?></dc:creator><?php }?>
-                       <?php if ( $item->getComments() ) { ?><comments><?php print wfExpandUrl( $item->getComments(), PROTO_CURRENT ); ?></comments><?php }?>
-               </item>
-<?php
-               // @codingStandardsIgnoreEnd
+               // Manually escaping rather than letting Mustache do it because Mustache
+               // uses htmlentities, which does not work with XML
+               $templateParams = [
+                       "title" => $item->getTitle(),
+                       "url" => $this->xmlEncode( wfExpandUrl( $item->getUrlUnescaped(), PROTO_CURRENT ) ),
+                       "permalink" => $item->rssIsPermalink,
+                       "uniqueID" => $item->getUniqueId(),
+                       "description" => $item->getDescription(),
+                       "date" => $this->xmlEncode( $this->formatTime( $item->getDate() ) ),
+                       "author" => $item->getAuthor()
+               ];
+               $comments = $item->getCommentsUnescaped();
+               if ( $comments ) {
+                       $commentsEscaped = $this->xmlEncode( wfExpandUrl( $comments, PROTO_CURRENT ) );
+                       $templateParams["comments"] = $commentsEscaped;
+               }
+               print $this->templateParser->processTemplate( 'RSSItem', $templateParams );
        }
 
        /**
         * Output an RSS 2.0 footer
         */
        function outFooter() {
-       ?>
-       </channel>
-</rss><?php
+               print "</channel></rss>";
        }
 }
 
@@ -343,14 +410,16 @@ class RSSFeed extends ChannelFeed {
  */
 class AtomFeed extends ChannelFeed {
        /**
-        * Format a date given timestamp.
+        * Format a date given timestamp, if one is given.
         *
-        * @param string|int $timestamp
-        * @return string
+        * @param string|int|null $timestamp
+        * @return string|null
         */
        function formatTime( $timestamp ) {
-               // need to use RFC 822 time format at least for rss2.0
-               return gmdate( 'Y-m-d\TH:i:s', wfTimestamp( TS_UNIX, $timestamp ) );
+               if ( $timestamp ) {
+                       // need to use RFC 822 time format at least for rss2.0
+                       return gmdate( 'Y-m-d\TH:i:s', wfTimestamp( TS_UNIX, $timestamp ) );
+               }
        }
 
        /**
@@ -358,20 +427,20 @@ class AtomFeed extends ChannelFeed {
         */
        function outHeader() {
                global $wgVersion;
-
                $this->outXmlHeader();
-               // @codingStandardsIgnoreStart Ignore long lines and formatting issues.
-               ?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="<?php print $this->getLanguage() ?>">
-               <id><?php print $this->getFeedId() ?></id>
-               <title><?php print $this->getTitle() ?></title>
-               <link rel="self" type="application/atom+xml" href="<?php print wfExpandUrl( $this->getSelfUrl(), PROTO_CURRENT ) ?>"/>
-               <link rel="alternate" type="text/html" href="<?php print wfExpandUrl( $this->getUrl(), PROTO_CURRENT ) ?>"/>
-               <updated><?php print $this->formatTime( wfTimestampNow() ) ?>Z</updated>
-               <subtitle><?php print $this->getDescription() ?></subtitle>
-               <generator>MediaWiki <?php print $wgVersion ?></generator>
-
-<?php
-               // @codingStandardsIgnoreEnd
+               // Manually escaping rather than letting Mustache do it because Mustache
+               // uses htmlentities, which does not work with XML
+               $templateParams = [
+                       'language' => $this->xmlEncode( $this->getLanguage() ),
+                       'feedID' => $this->getFeedID(),
+                       'title' => $this->getTitle(),
+                       'url' => $this->xmlEncode( wfExpandUrl( $this->getUrlUnescaped(), PROTO_CURRENT ) ),
+                       'selfUrl' => $this->getSelfUrl(),
+                       'timestamp' => $this->xmlEncode( $this->formatTime( wfTimestampNow() ) ),
+                       'description' => $this->getDescription(),
+                       'version' => $this->xmlEncode( $wgVersion ),
+               ];
+               print $this->templateParser->processTemplate( 'AtomHeader', $templateParams );
        }
 
        /**
@@ -401,30 +470,24 @@ class AtomFeed extends ChannelFeed {
         */
        function outItem( $item ) {
                global $wgMimeType;
-               // @codingStandardsIgnoreStart Ignore long lines and formatting issues.
-       ?>
-       <entry>
-               <id><?php print $item->getUniqueId(); ?></id>
-               <title><?php print $item->getTitle(); ?></title>
-               <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ); ?>"/>
-               <?php if ( $item->getDate() ) { ?>
-               <updated><?php print $this->formatTime( $item->getDate() ); ?>Z</updated>
-               <?php } ?>
-
-               <summary type="html"><?php print $item->getDescription() ?></summary>
-               <?php if ( $item->getAuthor() ) { ?><author><name><?php print $item->getAuthor(); ?></name></author><?php }?>
-       </entry>
-
-<?php /* @todo FIXME: Need to add comments
-       <?php if( $item->getComments() ) { ?><dc:comment><?php print $item->getComments() ?></dc:comment><?php }?>
-         */
+               // Manually escaping rather than letting Mustache do it because Mustache
+               // uses htmlentities, which does not work with XML
+               $templateParams = [
+                       "uniqueID" => $item->getUniqueId(),
+                       "title" => $item->getTitle(),
+                       "mimeType" => $this->xmlEncode( $wgMimeType ),
+                       "url" => $this->xmlEncode( wfExpandUrl( $item->getUrlUnescaped(), PROTO_CURRENT ) ),
+                       "date" => $this->xmlEncode( $this->formatTime( $item->getDate() ) ),
+                       "description" => $item->getDescription(),
+                       "author" => $item->getAuthor()
+               ];
+               print $this->templateParser->processTemplate( 'AtomItem', $templateParams );
        }
 
        /**
         * Outputs the footer for Atom 1.0 feed (basically '\</feed\>').
         */
-       function outFooter() {?>
-       </feed><?php
-               // @codingStandardsIgnoreEnd
+       function outFooter() {
+               print "</feed>";
        }
 }
index 19b71f1..33d0fd4 100644 (file)
@@ -11,6 +11,8 @@ use GlobalVarConfig;
 use Hooks;
 use IBufferingStatsdDataFactory;
 use MediaWiki\Shell\CommandFactory;
+use MediaWiki\Storage\BlobStore;
+use MediaWiki\Storage\RevisionStore;
 use Wikimedia\Rdbms\LBFactory;
 use LinkCache;
 use Wikimedia\Rdbms\LoadBalancer;
@@ -698,6 +700,22 @@ class MediaWikiServices extends ServiceContainer {
                return $this->getService( 'ExternalStoreFactory' );
        }
 
+       /**
+        * @since 1.31
+        * @return BlobStore
+        */
+       public function getBlobStore() {
+               return $this->getService( 'BlobStore' );
+       }
+
+       /**
+        * @since 1.31
+        * @return RevisionStore
+        */
+       public function getRevisionStore() {
+               return $this->getService( 'RevisionStore' );
+       }
+
        ///////////////////////////////////////////////////////////////////////////
        // NOTE: When adding a service getter here, don't forget to add a test
        // case for it in MediaWikiServicesTest::provideGetters() and in
index 9d63869..b969e03 100644 (file)
@@ -24,6 +24,7 @@
  *
  * @file
  */
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Timestamp\TimestampException;
 use Wikimedia\Rdbms\IDatabase;
 
@@ -335,6 +336,10 @@ class MergeHistory {
                }
                $this->dest->invalidateCache(); // update histories
 
+               // Duplicate watchers of the old article to the new article on history merge
+               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+               $store->duplicateAllAssociatedEntries( $this->source, $this->dest );
+
                // Update our logs
                $logEntry = new ManualLogEntry( 'merge', 'merge' );
                $logEntry->setPerformer( $user );
index 25c89c2..ea73a61 100644 (file)
  * @file
  */
 
-use Wikimedia\Rdbms\Database;
+use MediaWiki\Storage\MutableRevisionRecord;
+use MediaWiki\Storage\RevisionAccessException;
+use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Storage\RevisionStore;
+use MediaWiki\Storage\RevisionStoreRecord;
+use MediaWiki\Storage\SlotRecord;
+use MediaWiki\Storage\SqlBlobStore;
+use MediaWiki\User\UserIdentityValue;
 use Wikimedia\Rdbms\IDatabase;
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
@@ -28,78 +35,50 @@ use Wikimedia\Rdbms\ResultWrapper;
 use Wikimedia\Rdbms\FakeResultWrapper;
 
 /**
- * @todo document
+ * @deprecated since 1.31, use RevisionRecord, RevisionStore, and BlobStore instead.
  */
 class Revision implements IDBAccessObject {
-       /** @var int|null */
-       protected $mId;
-       /** @var int|null */
-       protected $mPage;
-       /** @var string */
-       protected $mUserText;
-       /** @var string */
-       protected $mOrigUserText;
-       /** @var int */
-       protected $mUser;
-       /** @var bool */
-       protected $mMinorEdit;
-       /** @var string */
-       protected $mTimestamp;
-       /** @var int */
-       protected $mDeleted;
-       /** @var int */
-       protected $mSize;
-       /** @var string */
-       protected $mSha1;
-       /** @var int */
-       protected $mParentId;
-       /** @var string */
-       protected $mComment;
-       /** @var string */
-       protected $mText;
-       /** @var int */
-       protected $mTextId;
-       /** @var int */
-       protected $mUnpatrolled;
-
-       /** @var stdClass|null */
-       protected $mTextRow;
-
-       /**  @var null|Title */
-       protected $mTitle;
-       /** @var bool */
-       protected $mCurrent;
-       /** @var string */
-       protected $mContentModel;
-       /** @var string */
-       protected $mContentFormat;
-
-       /** @var Content|null|bool */
-       protected $mContent;
-       /** @var null|ContentHandler */
-       protected $mContentHandler;
-
-       /** @var int */
-       protected $mQueryFlags = 0;
-       /** @var bool Used for cached values to reload user text and rev_deleted */
-       protected $mRefreshMutableFields = false;
-       /** @var string Wiki ID; false means the current wiki */
-       protected $mWiki = false;
+
+       /** @var RevisionRecord */
+       protected $mRecord;
 
        // Revision deletion constants
-       const DELETED_TEXT = 1;
-       const DELETED_COMMENT = 2;
-       const DELETED_USER = 4;
-       const DELETED_RESTRICTED = 8;
-       const SUPPRESSED_USER = 12; // convenience
-       const SUPPRESSED_ALL = 15; // convenience
+       const DELETED_TEXT = RevisionRecord::DELETED_TEXT;
+       const DELETED_COMMENT = RevisionRecord::DELETED_COMMENT;
+       const DELETED_USER = RevisionRecord::DELETED_USER;
+       const DELETED_RESTRICTED = RevisionRecord::DELETED_RESTRICTED;
+       const SUPPRESSED_USER = RevisionRecord::SUPPRESSED_USER;
+       const SUPPRESSED_ALL = RevisionRecord::SUPPRESSED_ALL;
 
        // Audience options for accessors
-       const FOR_PUBLIC = 1;
-       const FOR_THIS_USER = 2;
-       const RAW = 3;
+       const FOR_PUBLIC = RevisionRecord::FOR_PUBLIC;
+       const FOR_THIS_USER = RevisionRecord::FOR_THIS_USER;
+       const RAW = RevisionRecord::RAW;
+
+       const TEXT_CACHE_GROUP = SqlBlobStore::TEXT_CACHE_GROUP;
 
-       const TEXT_CACHE_GROUP = 'revisiontext:10'; // process cache name and max key count
+       /**
+        * @return RevisionStore
+        */
+       protected static function getRevisionStore() {
+               return MediaWikiServices::getInstance()->getRevisionStore();
+       }
+
+       /**
+        * @return SqlBlobStore
+        */
+       protected static function getBlobStore() {
+               $store = MediaWikiServices::getInstance()->getBlobStore();
+
+               if ( !$store instanceof SqlBlobStore ) {
+                       throw new RuntimeException(
+                               'The backwards compatibility code in Revision currently requires the BlobStore '
+                               . 'service to be an SqlBlobStore instance, but it is a ' . get_class( $store )
+                       );
+               }
+
+               return $store;
+       }
 
        /**
         * Load a page revision from a given revision ID number.
@@ -114,7 +93,8 @@ class Revision implements IDBAccessObject {
         * @return Revision|null
         */
        public static function newFromId( $id, $flags = 0 ) {
-               return self::newFromConds( [ 'rev_id' => intval( $id ) ], $flags );
+               $rec = self::getRevisionStore()->getRevisionById( $id, $flags );
+               return $rec === null ? null : new Revision( $rec, $flags );
        }
 
        /**
@@ -132,20 +112,8 @@ class Revision implements IDBAccessObject {
         * @return Revision|null
         */
        public static function newFromTitle( LinkTarget $linkTarget, $id = 0, $flags = 0 ) {
-               $conds = [
-                       'page_namespace' => $linkTarget->getNamespace(),
-                       'page_title' => $linkTarget->getDBkey()
-               ];
-               if ( $id ) {
-                       // Use the specified ID
-                       $conds['rev_id'] = $id;
-                       return self::newFromConds( $conds, $flags );
-               } else {
-                       // Use a join to get the latest revision
-                       $conds[] = 'rev_id=page_latest';
-                       $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
-                       return self::loadFromConds( $db, $conds, $flags );
-               }
+               $rec = self::getRevisionStore()->getRevisionByTitle( $linkTarget, $id, $flags );
+               return $rec === null ? null : new Revision( $rec, $flags );
        }
 
        /**
@@ -163,22 +131,13 @@ class Revision implements IDBAccessObject {
         * @return Revision|null
         */
        public static function newFromPageId( $pageId, $revId = 0, $flags = 0 ) {
-               $conds = [ 'page_id' => $pageId ];
-               if ( $revId ) {
-                       $conds['rev_id'] = $revId;
-                       return self::newFromConds( $conds, $flags );
-               } else {
-                       // Use a join to get the latest revision
-                       $conds[] = 'rev_id = page_latest';
-                       $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
-                       return self::loadFromConds( $db, $conds, $flags );
-               }
+               $rec = self::getRevisionStore()->getRevisionByPageId( $pageId, $revId, $flags );
+               return $rec === null ? null : new Revision( $rec, $flags );
        }
 
        /**
         * Make a fake revision object from an archive table row. This is queried
         * for permissions or even inserted (as in Special:Undelete)
-        * @todo FIXME: Should be a subclass for RevisionDelete. [TS]
         *
         * @param object $row
         * @param array $overrides
@@ -187,68 +146,45 @@ class Revision implements IDBAccessObject {
         * @return Revision
         */
        public static function newFromArchiveRow( $row, $overrides = [] ) {
-               global $wgContentHandlerUseDB;
-
-               $attribs = $overrides + [
-                       'page'       => isset( $row->ar_page_id ) ? $row->ar_page_id : null,
-                       'id'         => isset( $row->ar_rev_id ) ? $row->ar_rev_id : null,
-                       'comment'    => CommentStore::newKey( 'ar_comment' )
-                               // Legacy because $row may have come from self::selectArchiveFields()
-                               ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row, true )->text,
-                       'user'       => $row->ar_user,
-                       'user_text'  => $row->ar_user_text,
-                       'timestamp'  => $row->ar_timestamp,
-                       'minor_edit' => $row->ar_minor_edit,
-                       'text_id'    => isset( $row->ar_text_id ) ? $row->ar_text_id : null,
-                       'deleted'    => $row->ar_deleted,
-                       'len'        => $row->ar_len,
-                       'sha1'       => isset( $row->ar_sha1 ) ? $row->ar_sha1 : null,
-                       'content_model'   => isset( $row->ar_content_model ) ? $row->ar_content_model : null,
-                       'content_format'  => isset( $row->ar_content_format ) ? $row->ar_content_format : null,
-               ];
-
-               if ( !$wgContentHandlerUseDB ) {
-                       unset( $attribs['content_model'] );
-                       unset( $attribs['content_format'] );
-               }
-
-               if ( !isset( $attribs['title'] )
-                       && isset( $row->ar_namespace )
-                       && isset( $row->ar_title )
-               ) {
-                       $attribs['title'] = Title::makeTitle( $row->ar_namespace, $row->ar_title );
-               }
-
-               if ( isset( $row->ar_text ) && !$row->ar_text_id ) {
-                       // Pre-1.5 ar_text row
-                       $attribs['text'] = self::getRevisionText( $row, 'ar_' );
-                       if ( $attribs['text'] === false ) {
-                               throw new MWException( 'Unable to load text from archive row (possibly T24624)' );
-                       }
-               }
-               return new self( $attribs );
+               $rec = self::getRevisionStore()->newRevisionFromArchiveRow( $row, 0, null, $overrides );
+               return new Revision( $rec );
        }
 
        /**
         * @since 1.19
         *
-        * @param object $row
+        * MCR migration note: replaced by RevisionStore::newRevisionFromRow(). Note that
+        * newFromRow() also accepts arrays, while newRevisionFromRow() does not. Instead,
+        * a MutableRevisionRecord should be constructed directly. RevisionStore::newRevisionFromArray()
+        * can be used as a temporary replacement, but should be avoided.
+        *
+        * @param object|array $row
         * @return Revision
         */
        public static function newFromRow( $row ) {
-               return new self( $row );
+               if ( is_array( $row ) ) {
+                       $rec = self::getRevisionStore()->newMutableRevisionFromArray( $row );
+               } else {
+                       $rec = self::getRevisionStore()->newRevisionFromRow( $row );
+               }
+
+               return new Revision( $rec );
        }
 
        /**
         * Load a page revision from a given revision ID number.
         * Returns null if no such revision can be found.
         *
+        * @deprecated since 1.31, use RevisionStore::getRevisionById() instead.
+        *
         * @param IDatabase $db
         * @param int $id
         * @return Revision|null
         */
        public static function loadFromId( $db, $id ) {
-               return self::loadFromConds( $db, [ 'rev_id' => intval( $id ) ] );
+               wfDeprecated( __METHOD__, '1.31' ); // no known callers
+               $rec = self::getRevisionStore()->loadRevisionFromId( $db, $id );
+               return $rec === null ? null : new Revision( $rec );
        }
 
        /**
@@ -256,19 +192,16 @@ class Revision implements IDBAccessObject {
         * that's attached to a given page. If not attached
         * to that page, will return null.
         *
+        * @deprecated since 1.31, use RevisionStore::getRevisionByPageId() instead.
+        *
         * @param IDatabase $db
         * @param int $pageid
         * @param int $id
         * @return Revision|null
         */
        public static function loadFromPageId( $db, $pageid, $id = 0 ) {
-               $conds = [ 'rev_page' => intval( $pageid ), 'page_id' => intval( $pageid ) ];
-               if ( $id ) {
-                       $conds['rev_id'] = intval( $id );
-               } else {
-                       $conds[] = 'rev_id=page_latest';
-               }
-               return self::loadFromConds( $db, $conds );
+               $rec = self::getRevisionStore()->loadRevisionFromPageId( $db, $pageid, $id );
+               return $rec === null ? null : new Revision( $rec );
        }
 
        /**
@@ -276,24 +209,16 @@ class Revision implements IDBAccessObject {
         * that's attached to a given page. If not attached
         * to that page, will return null.
         *
+        * @deprecated since 1.31, use RevisionStore::getRevisionByTitle() instead.
+        *
         * @param IDatabase $db
         * @param Title $title
         * @param int $id
         * @return Revision|null
         */
        public static function loadFromTitle( $db, $title, $id = 0 ) {
-               if ( $id ) {
-                       $matchId = intval( $id );
-               } else {
-                       $matchId = 'page_latest';
-               }
-               return self::loadFromConds( $db,
-                       [
-                               "rev_id=$matchId",
-                               'page_namespace' => $title->getNamespace(),
-                               'page_title' => $title->getDBkey()
-                       ]
-               );
+               $rec = self::getRevisionStore()->loadRevisionFromTitle( $db, $title, $id );
+               return $rec === null ? null : new Revision( $rec );
        }
 
        /**
@@ -301,73 +226,17 @@ class Revision implements IDBAccessObject {
         * WARNING: Timestamps may in some circumstances not be unique,
         * so this isn't the best key to use.
         *
+        * @deprecated since 1.31, use RevisionStore::loadRevisionFromTimestamp() instead.
+        *
         * @param IDatabase $db
         * @param Title $title
         * @param string $timestamp
         * @return Revision|null
         */
        public static function loadFromTimestamp( $db, $title, $timestamp ) {
-               return self::loadFromConds( $db,
-                       [
-                               'rev_timestamp' => $db->timestamp( $timestamp ),
-                               'page_namespace' => $title->getNamespace(),
-                               'page_title' => $title->getDBkey()
-                       ]
-               );
-       }
-
-       /**
-        * Given a set of conditions, fetch a revision
-        *
-        * This method is used then a revision ID is qualified and
-        * will incorporate some basic replica DB/master fallback logic
-        *
-        * @param array $conditions
-        * @param int $flags (optional)
-        * @return Revision|null
-        */
-       private static function newFromConds( $conditions, $flags = 0 ) {
-               $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
-
-               $rev = self::loadFromConds( $db, $conditions, $flags );
-               // Make sure new pending/committed revision are visibile later on
-               // within web requests to certain avoid bugs like T93866 and T94407.
-               if ( !$rev
-                       && !( $flags & self::READ_LATEST )
-                       && wfGetLB()->getServerCount() > 1
-                       && wfGetLB()->hasOrMadeRecentMasterChanges()
-               ) {
-                       $flags = self::READ_LATEST;
-                       $db = wfGetDB( DB_MASTER );
-                       $rev = self::loadFromConds( $db, $conditions, $flags );
-               }
-
-               if ( $rev ) {
-                       $rev->mQueryFlags = $flags;
-               }
-
-               return $rev;
-       }
-
-       /**
-        * Given a set of conditions, fetch a revision from
-        * the given database connection.
-        *
-        * @param IDatabase $db
-        * @param array $conditions
-        * @param int $flags (optional)
-        * @return Revision|null
-        */
-       private static function loadFromConds( $db, $conditions, $flags = 0 ) {
-               $row = self::fetchFromConds( $db, $conditions, $flags );
-               if ( $row ) {
-                       $rev = new Revision( $row );
-                       $rev->mWiki = $db->getDomainID();
-
-                       return $rev;
-               }
-
-               return null;
+               // XXX: replace loadRevisionFromTimestamp by getRevisionByTimestamp?
+               $rec = self::getRevisionStore()->loadRevisionFromTimestamp( $db, $title, $timestamp );
+               return $rec === null ? null : new Revision( $rec );
        }
 
        /**
@@ -377,52 +246,18 @@ class Revision implements IDBAccessObject {
         *
         * @param LinkTarget $title
         * @return ResultWrapper
-        * @deprecated Since 1.28
+        * @deprecated Since 1.28, no callers in core nor in known extensions. No-op since 1.31.
         */
        public static function fetchRevision( LinkTarget $title ) {
-               $row = self::fetchFromConds(
-                       wfGetDB( DB_REPLICA ),
-                       [
-                               'rev_id=page_latest',
-                               'page_namespace' => $title->getNamespace(),
-                               'page_title' => $title->getDBkey()
-                       ]
-               );
-
-               return new FakeResultWrapper( $row ? [ $row ] : [] );
-       }
-
-       /**
-        * Given a set of conditions, return a ResultWrapper
-        * which will return matching database rows with the
-        * fields necessary to build Revision objects.
-        *
-        * @param IDatabase $db
-        * @param array $conditions
-        * @param int $flags (optional)
-        * @return stdClass
-        */
-       private static function fetchFromConds( $db, $conditions, $flags = 0 ) {
-               $revQuery = self::getQueryInfo( [ 'page', 'user' ] );
-               $options = [];
-               if ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING ) {
-                       $options[] = 'FOR UPDATE';
-               }
-               return $db->selectRow(
-                       $revQuery['tables'],
-                       $revQuery['fields'],
-                       $conditions,
-                       __METHOD__,
-                       $options,
-                       $revQuery['joins']
-               );
+               wfDeprecated( __METHOD__, '1.31' );
+               return new FakeResultWrapper( [] );
        }
 
        /**
         * Return the value of a select() JOIN conds array for the user table.
         * This will get user table rows for logged-in users.
         * @since 1.19
-        * @deprecated since 1.31, use self::getQueryInfo( [ 'user' ] ) instead.
+        * @deprecated since 1.31, use RevisionStore::getQueryInfo( [ 'user' ] ) instead.
         * @return array
         */
        public static function userJoinCond() {
@@ -434,7 +269,7 @@ class Revision implements IDBAccessObject {
         * Return the value of a select() page conds array for the page table.
         * This will assure that the revision(s) are not orphaned from live pages.
         * @since 1.19
-        * @deprecated since 1.31, use self::getQueryInfo( [ 'page' ] ) instead.
+        * @deprecated since 1.31, use RevisionStore::getQueryInfo( [ 'page' ] ) instead.
         * @return array
         */
        public static function pageJoinCond() {
@@ -445,7 +280,7 @@ class Revision implements IDBAccessObject {
        /**
         * Return the list of revision fields that should be selected to create
         * a new revision.
-        * @deprecated since 1.31, use self::getQueryInfo() instead.
+        * @deprecated since 1.31, use RevisionStore::getQueryInfo() instead.
         * @return array
         */
        public static function selectFields() {
@@ -480,7 +315,7 @@ class Revision implements IDBAccessObject {
        /**
         * Return the list of revision fields that should be selected to create
         * a new revision from an archive row.
-        * @deprecated since 1.31, use self::getArchiveQueryInfo() instead.
+        * @deprecated since 1.31, use RevisionStore::getArchiveQueryInfo() instead.
         * @return array
         */
        public static function selectArchiveFields() {
@@ -516,7 +351,7 @@ class Revision implements IDBAccessObject {
        /**
         * Return the list of text fields that should be selected to read the
         * revision text
-        * @deprecated since 1.31, use self::getQueryInfo( [ 'text' ] ) instead.
+        * @deprecated since 1.31, use RevisionStore::getQueryInfo( [ 'text' ] ) instead.
         * @return array
         */
        public static function selectTextFields() {
@@ -529,7 +364,7 @@ class Revision implements IDBAccessObject {
 
        /**
         * Return the list of page fields that should be selected from page table
-        * @deprecated since 1.31, use self::getQueryInfo( [ 'page' ] ) instead.
+        * @deprecated since 1.31, use RevisionStore::getQueryInfo( [ 'page' ] ) instead.
         * @return array
         */
        public static function selectPageFields() {
@@ -546,7 +381,7 @@ class Revision implements IDBAccessObject {
 
        /**
         * Return the list of user fields that should be selected from user table
-        * @deprecated since 1.31, use self::getQueryInfo( [ 'user' ] ) instead.
+        * @deprecated since 1.31, use RevisionStore::getQueryInfo( [ 'user' ] ) instead.
         * @return array
         */
        public static function selectUserFields() {
@@ -558,6 +393,7 @@ class Revision implements IDBAccessObject {
         * Return the tables, fields, and join conditions to be selected to create
         * a new revision object.
         * @since 1.31
+        * @deprecated since 1.31, use RevisionStore::getQueryInfo() instead.
         * @param array $options Any combination of the following strings
         *  - 'page': Join with the page table, and select fields to identify the page
         *  - 'user': Join with the user table, and select the user name
@@ -568,104 +404,21 @@ class Revision implements IDBAccessObject {
         *   - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
         */
        public static function getQueryInfo( $options = [] ) {
-               global $wgContentHandlerUseDB;
-
-               $commentQuery = CommentStore::newKey( 'rev_comment' )->getJoin();
-               $ret = [
-                       'tables' => [ 'revision' ] + $commentQuery['tables'],
-                       'fields' => [
-                               'rev_id',
-                               'rev_page',
-                               'rev_text_id',
-                               'rev_timestamp',
-                               'rev_user_text',
-                               'rev_user',
-                               'rev_minor_edit',
-                               'rev_deleted',
-                               'rev_len',
-                               'rev_parent_id',
-                               'rev_sha1',
-                       ] + $commentQuery['fields'],
-                       'joins' => $commentQuery['joins'],
-               ];
-
-               if ( $wgContentHandlerUseDB ) {
-                       $ret['fields'][] = 'rev_content_format';
-                       $ret['fields'][] = 'rev_content_model';
-               }
-
-               if ( in_array( 'page', $options, true ) ) {
-                       $ret['tables'][] = 'page';
-                       $ret['fields'] = array_merge( $ret['fields'], [
-                               'page_namespace',
-                               'page_title',
-                               'page_id',
-                               'page_latest',
-                               'page_is_redirect',
-                               'page_len',
-                       ] );
-                       $ret['joins']['page'] = [ 'INNER JOIN', [ 'page_id = rev_page' ] ];
-               }
-
-               if ( in_array( 'user', $options, true ) ) {
-                       $ret['tables'][] = 'user';
-                       $ret['fields'] = array_merge( $ret['fields'], [
-                               'user_name',
-                       ] );
-                       $ret['joins']['user'] = [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ];
-               }
-
-               if ( in_array( 'text', $options, true ) ) {
-                       $ret['tables'][] = 'text';
-                       $ret['fields'] = array_merge( $ret['fields'], [
-                               'old_text',
-                               'old_flags'
-                       ] );
-                       $ret['joins']['text'] = [ 'INNER JOIN', [ 'rev_text_id=old_id' ] ];
-               }
-
-               return $ret;
+               return self::getRevisionStore()->getQueryInfo( $options );
        }
 
        /**
         * Return the tables, fields, and join conditions to be selected to create
         * a new archived revision object.
         * @since 1.31
+        * @deprecated since 1.31, use RevisionStore::getArchiveQueryInfo() instead.
         * @return array With three keys:
         *   - tables: (string[]) to include in the `$table` to `IDatabase->select()`
         *   - fields: (string[]) to include in the `$vars` to `IDatabase->select()`
         *   - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
         */
        public static function getArchiveQueryInfo() {
-               global $wgContentHandlerUseDB;
-
-               $commentQuery = CommentStore::newKey( 'ar_comment' )->getJoin();
-               $ret = [
-                       'tables' => [ 'archive' ] + $commentQuery['tables'],
-                       'fields' => [
-                               'ar_id',
-                               'ar_page_id',
-                               'ar_rev_id',
-                               'ar_text',
-                               'ar_text_id',
-                               'ar_timestamp',
-                               'ar_user_text',
-                               'ar_user',
-                               'ar_minor_edit',
-                               'ar_deleted',
-                               'ar_len',
-                               'ar_parent_id',
-                               'ar_sha1',
-                       ] + $commentQuery['fields'],
-                       'joins' => $commentQuery['joins'],
-               ];
-
-               if ( $wgContentHandlerUseDB ) {
-                       $ret['fields'][] = 'ar_content_format';
-                       $ret['fields'][] = 'ar_content_model';
-               }
-
-               return $ret;
+               return self::getRevisionStore()->getArchiveQueryInfo();
        }
 
        /**
@@ -675,203 +428,49 @@ class Revision implements IDBAccessObject {
         * @return array
         */
        public static function getParentLengths( $db, array $revIds ) {
-               $revLens = [];
-               if ( !$revIds ) {
-                       return $revLens; // empty
-               }
-               $res = $db->select( 'revision',
-                       [ 'rev_id', 'rev_len' ],
-                       [ 'rev_id' => $revIds ],
-                       __METHOD__ );
-               foreach ( $res as $row ) {
-                       $revLens[$row->rev_id] = $row->rev_len;
-               }
-               return $revLens;
+               return self::getRevisionStore()->listRevisionSizes( $db, $revIds );
        }
 
        /**
-        * @param object|array $row Either a database row or an array
-        * @throws MWException
+        * @param object|array|RevisionRecord $row Either a database row or an array
+        * @param int $queryFlags
+        * @param Title|null $title
+        *
         * @access private
         */
-       public function __construct( $row ) {
-               if ( is_object( $row ) ) {
-                       $this->constructFromDbRowObject( $row );
-               } elseif ( is_array( $row ) ) {
-                       $this->constructFromRowArray( $row );
-               } else {
-                       throw new MWException( 'Revision constructor passed invalid row format.' );
-               }
-               $this->mUnpatrolled = null;
-       }
+       function __construct( $row, $queryFlags = 0, Title $title = null ) {
+               global $wgUser;
 
-       /**
-        * @param object $row
-        */
-       private function constructFromDbRowObject( $row ) {
-               $this->mId = intval( $row->rev_id );
-               $this->mPage = intval( $row->rev_page );
-               $this->mTextId = intval( $row->rev_text_id );
-               $this->mComment = CommentStore::newKey( 'rev_comment' )
-                       // Legacy because $row may have come from self::selectFields()
-                       ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row, true )->text;
-               $this->mUser = intval( $row->rev_user );
-               $this->mMinorEdit = intval( $row->rev_minor_edit );
-               $this->mTimestamp = $row->rev_timestamp;
-               $this->mDeleted = intval( $row->rev_deleted );
-
-               if ( !isset( $row->rev_parent_id ) ) {
-                       $this->mParentId = null;
-               } else {
-                       $this->mParentId = intval( $row->rev_parent_id );
-               }
-
-               if ( !isset( $row->rev_len ) ) {
-                       $this->mSize = null;
-               } else {
-                       $this->mSize = intval( $row->rev_len );
-               }
-
-               if ( !isset( $row->rev_sha1 ) ) {
-                       $this->mSha1 = null;
-               } else {
-                       $this->mSha1 = $row->rev_sha1;
-               }
-
-               if ( isset( $row->page_latest ) ) {
-                       $this->mCurrent = ( $row->rev_id == $row->page_latest );
-                       $this->mTitle = Title::newFromRow( $row );
-               } else {
-                       $this->mCurrent = false;
-                       $this->mTitle = null;
-               }
-
-               if ( !isset( $row->rev_content_model ) ) {
-                       $this->mContentModel = null; # determine on demand if needed
-               } else {
-                       $this->mContentModel = strval( $row->rev_content_model );
-               }
-
-               if ( !isset( $row->rev_content_format ) ) {
-                       $this->mContentFormat = null; # determine on demand if needed
-               } else {
-                       $this->mContentFormat = strval( $row->rev_content_format );
-               }
+               if ( $row instanceof RevisionRecord ) {
+                       $this->mRecord = $row;
+               } elseif ( is_array( $row ) ) {
+                       if ( !isset( $row['user'] ) && !isset( $row['user_text'] ) ) {
+                               $row['user'] = $wgUser;
+                       }
 
-               // Lazy extraction...
-               $this->mText = null;
-               if ( isset( $row->old_text ) ) {
-                       $this->mTextRow = $row;
+                       $this->mRecord = self::getRevisionStore()->newMutableRevisionFromArray(
+                               $row,
+                               $queryFlags,
+                               $title
+                       );
+               } elseif ( is_object( $row ) ) {
+                       $this->mRecord = self::getRevisionStore()->newRevisionFromRow(
+                               $row,
+                               $queryFlags,
+                               $title
+                       );
                } else {
-                       // 'text' table row entry will be lazy-loaded
-                       $this->mTextRow = null;
-               }
-
-               // Use user_name for users and rev_user_text for IPs...
-               $this->mUserText = null; // lazy load if left null
-               if ( $this->mUser == 0 ) {
-                       $this->mUserText = $row->rev_user_text; // IP user
-               } elseif ( isset( $row->user_name ) ) {
-                       $this->mUserText = $row->user_name; // logged-in user
+                       throw new InvalidArgumentException(
+                               '$row must be a row object, an associative array, or a RevisionRecord'
+                       );
                }
-               $this->mOrigUserText = $row->rev_user_text;
        }
 
        /**
-        * @param array $row
-        *
-        * @throws MWException
+        * @return RevisionRecord
         */
-       private function constructFromRowArray( array $row ) {
-               // Build a new revision to be saved...
-               global $wgUser; // ugh
-
-               # if we have a content object, use it to set the model and type
-               if ( !empty( $row['content'] ) ) {
-                       if ( !( $row['content'] instanceof Content ) ) {
-                               throw new MWException( '`content` field must contain a Content object.' );
-                       }
-
-                       // @todo when is that set? test with external store setup! check out insertOn() [dk]
-                       if ( !empty( $row['text_id'] ) ) {
-                               throw new MWException( "Text already stored in external store (id {$row['text_id']}), " .
-                                       "can't serialize content object" );
-                       }
-
-                       $row['content_model'] = $row['content']->getModel();
-                       # note: mContentFormat is initializes later accordingly
-                       # note: content is serialized later in this method!
-                       # also set text to null?
-               }
-
-               $this->mId = isset( $row['id'] ) ? intval( $row['id'] ) : null;
-               $this->mPage = isset( $row['page'] ) ? intval( $row['page'] ) : null;
-               $this->mTextId = isset( $row['text_id'] ) ? intval( $row['text_id'] ) : null;
-               $this->mUserText = isset( $row['user_text'] )
-                       ? strval( $row['user_text'] ) : $wgUser->getName();
-               $this->mUser = isset( $row['user'] ) ? intval( $row['user'] ) : $wgUser->getId();
-               $this->mMinorEdit = isset( $row['minor_edit'] ) ? intval( $row['minor_edit'] ) : 0;
-               $this->mTimestamp = isset( $row['timestamp'] )
-                       ? strval( $row['timestamp'] ) : wfTimestampNow();
-               $this->mDeleted = isset( $row['deleted'] ) ? intval( $row['deleted'] ) : 0;
-               $this->mSize = isset( $row['len'] ) ? intval( $row['len'] ) : null;
-               $this->mParentId = isset( $row['parent_id'] ) ? intval( $row['parent_id'] ) : null;
-               $this->mSha1 = isset( $row['sha1'] ) ? strval( $row['sha1'] ) : null;
-
-               $this->mContentModel = isset( $row['content_model'] )
-                       ? strval( $row['content_model'] ) : null;
-               $this->mContentFormat = isset( $row['content_format'] )
-                       ? strval( $row['content_format'] ) : null;
-
-               // Enforce spacing trimming on supplied text
-               $this->mComment = isset( $row['comment'] ) ? trim( strval( $row['comment'] ) ) : null;
-               $this->mText = isset( $row['text'] ) ? rtrim( strval( $row['text'] ) ) : null;
-               $this->mTextRow = null;
-
-               $this->mTitle = isset( $row['title'] ) ? $row['title'] : null;
-
-               // if we have a Content object, override mText and mContentModel
-               if ( !empty( $row['content'] ) ) {
-                       $handler = $this->getContentHandler();
-                       $this->mContent = $row['content'];
-
-                       $this->mContentModel = $this->mContent->getModel();
-                       $this->mContentHandler = null;
-
-                       $this->mText = $handler->serializeContent( $row['content'], $this->getContentFormat() );
-               } elseif ( $this->mText !== null ) {
-                       $handler = $this->getContentHandler();
-                       $this->mContent = $handler->unserializeContent( $this->mText );
-               }
-
-               // If we have a Title object, make sure it is consistent with mPage.
-               if ( $this->mTitle && $this->mTitle->exists() ) {
-                       if ( $this->mPage === null ) {
-                               // if the page ID wasn't known, set it now
-                               $this->mPage = $this->mTitle->getArticleID();
-                       } elseif ( $this->mTitle->getArticleID() !== $this->mPage ) {
-                               // Got different page IDs. This may be legit (e.g. during undeletion),
-                               // but it seems worth mentioning it in the log.
-                               wfDebug( "Page ID " . $this->mPage . " mismatches the ID " .
-                                       $this->mTitle->getArticleID() . " provided by the Title object." );
-                       }
-               }
-
-               $this->mCurrent = false;
-
-               // If we still have no length, see it we have the text to figure it out
-               if ( !$this->mSize && $this->mContent !== null ) {
-                       $this->mSize = $this->mContent->getSize();
-               }
-
-               // Same for sha1
-               if ( $this->mSha1 === null ) {
-                       $this->mSha1 = $this->mText === null ? null : self::base36Sha1( $this->mText );
-               }
-
-               // force lazy init
-               $this->getContentModel();
-               $this->getContentFormat();
+       public function getRevisionRecord() {
+               return $this->mRecord;
        }
 
        /**
@@ -880,19 +479,27 @@ class Revision implements IDBAccessObject {
         * @return int|null
         */
        public function getId() {
-               return $this->mId;
+               return $this->mRecord->getId();
        }
 
        /**
         * Set the revision ID
         *
-        * This should only be used for proposed revisions that turn out to be null edits
+        * This should only be used for proposed revisions that turn out to be null edits.
+        *
+        * @note Only supported on Revisions that were constructed based on associative arrays,
+        *       since they are mutable.
         *
         * @since 1.19
-        * @param int $id
+        * @param int|string $id
+        * @throws MWException
         */
        public function setId( $id ) {
-               $this->mId = (int)$id;
+               if ( $this->mRecord instanceof MutableRevisionRecord ) {
+                       $this->mRecord->setId( intval( $id ) );
+               } else {
+                       throw new MWException( __METHOD__ . ' is not supported on this instance' );
+               }
        }
 
        /**
@@ -900,106 +507,107 @@ class Revision implements IDBAccessObject {
         *
         * This should only be used for proposed revisions that turn out to be null edits
         *
+        * @note Only supported on Revisions that were constructed based on associative arrays,
+        *       since they are mutable.
+        *
         * @since 1.28
         * @deprecated since 1.31, please reuse old Revision object
         * @param int $id User ID
         * @param string $name User name
+        * @throws MWException
         */
        public function setUserIdAndName( $id, $name ) {
-               $this->mUser = (int)$id;
-               $this->mUserText = $name;
-               $this->mOrigUserText = $name;
+               if ( $this->mRecord instanceof MutableRevisionRecord ) {
+                       $user = new UserIdentityValue( intval( $id ), $name );
+                       $this->mRecord->setUser( $user );
+               } else {
+                       throw new MWException( __METHOD__ . ' is not supported on this instance' );
+               }
        }
 
        /**
-        * Get text row ID
+        * @return SlotRecord
+        */
+       private function getMainSlotRaw() {
+               return $this->mRecord->getSlot( 'main', RevisionRecord::RAW );
+       }
+
+       /**
+        * Get the ID of the row of the text table that contains the content of the
+        * revision's main slot, if that content is stored in the text table.
+        *
+        * If the content is stored elsewhere, this returns null.
+        *
+        * @deprecated since 1.31, use RevisionRecord()->getSlot()->getContentAddress() to
+        * get that actual address that can be used with BlobStore::getBlob(); or use
+        * RevisionRecord::hasSameContent() to check if two revisions have the same content.
         *
         * @return int|null
         */
        public function getTextId() {
-               return $this->mTextId;
+               $slot = $this->getMainSlotRaw();
+               return $slot->hasAddress()
+                       ? self::getBlobStore()->getTextIdFromAddress( $slot->getAddress() )
+                       : null;
        }
 
        /**
         * Get parent revision ID (the original previous page revision)
         *
-        * @return int|null
+        * @return int|null The ID of the parent revision. 0 indicates that there is no
+        * parent revision. Null indicates that the parent revision is not known.
         */
        public function getParentId() {
-               return $this->mParentId;
+               return $this->mRecord->getParentId();
        }
 
        /**
         * Returns the length of the text in this revision, or null if unknown.
         *
-        * @return int|null
+        * @return int
         */
        public function getSize() {
-               return $this->mSize;
+               return $this->mRecord->getSize();
        }
 
        /**
-        * Returns the base36 sha1 of the text in this revision, or null if unknown.
+        * Returns the base36 sha1 of the content in this revision, or null if unknown.
         *
-        * @return string|null
+        * @return string
         */
        public function getSha1() {
-               return $this->mSha1;
+               // XXX: we may want to drop all the hashing logic, it's not worth the overhead.
+               return $this->mRecord->getSha1();
        }
 
        /**
-        * Returns the title of the page associated with this entry or null.
+        * Returns the title of the page associated with this entry.
+        * Since 1.31, this will never return null.
         *
         * Will do a query, when title is not set and id is given.
         *
-        * @return Title|null
+        * @return Title
         */
        public function getTitle() {
-               if ( $this->mTitle !== null ) {
-                       return $this->mTitle;
-               }
-               // rev_id is defined as NOT NULL, but this revision may not yet have been inserted.
-               if ( $this->mId !== null ) {
-                       $dbr = wfGetLB( $this->mWiki )->getConnectionRef( DB_REPLICA, [], $this->mWiki );
-                       // @todo: Title::getSelectFields(), or Title::getQueryInfo(), or something like that
-                       $row = $dbr->selectRow(
-                               [ 'revision', 'page' ],
-                               [
-                                       'page_namespace',
-                                       'page_title',
-                                       'page_id',
-                                       'page_latest',
-                                       'page_is_redirect',
-                                       'page_len',
-                               ],
-                               [ 'rev_id' => $this->mId ],
-                               __METHOD__,
-                               [],
-                               [ 'page' => [ 'JOIN', 'page_id=rev_page' ] ]
-                       );
-                       if ( $row ) {
-                               // @TODO: better foreign title handling
-                               $this->mTitle = Title::newFromRow( $row );
-                       }
-               }
-
-               if ( $this->mWiki === false || $this->mWiki === wfWikiID() ) {
-                       // Loading by ID is best, though not possible for foreign titles
-                       if ( !$this->mTitle && $this->mPage !== null && $this->mPage > 0 ) {
-                               $this->mTitle = Title::newFromID( $this->mPage );
-                       }
-               }
-
-               return $this->mTitle;
+               $linkTarget = $this->mRecord->getPageAsLinkTarget();
+               return Title::newFromLinkTarget( $linkTarget );
        }
 
        /**
         * Set the title of the revision
         *
+        * @deprecated: since 1.31, this is now a noop. Pass the Title to the constructor instead.
+        *
         * @param Title $title
         */
        public function setTitle( $title ) {
-               $this->mTitle = $title;
+               if ( !$title->equals( $this->getTitle() ) ) {
+                       throw new InvalidArgumentException(
+                               $title->getPrefixedText()
+                                       . ' is not the same as '
+                                       . $this->mRecord->getPageAsLinkTarget()->__toString()
+                       );
+               }
        }
 
        /**
@@ -1008,7 +616,7 @@ class Revision implements IDBAccessObject {
         * @return int|null
         */
        public function getPage() {
-               return $this->mPage;
+               return $this->mRecord->getPageId();
        }
 
        /**
@@ -1025,13 +633,14 @@ class Revision implements IDBAccessObject {
         * @return int
         */
        public function getUser( $audience = self::FOR_PUBLIC, User $user = null ) {
-               if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_USER ) ) {
-                       return 0;
-               } elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_USER, $user ) ) {
-                       return 0;
-               } else {
-                       return $this->mUser;
+               global $wgUser;
+
+               if ( $audience === self::FOR_THIS_USER && !$user ) {
+                       $user = $wgUser;
                }
+
+               $user = $this->mRecord->getUser( $audience, $user );
+               return $user ? $user->getId() : 0;
        }
 
        /**
@@ -1059,23 +668,14 @@ class Revision implements IDBAccessObject {
         * @return string
         */
        public function getUserText( $audience = self::FOR_PUBLIC, User $user = null ) {
-               $this->loadMutableFields();
+               global $wgUser;
 
-               if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_USER ) ) {
-                       return '';
-               } elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_USER, $user ) ) {
-                       return '';
-               } else {
-                       if ( $this->mUserText === null ) {
-                               $this->mUserText = User::whoIs( $this->mUser ); // load on demand
-                               if ( $this->mUserText === false ) {
-                                       # This shouldn't happen, but it can if the wiki was recovered
-                                       # via importing revs and there is no user table entry yet.
-                                       $this->mUserText = $this->mOrigUserText;
-                               }
-                       }
-                       return $this->mUserText;
+               if ( $audience === self::FOR_THIS_USER && !$user ) {
+                       $user = $wgUser;
                }
+
+               $user = $this->mRecord->getUser( $audience, $user );
+               return $user ? $user->getName() : '';
        }
 
        /**
@@ -1103,13 +703,14 @@ class Revision implements IDBAccessObject {
         * @return string
         */
        function getComment( $audience = self::FOR_PUBLIC, User $user = null ) {
-               if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_COMMENT ) ) {
-                       return '';
-               } elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_COMMENT, $user ) ) {
-                       return '';
-               } else {
-                       return $this->mComment;
+               global $wgUser;
+
+               if ( $audience === self::FOR_THIS_USER && !$user ) {
+                       $user = $wgUser;
                }
+
+               $comment = $this->mRecord->getComment( $audience, $user );
+               return $comment === null ? null : $comment->text;
        }
 
        /**
@@ -1127,23 +728,14 @@ class Revision implements IDBAccessObject {
         * @return bool
         */
        public function isMinor() {
-               return (bool)$this->mMinorEdit;
+               return $this->mRecord->isMinor();
        }
 
        /**
         * @return int Rcid of the unpatrolled row, zero if there isn't one
         */
        public function isUnpatrolled() {
-               if ( $this->mUnpatrolled !== null ) {
-                       return $this->mUnpatrolled;
-               }
-               $rc = $this->getRecentChange();
-               if ( $rc && $rc->getAttribute( 'rc_patrolled' ) == 0 ) {
-                       $this->mUnpatrolled = $rc->getAttribute( 'rc_id' );
-               } else {
-                       $this->mUnpatrolled = 0;
-               }
-               return $this->mUnpatrolled;
+               return self::getRevisionStore()->isUnpatrolled( $this->mRecord );
        }
 
        /**
@@ -1156,19 +748,7 @@ class Revision implements IDBAccessObject {
         * @return RecentChange|null
         */
        public function getRecentChange( $flags = 0 ) {
-               $dbr = wfGetDB( DB_REPLICA );
-
-               list( $dbType, ) = DBAccessObjectUtils::getDBOptions( $flags );
-
-               return RecentChange::newFromConds(
-                       [
-                               'rc_user_text' => $this->getUserText( self::RAW ),
-                               'rc_timestamp' => $dbr->timestamp( $this->getTimestamp() ),
-                               'rc_this_oldid' => $this->getId()
-                       ],
-                       __METHOD__,
-                       $dbType
-               );
+               return self::getRevisionStore()->getRecentChange( $this->mRecord, $flags );
        }
 
        /**
@@ -1177,14 +757,7 @@ class Revision implements IDBAccessObject {
         * @return bool
         */
        public function isDeleted( $field ) {
-               if ( $this->isCurrent() && $field === self::DELETED_TEXT ) {
-                       // Current revisions of pages cannot have the content hidden. Skipping this
-                       // check is very useful for Parser as it fetches templates using newKnownCurrent().
-                       // Calling getVisibility() in that case triggers a verification database query.
-                       return false; // no need to check
-               }
-
-               return ( $this->getVisibility() & $field ) == $field;
+               return $this->mRecord->isDeleted( $field );
        }
 
        /**
@@ -1193,19 +766,17 @@ class Revision implements IDBAccessObject {
         * @return int
         */
        public function getVisibility() {
-               $this->loadMutableFields();
-
-               return (int)$this->mDeleted;
+               return $this->mRecord->getVisibility();
        }
 
        /**
         * Fetch revision content if it's available to the specified audience.
         * If the specified audience does not have the ability to view this
-        * revision, null will be returned.
+        * revision, or the content could not be loaded, null will be returned.
         *
         * @param int $audience One of:
         *   Revision::FOR_PUBLIC       to be displayed to all users
-        *   Revision::FOR_THIS_USER    to be displayed to $wgUser
+        *   Revision::FOR_THIS_USER    to be displayed to $user
         *   Revision::RAW              get the text regardless of permissions
         * @param User $user User object to check for, only if FOR_THIS_USER is passed
         *   to the $audience parameter
@@ -1213,12 +784,17 @@ class Revision implements IDBAccessObject {
         * @return Content|null
         */
        public function getContent( $audience = self::FOR_PUBLIC, User $user = null ) {
-               if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_TEXT ) ) {
-                       return null;
-               } elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_TEXT, $user ) ) {
+               global $wgUser;
+
+               if ( $audience === self::FOR_THIS_USER && !$user ) {
+                       $user = $wgUser;
+               }
+
+               try {
+                       return $this->mRecord->getContent( 'main', $audience, $user );
+               }
+               catch ( RevisionAccessException $e ) {
                        return null;
-               } else {
-                       return $this->getContentInternal();
                }
        }
 
@@ -1226,86 +802,51 @@ class Revision implements IDBAccessObject {
         * Get original serialized data (without checking view restrictions)
         *
         * @since 1.21
+        * @deprecated since 1.31, use BlobStore::getBlob instead.
+        *
         * @return string
         */
        public function getSerializedData() {
-               if ( $this->mText === null ) {
-                       // Revision is immutable. Load on demand.
-                       $this->mText = $this->loadText();
-               }
-
-               return $this->mText;
+               $slot = $this->getMainSlotRaw();
+               return $slot->getContent()->serialize();
        }
 
        /**
-        * Gets the content object for the revision (or null on failure).
-        *
-        * Note that for mutable Content objects, each call to this method will return a
-        * fresh clone.
-        *
-        * @since 1.21
-        * @return Content|null The Revision's content, or null on failure.
-        */
-       protected function getContentInternal() {
-               if ( $this->mContent === null ) {
-                       $text = $this->getSerializedData();
-
-                       if ( $text !== null && $text !== false ) {
-                               // Unserialize content
-                               $handler = $this->getContentHandler();
-                               $format = $this->getContentFormat();
-
-                               $this->mContent = $handler->unserializeContent( $text, $format );
-                       }
-               }
-
-               // NOTE: copy() will return $this for immutable content objects
-               return $this->mContent ? $this->mContent->copy() : null;
-       }
-
-       /**
-        * Returns the content model for this revision.
+        * Returns the content model for the main slot of this revision.
         *
         * If no content model was stored in the database, the default content model for the title is
         * used to determine the content model to use. If no title is know, CONTENT_MODEL_WIKITEXT
         * is used as a last resort.
         *
+        * @todo: drop this, with MCR, there no longer is a single model associated with a revision.
+        *
         * @return string The content model id associated with this revision,
         *     see the CONTENT_MODEL_XXX constants.
         */
        public function getContentModel() {
-               if ( !$this->mContentModel ) {
-                       $title = $this->getTitle();
-                       if ( $title ) {
-                               $this->mContentModel = ContentHandler::getDefaultModelFor( $title );
-                       } else {
-                               $this->mContentModel = CONTENT_MODEL_WIKITEXT;
-                       }
-
-                       assert( !empty( $this->mContentModel ) );
-               }
-
-               return $this->mContentModel;
+               return $this->getMainSlotRaw()->getModel();
        }
 
        /**
-        * Returns the content format for this revision.
+        * Returns the content format for the main slot of this revision.
         *
         * If no content format was stored in the database, the default format for this
         * revision's content model is returned.
         *
+        * @todo: drop this, the format is irrelevant to the revision!
+        *
         * @return string The content format id associated with this revision,
         *     see the CONTENT_FORMAT_XXX constants.
         */
        public function getContentFormat() {
-               if ( !$this->mContentFormat ) {
-                       $handler = $this->getContentHandler();
-                       $this->mContentFormat = $handler->getDefaultFormat();
+               $format = $this->getMainSlotRaw()->getFormat();
 
-                       assert( !empty( $this->mContentFormat ) );
+               if ( $format === null ) {
+                       // if no format was stored along with the blob, fall back to default format
+                       $format = $this->getContentHandler()->getDefaultFormat();
                }
 
-               return $this->mContentFormat;
+               return $format;
        }
 
        /**
@@ -1315,33 +856,21 @@ class Revision implements IDBAccessObject {
         * @return ContentHandler
         */
        public function getContentHandler() {
-               if ( !$this->mContentHandler ) {
-                       $model = $this->getContentModel();
-                       $this->mContentHandler = ContentHandler::getForModelID( $model );
-
-                       $format = $this->getContentFormat();
-
-                       if ( !$this->mContentHandler->isSupportedFormat( $format ) ) {
-                               throw new MWException( "Oops, the content format $format is not supported for "
-                                       . "this content model, $model" );
-                       }
-               }
-
-               return $this->mContentHandler;
+               return ContentHandler::getForModelID( $this->getContentModel() );
        }
 
        /**
         * @return string
         */
        public function getTimestamp() {
-               return wfTimestamp( TS_MW, $this->mTimestamp );
+               return $this->mRecord->getTimestamp();
        }
 
        /**
         * @return bool
         */
        public function isCurrent() {
-               return $this->mCurrent;
+               return ( $this->mRecord instanceof RevisionStoreRecord ) && $this->mRecord->isCurrent();
        }
 
        /**
@@ -1350,13 +879,8 @@ class Revision implements IDBAccessObject {
         * @return Revision|null
         */
        public function getPrevious() {
-               if ( $this->getTitle() ) {
-                       $prev = $this->getTitle()->getPreviousRevisionID( $this->getId() );
-                       if ( $prev ) {
-                               return self::newFromTitle( $this->getTitle(), $prev );
-                       }
-               }
-               return null;
+               $rec = self::getRevisionStore()->getPreviousRevision( $this->mRecord );
+               return $rec === null ? null : new Revision( $rec );
        }
 
        /**
@@ -1365,38 +889,8 @@ class Revision implements IDBAccessObject {
         * @return Revision|null
         */
        public function getNext() {
-               if ( $this->getTitle() ) {
-                       $next = $this->getTitle()->getNextRevisionID( $this->getId() );
-                       if ( $next ) {
-                               return self::newFromTitle( $this->getTitle(), $next );
-                       }
-               }
-               return null;
-       }
-
-       /**
-        * Get previous revision Id for this page_id
-        * This is used to populate rev_parent_id on save
-        *
-        * @param IDatabase $db
-        * @return int
-        */
-       private function getPreviousRevisionId( $db ) {
-               if ( $this->mPage === null ) {
-                       return 0;
-               }
-               # Use page_latest if ID is not given
-               if ( !$this->mId ) {
-                       $prevId = $db->selectField( 'page', 'page_latest',
-                               [ 'page_id' => $this->mPage ],
-                               __METHOD__ );
-               } else {
-                       $prevId = $db->selectField( 'revision', 'rev_id',
-                               [ 'rev_page' => $this->mPage, 'rev_id < ' . $this->mId ],
-                               __METHOD__,
-                               [ 'ORDER BY' => 'rev_id DESC' ] );
-               }
-               return intval( $prevId );
+               $rec = self::getRevisionStore()->getNextRevision( $this->mRecord );
+               return $rec === null ? null : new Revision( $rec );
        }
 
        /**
@@ -1429,35 +923,9 @@ class Revision implements IDBAccessObject {
                        return false;
                }
 
-               // Use external methods for external objects, text in table is URL-only then
-               if ( in_array( 'external', $flags ) ) {
-                       $url = $text;
-                       $parts = explode( '://', $url, 2 );
-                       if ( count( $parts ) == 1 || $parts[1] == '' ) {
-                               return false;
-                       }
-
-                       if ( isset( $row->old_id ) && $wiki === false ) {
-                               // Make use of the wiki-local revision text cache
-                               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
-                               // The cached value should be decompressed, so handle that and return here
-                               return $cache->getWithSetCallback(
-                                       $cache->makeKey( 'revisiontext', 'textid', $row->old_id ),
-                                       self::getCacheTTL( $cache ),
-                                       function () use ( $url, $wiki, $flags ) {
-                                               // No negative caching per Revision::loadText()
-                                               $text = ExternalStore::fetchFromURL( $url, [ 'wiki' => $wiki ] );
-
-                                               return self::decompressRevisionText( $text, $flags );
-                                       },
-                                       [ 'pcGroup' => self::TEXT_CACHE_GROUP, 'pcTTL' => $cache::TTL_PROC_LONG ]
-                               );
-                       } else {
-                               $text = ExternalStore::fetchFromURL( $url, [ 'wiki' => $wiki ] );
-                       }
-               }
+               $cacheKey = isset( $row->old_id ) ? ( 'tt:' . $row->old_id ) : null;
 
-               return self::decompressRevisionText( $text, $flags );
+               return self::getBlobStore()->expandBlob( $text, $flags, $cacheKey );
        }
 
        /**
@@ -1471,28 +939,7 @@ class Revision implements IDBAccessObject {
         * @return string
         */
        public static function compressRevisionText( &$text ) {
-               global $wgCompressRevisions;
-               $flags = [];
-
-               # Revisions not marked this way will be converted
-               # on load if $wgLegacyCharset is set in the future.
-               $flags[] = 'utf-8';
-
-               if ( $wgCompressRevisions ) {
-                       if ( function_exists( 'gzdeflate' ) ) {
-                               $deflated = gzdeflate( $text );
-
-                               if ( $deflated === false ) {
-                                       wfLogWarning( __METHOD__ . ': gzdeflate() failed' );
-                               } else {
-                                       $text = $deflated;
-                                       $flags[] = 'gzip';
-                               }
-                       } else {
-                               wfDebug( __METHOD__ . " -- no zlib support, not compressing\n" );
-                       }
-               }
-               return implode( ',', $flags );
+               return self::getBlobStore()->compressData( $text );
        }
 
        /**
@@ -1503,46 +950,7 @@ class Revision implements IDBAccessObject {
         * @return string|bool Decompressed text, or false on failure
         */
        public static function decompressRevisionText( $text, $flags ) {
-               global $wgLegacyEncoding, $wgContLang;
-
-               if ( $text === false ) {
-                       // Text failed to be fetched; nothing to do
-                       return false;
-               }
-
-               if ( in_array( 'gzip', $flags ) ) {
-                       # Deal with optional compression of archived pages.
-                       # This can be done periodically via maintenance/compressOld.php, and
-                       # as pages are saved if $wgCompressRevisions is set.
-                       $text = gzinflate( $text );
-
-                       if ( $text === false ) {
-                               wfLogWarning( __METHOD__ . ': gzinflate() failed' );
-                               return false;
-                       }
-               }
-
-               if ( in_array( 'object', $flags ) ) {
-                       # Generic compressed storage
-                       $obj = unserialize( $text );
-                       if ( !is_object( $obj ) ) {
-                               // Invalid object
-                               return false;
-                       }
-                       $text = $obj->getText();
-               }
-
-               if ( $text !== false && $wgLegacyEncoding
-                       && !in_array( 'utf-8', $flags ) && !in_array( 'utf8', $flags )
-               ) {
-                       # Old revisions kept around in a legacy encoding?
-                       # Upconvert on demand.
-                       # ("utf8" checked for compatibility with some broken
-                       #  conversion scripts 2008-12-30)
-                       $text = $wgContLang->iconv( $wgLegacyEncoding, 'UTF-8', $text );
-               }
-
-               return $text;
+               return self::getBlobStore()->decompressData( $text, $flags );
        }
 
        /**
@@ -1554,192 +962,27 @@ class Revision implements IDBAccessObject {
         * @return int The revision ID
         */
        public function insertOn( $dbw ) {
-               global $wgDefaultExternalStore, $wgContentHandlerUseDB;
-
-               // We're inserting a new revision, so we have to use master anyway.
-               // If it's a null revision, it may have references to rows that
-               // are not in the replica yet (the text row).
-               $this->mQueryFlags |= self::READ_LATEST;
-
-               // Not allowed to have rev_page equal to 0, false, etc.
-               if ( !$this->mPage ) {
-                       $title = $this->getTitle();
-                       if ( $title instanceof Title ) {
-                               $titleText = ' for page ' . $title->getPrefixedText();
-                       } else {
-                               $titleText = '';
-                       }
-                       throw new MWException( "Cannot insert revision$titleText: page ID must be nonzero" );
-               }
+               global $wgUser;
 
-               $this->checkContentModel();
+               // Note that $this->mRecord->getId() will typically return null here, but not always,
+               // e.g. not when restoring a revision.
 
-               $data = $this->mText;
-               $flags = self::compressRevisionText( $data );
-
-               # Write to external storage if required
-               if ( $wgDefaultExternalStore ) {
-                       // Store and get the URL
-                       $data = ExternalStore::insertToDefault( $data );
-                       if ( !$data ) {
-                               throw new MWException( "Unable to store text to external storage" );
-                       }
-                       if ( $flags ) {
-                               $flags .= ',';
-                       }
-                       $flags .= 'external';
-               }
-
-               # Record the text (or external storage URL) to the text table
-               if ( $this->mTextId === null ) {
-                       $dbw->insert( 'text',
-                               [
-                                       'old_text' => $data,
-                                       'old_flags' => $flags,
-                               ], __METHOD__
-                       );
-                       $this->mTextId = $dbw->insertId();
-               }
-
-               if ( $this->mComment === null ) {
-                       $this->mComment = "";
-               }
-
-               # Record the edit in revisions
-               $row = [
-                       'rev_page'       => $this->mPage,
-                       'rev_text_id'    => $this->mTextId,
-                       'rev_minor_edit' => $this->mMinorEdit ? 1 : 0,
-                       'rev_user'       => $this->mUser,
-                       'rev_user_text'  => $this->mUserText,
-                       'rev_timestamp'  => $dbw->timestamp( $this->mTimestamp ),
-                       'rev_deleted'    => $this->mDeleted,
-                       'rev_len'        => $this->mSize,
-                       'rev_parent_id'  => $this->mParentId === null
-                               ? $this->getPreviousRevisionId( $dbw )
-                               : $this->mParentId,
-                       'rev_sha1'       => $this->mSha1 === null
-                               ? self::base36Sha1( $this->mText )
-                               : $this->mSha1,
-               ];
-               if ( $this->mId !== null ) {
-                       $row['rev_id'] = $this->mId;
-               }
-
-               list( $commentFields, $commentCallback ) =
-                       CommentStore::newKey( 'rev_comment' )->insertWithTempTable( $dbw, $this->mComment );
-               $row += $commentFields;
-
-               if ( $wgContentHandlerUseDB ) {
-                       // NOTE: Store null for the default model and format, to save space.
-                       // XXX: Makes the DB sensitive to changed defaults.
-                       // Make this behavior optional? Only in miser mode?
-
-                       $model = $this->getContentModel();
-                       $format = $this->getContentFormat();
-
-                       $title = $this->getTitle();
-
-                       if ( $title === null ) {
-                               throw new MWException( "Insufficient information to determine the title of the "
-                                       . "revision's page!" );
+               if ( $this->mRecord->getUser( RevisionRecord::RAW ) === null ) {
+                       if ( $this->mRecord instanceof MutableRevisionRecord ) {
+                               $this->mRecord->setUser( $wgUser );
+                       } else {
+                               throw new MWException( 'Cannot insert revision with no associated user.' );
                        }
-
-                       $defaultModel = ContentHandler::getDefaultModelFor( $title );
-                       $defaultFormat = ContentHandler::getForModelID( $defaultModel )->getDefaultFormat();
-
-                       $row['rev_content_model'] = ( $model === $defaultModel ) ? null : $model;
-                       $row['rev_content_format'] = ( $format === $defaultFormat ) ? null : $format;
                }
 
-               $dbw->insert( 'revision', $row, __METHOD__ );
+               $rec = self::getRevisionStore()->insertRevisionOn( $this->mRecord, $dbw );
 
-               if ( $this->mId === null ) {
-                       // Only if auto-increment was used
-                       $this->mId = $dbw->insertId();
-               }
-               $commentCallback( $this->mId );
+               $this->mRecord = $rec;
 
-               // Assertion to try to catch T92046
-               if ( (int)$this->mId === 0 ) {
-                       throw new UnexpectedValueException(
-                               'After insert, Revision mId is ' . var_export( $this->mId, 1 ) . ': ' .
-                                       var_export( $row, 1 )
-                       );
-               }
+               // TODO: hard-deprecate in 1.32 (or even 1.31?)
+               Hooks::run( 'RevisionInsertComplete', [ $this, null, null ] );
 
-               // Insert IP revision into ip_changes for use when querying for a range.
-               if ( $this->mUser === 0 && IP::isValid( $this->mUserText ) ) {
-                       $ipcRow = [
-                               'ipc_rev_id'        => $this->mId,
-                               'ipc_rev_timestamp' => $row['rev_timestamp'],
-                               'ipc_hex'           => IP::toHex( $row['rev_user_text'] ),
-                       ];
-                       $dbw->insert( 'ip_changes', $ipcRow, __METHOD__ );
-               }
-
-               // Avoid PHP 7.1 warning of passing $this by reference
-               $revision = $this;
-               Hooks::run( 'RevisionInsertComplete', [ &$revision, $data, $flags ] );
-
-               return $this->mId;
-       }
-
-       protected function checkContentModel() {
-               global $wgContentHandlerUseDB;
-
-               // Note: may return null for revisions that have not yet been inserted
-               $title = $this->getTitle();
-
-               $model = $this->getContentModel();
-               $format = $this->getContentFormat();
-               $handler = $this->getContentHandler();
-
-               if ( !$handler->isSupportedFormat( $format ) ) {
-                       $t = $title->getPrefixedDBkey();
-
-                       throw new MWException( "Can't use format $format with content model $model on $t" );
-               }
-
-               if ( !$wgContentHandlerUseDB && $title ) {
-                       // if $wgContentHandlerUseDB is not set,
-                       // all revisions must use the default content model and format.
-
-                       $defaultModel = ContentHandler::getDefaultModelFor( $title );
-                       $defaultHandler = ContentHandler::getForModelID( $defaultModel );
-                       $defaultFormat = $defaultHandler->getDefaultFormat();
-
-                       if ( $this->getContentModel() != $defaultModel ) {
-                               $t = $title->getPrefixedDBkey();
-
-                               throw new MWException( "Can't save non-default content model with "
-                                       . "\$wgContentHandlerUseDB disabled: model is $model, "
-                                       . "default for $t is $defaultModel" );
-                       }
-
-                       if ( $this->getContentFormat() != $defaultFormat ) {
-                               $t = $title->getPrefixedDBkey();
-
-                               throw new MWException( "Can't use non-default content format with "
-                                       . "\$wgContentHandlerUseDB disabled: format is $format, "
-                                       . "default for $t is $defaultFormat" );
-                       }
-               }
-
-               $content = $this->getContent( self::RAW );
-               $prefixedDBkey = $title->getPrefixedDBkey();
-               $revId = $this->mId;
-
-               if ( !$content ) {
-                       throw new MWException(
-                               "Content of revision $revId ($prefixedDBkey) could not be loaded for validation!"
-                       );
-               }
-               if ( !$content->isValid() ) {
-                       throw new MWException(
-                               "Content of revision $revId ($prefixedDBkey) is not valid! Content model is $model"
-                       );
-               }
+               return $rec->getId();
        }
 
        /**
@@ -1748,103 +991,7 @@ class Revision implements IDBAccessObject {
         * @return string
         */
        public static function base36Sha1( $text ) {
-               return Wikimedia\base_convert( sha1( $text ), 16, 36, 31 );
-       }
-
-       /**
-        * Get the text cache TTL
-        *
-        * @param WANObjectCache $cache
-        * @return int
-        */
-       private static function getCacheTTL( WANObjectCache $cache ) {
-               global $wgRevisionCacheExpiry;
-
-               if ( $cache->getQoS( $cache::ATTR_EMULATION ) <= $cache::QOS_EMULATION_SQL ) {
-                       // Do not cache RDBMs blobs in...the RDBMs store
-                       $ttl = $cache::TTL_UNCACHEABLE;
-               } else {
-                       $ttl = $wgRevisionCacheExpiry ?: $cache::TTL_UNCACHEABLE;
-               }
-
-               return $ttl;
-       }
-
-       /**
-        * Lazy-load the revision's text.
-        * Currently hardcoded to the 'text' table storage engine.
-        *
-        * @return string|bool The revision's text, or false on failure
-        */
-       private function loadText() {
-               $cache = ObjectCache::getMainWANInstance();
-
-               // No negative caching; negative hits on text rows may be due to corrupted replica DBs
-               return $cache->getWithSetCallback(
-                       $cache->makeKey( 'revisiontext', 'textid', $this->getTextId() ),
-                       self::getCacheTTL( $cache ),
-                       function () {
-                               return $this->fetchText();
-                       },
-                       [ 'pcGroup' => self::TEXT_CACHE_GROUP, 'pcTTL' => $cache::TTL_PROC_LONG ]
-               );
-       }
-
-       private function fetchText() {
-               $textId = $this->getTextId();
-
-               // If we kept data for lazy extraction, use it now...
-               if ( $this->mTextRow !== null ) {
-                       $row = $this->mTextRow;
-                       $this->mTextRow = null;
-               } else {
-                       $row = null;
-               }
-
-               // Callers doing updates will pass in READ_LATEST as usual. Since the text/blob tables
-               // do not normally get rows changed around, set READ_LATEST_IMMUTABLE in those cases.
-               $flags = $this->mQueryFlags;
-               $flags |= DBAccessObjectUtils::hasFlags( $flags, self::READ_LATEST )
-                       ? self::READ_LATEST_IMMUTABLE
-                       : 0;
-
-               list( $index, $options, $fallbackIndex, $fallbackOptions ) =
-                       DBAccessObjectUtils::getDBOptions( $flags );
-
-               if ( !$row ) {
-                       // Text data is immutable; check replica DBs first.
-                       $row = wfGetDB( $index )->selectRow(
-                               'text',
-                               [ 'old_text', 'old_flags' ],
-                               [ 'old_id' => $textId ],
-                               __METHOD__,
-                               $options
-                       );
-               }
-
-               // Fallback to DB_MASTER in some cases if the row was not found
-               if ( !$row && $fallbackIndex !== null ) {
-                       // Use FOR UPDATE if it was used to fetch this revision. This avoids missing the row
-                       // due to REPEATABLE-READ. Also fallback to the master if READ_LATEST is provided.
-                       $row = wfGetDB( $fallbackIndex )->selectRow(
-                               'text',
-                               [ 'old_text', 'old_flags' ],
-                               [ 'old_id' => $textId ],
-                               __METHOD__,
-                               $fallbackOptions
-                       );
-               }
-
-               if ( !$row ) {
-                       wfDebugLog( 'Revision', "No text row with ID '$textId' (revision {$this->getId()})." );
-               }
-
-               $text = self::getRevisionText( $row );
-               if ( $row && $text === false ) {
-                       wfDebugLog( 'Revision', "No blob for text row '$textId' (revision {$this->getId()})." );
-               }
-
-               return is_string( $text ) ? $text : false;
+               return SlotRecord::base36Sha1( $text );
        }
 
        /**
@@ -1863,58 +1010,17 @@ class Revision implements IDBAccessObject {
         * @return Revision|null Revision or null on error
         */
        public static function newNullRevision( $dbw, $pageId, $summary, $minor, $user = null ) {
-               global $wgContentHandlerUseDB;
-
-               $fields = [ 'page_latest', 'page_namespace', 'page_title',
-                                               'rev_text_id', 'rev_len', 'rev_sha1' ];
-
-               if ( $wgContentHandlerUseDB ) {
-                       $fields[] = 'rev_content_model';
-                       $fields[] = 'rev_content_format';
+               global $wgUser;
+               if ( !$user ) {
+                       $user = $wgUser;
                }
 
-               $current = $dbw->selectRow(
-                       [ 'page', 'revision' ],
-                       $fields,
-                       [
-                               'page_id' => $pageId,
-                               'page_latest=rev_id',
-                       ],
-                       __METHOD__,
-                       [ 'FOR UPDATE' ] // T51581
-               );
-
-               if ( $current ) {
-                       if ( !$user ) {
-                               global $wgUser;
-                               $user = $wgUser;
-                       }
-
-                       $row = [
-                               'page'       => $pageId,
-                               'user_text'  => $user->getName(),
-                               'user'       => $user->getId(),
-                               'comment'    => $summary,
-                               'minor_edit' => $minor,
-                               'text_id'    => $current->rev_text_id,
-                               'parent_id'  => $current->page_latest,
-                               'len'        => $current->rev_len,
-                               'sha1'       => $current->rev_sha1
-                       ];
-
-                       if ( $wgContentHandlerUseDB ) {
-                               $row['content_model'] = $current->rev_content_model;
-                               $row['content_format'] = $current->rev_content_format;
-                       }
-
-                       $row['title'] = Title::makeTitle( $current->page_namespace, $current->page_title );
+               $comment = CommentStoreComment::newUnsavedComment( $summary, null );
 
-                       $revision = new Revision( $row );
-               } else {
-                       $revision = null;
-               }
+               $title = Title::newFromID( $pageId );
+               $rec = self::getRevisionStore()->newNullRevision( $dbw, $title, $comment, $minor, $user );
 
-               return $revision;
+               return new Revision( $rec );
        }
 
        /**
@@ -1948,35 +1054,13 @@ class Revision implements IDBAccessObject {
        public static function userCanBitfield( $bitfield, $field, User $user = null,
                Title $title = null
        ) {
-               if ( $bitfield & $field ) { // aspect is deleted
-                       if ( $user === null ) {
-                               global $wgUser;
-                               $user = $wgUser;
-                       }
-                       if ( $bitfield & self::DELETED_RESTRICTED ) {
-                               $permissions = [ 'suppressrevision', 'viewsuppressed' ];
-                       } elseif ( $field & self::DELETED_TEXT ) {
-                               $permissions = [ 'deletedtext' ];
-                       } else {
-                               $permissions = [ 'deletedhistory' ];
-                       }
-                       $permissionlist = implode( ', ', $permissions );
-                       if ( $title === null ) {
-                               wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" );
-                               return call_user_func_array( [ $user, 'isAllowedAny' ], $permissions );
-                       } else {
-                               $text = $title->getPrefixedText();
-                               wfDebug( "Checking for $permissionlist on $text due to $field match on $bitfield\n" );
-                               foreach ( $permissions as $perm ) {
-                                       if ( $title->userCan( $perm, $user ) ) {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               } else {
-                       return true;
+               global $wgUser;
+
+               if ( !$user ) {
+                       $user = $wgUser;
                }
+
+               return RevisionRecord::userCanBitfield( $bitfield, $field, $user, $title );
        }
 
        /**
@@ -1988,18 +1072,7 @@ class Revision implements IDBAccessObject {
         * @return string|bool False if not found
         */
        static function getTimestampFromId( $title, $id, $flags = 0 ) {
-               $db = ( $flags & self::READ_LATEST )
-                       ? wfGetDB( DB_MASTER )
-                       : wfGetDB( DB_REPLICA );
-               // Casting fix for databases that can't take '' for rev_id
-               if ( $id == '' ) {
-                       $id = 0;
-               }
-               $conds = [ 'rev_id' => $id ];
-               $conds['rev_page'] = $title->getArticleID();
-               $timestamp = $db->selectField( 'revision', 'rev_timestamp', $conds, __METHOD__ );
-
-               return ( $timestamp !== false ) ? wfTimestamp( TS_MW, $timestamp ) : false;
+               return self::getRevisionStore()->getTimestampFromId( $title, $id, $flags );
        }
 
        /**
@@ -2010,12 +1083,7 @@ class Revision implements IDBAccessObject {
         * @return int
         */
        static function countByPageId( $db, $id ) {
-               $row = $db->selectRow( 'revision', [ 'revCount' => 'COUNT(*)' ],
-                       [ 'rev_page' => $id ], __METHOD__ );
-               if ( $row ) {
-                       return $row->revCount;
-               }
-               return 0;
+               return self::getRevisionStore()->countRevisionsByPageId( $db, $id );
        }
 
        /**
@@ -2026,11 +1094,7 @@ class Revision implements IDBAccessObject {
         * @return int
         */
        static function countByTitle( $db, $title ) {
-               $id = $title->getArticleID();
-               if ( $id ) {
-                       return self::countByPageId( $db, $id );
-               }
-               return 0;
+               return self::getRevisionStore()->countRevisionsByTitle( $db, $title );
        }
 
        /**
@@ -2050,28 +1114,11 @@ class Revision implements IDBAccessObject {
         * @return bool True if the given user was the only one to edit since the given timestamp
         */
        public static function userWasLastToEdit( $db, $pageId, $userId, $since ) {
-               if ( !$userId ) {
-                       return false;
-               }
-
                if ( is_int( $db ) ) {
                        $db = wfGetDB( $db );
                }
 
-               $res = $db->select( 'revision',
-                       'rev_user',
-                       [
-                               'rev_page' => $pageId,
-                               'rev_timestamp > ' . $db->addQuotes( $db->timestamp( $since ) )
-                       ],
-                       __METHOD__,
-                       [ 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 50 ] );
-               foreach ( $res as $row ) {
-                       if ( $row->rev_user != $userId ) {
-                               return false;
-                       }
-               }
-               return true;
+               return self::getRevisionStore()->userWasLastToEdit( $db, $pageId, $userId, $since );
        }
 
        /**
@@ -2079,54 +1126,20 @@ class Revision implements IDBAccessObject {
         *
         * This method allows for the use of caching, though accessing anything that normally
         * requires permission checks (aside from the text) will trigger a small DB lookup.
-        * The title will also be lazy loaded, though setTitle() can be used to preload it.
+        * The title will also be loaded if $pageIdOrTitle is an integer ID.
         *
-        * @param IDatabase $db
-        * @param int $pageId Page ID
-        * @param int $revId Known current revision of this page
+        * @param IDatabase $db ignored!
+        * @param int|Title $pageIdOrTitle Page ID or Title object
+        * @param int $revId Known current revision of this page. Determined automatically if not given.
         * @return Revision|bool Returns false if missing
         * @since 1.28
         */
-       public static function newKnownCurrent( IDatabase $db, $pageId, $revId ) {
-               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
-               return $cache->getWithSetCallback(
-                       // Page/rev IDs passed in from DB to reflect history merges
-                       $cache->makeGlobalKey( 'revision', $db->getDomainID(), $pageId, $revId ),
-                       $cache::TTL_WEEK,
-                       function ( $curValue, &$ttl, array &$setOpts ) use ( $db, $pageId, $revId ) {
-                               $setOpts += Database::getCacheSetOptions( $db );
-
-                               $rev = Revision::loadFromPageId( $db, $pageId, $revId );
-                               // Reflect revision deletion and user renames
-                               if ( $rev ) {
-                                       $rev->mTitle = null; // mutable; lazy-load
-                                       $rev->mRefreshMutableFields = true;
-                               }
-
-                               return $rev ?: false; // don't cache negatives
-                       }
-               );
-       }
-
-       /**
-        * For cached revisions, make sure the user name and rev_deleted is up-to-date
-        */
-       private function loadMutableFields() {
-               if ( !$this->mRefreshMutableFields ) {
-                       return; // not needed
-               }
+       public static function newKnownCurrent( IDatabase $db, $pageIdOrTitle, $revId = 0 ) {
+               $title = $pageIdOrTitle instanceof Title
+                       ? $pageIdOrTitle
+                       : Title::newFromID( $pageIdOrTitle );
 
-               $this->mRefreshMutableFields = false;
-               $dbr = wfGetLB( $this->mWiki )->getConnectionRef( DB_REPLICA, [], $this->mWiki );
-               $row = $dbr->selectRow(
-                       [ 'revision', 'user' ],
-                       [ 'rev_deleted', 'user_name' ],
-                       [ 'rev_id' => $this->mId, 'user_id = rev_user' ],
-                       __METHOD__
-               );
-               if ( $row ) { // update values
-                       $this->mDeleted = (int)$row->rev_deleted;
-                       $this->mUserText = $row->user_name;
-               }
+               $record = self::getRevisionStore()->getKnownCurrentRevision( $title, $revId );
+               return $record ? new Revision( $record ) : false;
        }
 }
index dad0630..575970d 100644 (file)
@@ -42,6 +42,8 @@ use MediaWiki\Linker\LinkRendererFactory;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\MediaWikiServices;
 use MediaWiki\Shell\CommandFactory;
+use MediaWiki\Storage\RevisionStore;
+use MediaWiki\Storage\SqlBlobStore;
 
 return [
        'DBLoadBalancerFactory' => function ( MediaWikiServices $services ) {
@@ -448,6 +450,46 @@ return [
                return $factory;
        },
 
+       'RevisionStore' => function ( MediaWikiServices $services ) {
+               /** @var SqlBlobStore $blobStore */
+               $blobStore = $services->getService( '_SqlBlobStore' );
+
+               $store = new RevisionStore(
+                       $services->getDBLoadBalancer(),
+                       $blobStore,
+                       $services->getMainWANObjectCache()
+               );
+
+               $config = $services->getMainConfig();
+               $store->setContentHandlerUseDB( $config->get( 'ContentHandlerUseDB' ) );
+
+               return $store;
+       },
+
+       'BlobStore' => function ( MediaWikiServices $services ) {
+               return $services->getService( '_SqlBlobStore' );
+       },
+
+       '_SqlBlobStore' => function ( MediaWikiServices $services ) {
+               global $wgContLang; // TODO: manage $wgContLang as a service
+
+               $store = new SqlBlobStore(
+                       $services->getDBLoadBalancer(),
+                       $services->getMainWANObjectCache()
+               );
+
+               $config = $services->getMainConfig();
+               $store->setCompressRevisions( $config->get( 'CompressRevisions' ) );
+               $store->setCacheExpiry( $config->get( 'RevisionCacheExpiry' ) );
+               $store->setUseExternalStore( $config->get( 'DefaultExternalStore' ) !== false );
+
+               if ( $config->get( 'LegacyEncoding' ) ) {
+                       $store->setLegacyEncoding( $config->get( 'LegacyEncoding' ), $wgContLang );
+               }
+
+               return $store;
+       },
+
        'ExternalStoreFactory' => function ( MediaWikiServices $services ) {
                $config = $services->getMainConfig();
 
@@ -456,6 +498,46 @@ return [
                );
        },
 
+       'RevisionStore' => function ( MediaWikiServices $services ) {
+               /** @var SqlBlobStore $blobStore */
+               $blobStore = $services->getService( '_SqlBlobStore' );
+
+               $store = new RevisionStore(
+                       $services->getDBLoadBalancer(),
+                       $blobStore,
+                       $services->getMainWANObjectCache()
+               );
+
+               $config = $services->getMainConfig();
+               $store->setContentHandlerUseDB( $config->get( 'ContentHandlerUseDB' ) );
+
+               return $store;
+       },
+
+       'BlobStore' => function ( MediaWikiServices $services ) {
+               return $services->getService( '_SqlBlobStore' );
+       },
+
+       '_SqlBlobStore' => function ( MediaWikiServices $services ) {
+               global $wgContLang; // TODO: manage $wgContLang as a service
+
+               $store = new SqlBlobStore(
+                       $services->getDBLoadBalancer(),
+                       $services->getMainWANObjectCache()
+               );
+
+               $config = $services->getMainConfig();
+               $store->setCompressBlobs( $config->get( 'CompressRevisions' ) );
+               $store->setCacheExpiry( $config->get( 'RevisionCacheExpiry' ) );
+               $store->setUseExternalStore( $config->get( 'DefaultExternalStore' ) !== false );
+
+               if ( $config->get( 'LegacyEncoding' ) ) {
+                       $store->setLegacyEncoding( $config->get( 'LegacyEncoding' ), $wgContLang );
+               }
+
+               return $store;
+       },
+
        ///////////////////////////////////////////////////////////////////////////
        // NOTE: When adding a service here, don't forget to add a getter function
        // in the MediaWikiServices class. The convenience getter should just call
diff --git a/includes/Storage/BlobAccessException.php b/includes/Storage/BlobAccessException.php
new file mode 100644 (file)
index 0000000..ffc5eca
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Exception representing a failure to look up a revision.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use RuntimeException;
+
+/**
+ * Exception representing a failure to access a data blob.
+ *
+ * @since 1.31
+ */
+class BlobAccessException extends RuntimeException {
+
+}
diff --git a/includes/Storage/BlobStore.php b/includes/Storage/BlobStore.php
new file mode 100644 (file)
index 0000000..28caf3a
--- /dev/null
@@ -0,0 +1,113 @@
+<?php
+/**
+ * Service for loading and storing data blobs.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+/**
+ * Service for loading and storing data blobs.
+ *
+ * @note This was written to act as a drop-in replacement for the corresponding
+ *       static methods in Revision.
+ *
+ * @since 1.31
+ */
+interface BlobStore {
+
+       /**
+        * Hint key for use with storeBlob, indicating the general role the block
+        * takes in the application. For instance, it should be "page-content" if
+        * the blob represents a Content object.
+        */
+       const DESIGNATION_HINT = 'designation';
+
+       /**
+        * Hint key for use with storeBlob, indicating the page the blob is associated with.
+        * This may be used for sharding.
+        */
+       const PAGE_HINT = 'page_id';
+
+       /**
+        * Hint key for use with storeBlob, indicating the slot the blob is associated with.
+        * May be relevant for reference counting.
+        */
+       const ROLE_HINT = 'role_name';
+
+       /**
+        * Hint key for use with storeBlob, indicating the revision the blob is associated with.
+        * This may be used for differential storage and reference counting.
+        */
+       const REVISION_HINT = 'rev_id';
+
+       /**
+        * Hint key for use with storeBlob, indicating the parent revision of the revision
+        * the blob is associated with. This may be used for differential storage.
+        */
+       const PARENT_HINT = 'rev_parent_id';
+
+       /**
+        * Hint key for use with storeBlob, providing the SHA1 hash of the blob as passed to the
+        * method. This can be used to avoid re-calculating the hash if it is needed by the BlobStore.
+        */
+       const SHA1_HINT = 'cont_sha1';
+
+       /**
+        * Hint key for use with storeBlob, indicating the model of the content encoded in the
+        * given blob. May be used to implement optimized storage for some well known models.
+        */
+       const MODEL_HINT = 'cont_model';
+
+       /**
+        * Hint key for use with storeBlob, indicating the serialization format used to create
+        * the blob, as a MIME type. May be used for optimized storage in the underlying database.
+        */
+       const FORMAT_HINT = 'cont_format';
+
+       /**
+        * Retrieve a blob, given an address.
+        *
+        * MCR migration note: this replaces Revision::loadText
+        *
+        * @param string $blobAddress The blob address as returned by storeBlob(),
+        *        such as "tt:12345" or "ex:DB://s16/456/9876".
+        * @param int $queryFlags See IDBAccessObject.
+        *
+        * @throws BlobAccessException
+        * @return string binary blob data
+        */
+       public function getBlob( $blobAddress, $queryFlags = 0 );
+
+       /**
+        * Stores an arbitrary blob of data and returns an address that can be used with
+        * getBlob() to retrieve the same blob of data,
+        *
+        * @param string $data raw binary data
+        * @param array $hints An array of hints. Implementations may use the hints to optimize storage.
+        * All hints are optional, supported hints depend on the implementation. Hint names by
+        * convention correspond to the names of fields in the database. Callers are encouraged to
+        * provide the well known hints as defined by the XXX_HINT constants.
+        *
+        * @throws BlobAccessException
+        * @return string an address that can be used with getBlob() to retrieve the data.
+        */
+       public function storeBlob( $data, $hints = [] );
+
+}
diff --git a/includes/Storage/IncompleteRevisionException.php b/includes/Storage/IncompleteRevisionException.php
new file mode 100644 (file)
index 0000000..bf45b01
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Exception representing a failure to look up a revision.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+/**
+ * Exception throw when trying to access undefined fields on an incomplete RevisionRecord.
+ *
+ * @since 1.31
+ */
+class IncompleteRevisionException extends RevisionAccessException {
+
+}
diff --git a/includes/Storage/MutableRevisionRecord.php b/includes/Storage/MutableRevisionRecord.php
new file mode 100644 (file)
index 0000000..a259ae0
--- /dev/null
@@ -0,0 +1,328 @@
+<?php
+/**
+ * Mutable RevisionRecord implementation, for building new revision entries programmatically.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use CommentStoreComment;
+use Content;
+use InvalidArgumentException;
+use MediaWiki\User\UserIdentity;
+use MWException;
+use Title;
+use Wikimedia\Assert\Assert;
+
+/**
+ * Mutable RevisionRecord implementation, for building new revision entries programmatically.
+ * Provides setters for all fields.
+ *
+ * @since 1.31
+ */
+class MutableRevisionRecord extends RevisionRecord {
+
+       /**
+        * Returns an incomplete MutableRevisionRecord which uses $parent as its
+        * parent revision, and inherits all slots form it. If saved unchanged,
+        * the new revision will act as a null-revision.
+        *
+        * @param RevisionRecord $parent
+        * @param CommentStoreComment $comment
+        * @param UserIdentity $user
+        * @param string $timestamp
+        *
+        * @return MutableRevisionRecord
+        */
+       public static function newFromParentRevision(
+               RevisionRecord $parent,
+               CommentStoreComment $comment,
+               UserIdentity $user,
+               $timestamp
+       ) {
+               // TODO: ideally, we wouldn't need a Title here
+               $title = Title::newFromLinkTarget( $parent->getPageAsLinkTarget() );
+               $rev = new MutableRevisionRecord( $title, $parent->getWikiId() );
+
+               $rev->setComment( $comment );
+               $rev->setUser( $user );
+               $rev->setTimestamp( $timestamp );
+
+               foreach ( $parent->getSlotRoles() as $role ) {
+                       $slot = $parent->getSlot( $role, self::RAW );
+                       $rev->inheritSlot( $slot );
+               }
+
+               $rev->setPageId( $parent->getPageId() );
+               $rev->setParentId( $parent->getId() );
+
+               return $rev;
+       }
+
+       /**
+        * @note Avoid calling this constructor directly. Use the appropriate methods
+        * in RevisionStore instead.
+        *
+        * @param Title $title The title of the page this Revision is associated with.
+        * @param bool|string $wikiId the wiki ID of the site this Revision belongs to,
+        *        or false for the local site.
+        *
+        * @throws MWException
+        */
+       function __construct( Title $title, $wikiId = false ) {
+               $slots = new MutableRevisionSlots();
+
+               parent::__construct( $title, $slots, $wikiId );
+
+               $this->mSlots = $slots; // redundant, but nice for static analysis
+       }
+
+       /**
+        * @param int $parentId
+        */
+       public function setParentId( $parentId ) {
+               Assert::parameterType( 'integer', $parentId, '$parentId' );
+
+               $this->mParentId = $parentId;
+       }
+
+       /**
+        * Sets the given slot. If a slot with the same role is already present in the revision,
+        * it is replaced.
+        *
+        * @note This can only be used with a fresh "unattached" SlotRecord. Calling code that has a
+        * SlotRecord from another revision should use inheritSlot(). Calling code that has access to
+        * a Content object can use setContent().
+        *
+        * @note This may cause the slot meta-data for the revision to be lazy-loaded.
+        *
+        * @note Calling this method will cause the revision size and hash to be re-calculated upon
+        *       the next call to getSize() and getSha1(), respectively.
+        *
+        * @param SlotRecord $slot
+        */
+       public function setSlot( SlotRecord $slot ) {
+               if ( $slot->hasRevision() && $slot->getRevision() !== $this->getId() ) {
+                       throw new InvalidArgumentException(
+                               'The given slot must be an unsaved, unattached one. '
+                               . 'This slot is already attached to revision ' . $slot->getRevision() . '. '
+                               . 'Use inheritSlot() instead to preserve a slot from a previous revision.'
+                       );
+               }
+
+               $this->mSlots->setSlot( $slot );
+               $this->resetAggregateValues();
+       }
+
+       /**
+        * "Inherits" the given slot's content.
+        *
+        * If a slot with the same role is already present in the revision, it is replaced.
+        *
+        * @note This may cause the slot meta-data for the revision to be lazy-loaded.
+        *
+        * @param SlotRecord $parentSlot
+        */
+       public function inheritSlot( SlotRecord $parentSlot ) {
+               $slot = SlotRecord::newInherited( $parentSlot );
+               $this->setSlot( $slot );
+       }
+
+       /**
+        * Sets the content for the slot with the given role.
+        *
+        * If a slot with the same role is already present in the revision, it is replaced.
+        * Calling code that has access to a SlotRecord can use inheritSlot() instead.
+        *
+        * @note This may cause the slot meta-data for the revision to be lazy-loaded.
+        *
+        * @note Calling this method will cause the revision size and hash to be re-calculated upon
+        *       the next call to getSize() and getSha1(), respectively.
+        *
+        * @param string $role
+        * @param Content $content
+        */
+       public function setContent( $role, Content $content ) {
+               $this->mSlots->setContent( $role, $content );
+               $this->resetAggregateValues();
+       }
+
+       /**
+        * Removes the slot with the given role from this revision.
+        * This effectively ends the "stream" with that role on the revision's page.
+        * Future revisions will no longer inherit this slot, unless it is added back explicitly.
+        *
+        * @note This may cause the slot meta-data for the revision to be lazy-loaded.
+        *
+        * @note Calling this method will cause the revision size and hash to be re-calculated upon
+        *       the next call to getSize() and getSha1(), respectively.
+        *
+        * @param string $role
+        */
+       public function removeSlot( $role ) {
+               $this->mSlots->removeSlot( $role );
+               $this->resetAggregateValues();
+       }
+
+       /**
+        * @param CommentStoreComment $comment
+        */
+       public function setComment( CommentStoreComment $comment ) {
+               $this->mComment = $comment;
+       }
+
+       /**
+        * Set revision hash, for optimization. Prevents getSha1() from re-calculating the hash.
+        *
+        * @note This should only be used if the calling code is sure that the given hash is correct
+        * for the revision's content, and there is no chance of the content being manipulated
+        * later. When in doubt, this method should not be called.
+        *
+        * @param string $sha1 SHA1 hash as a base36 string.
+        */
+       public function setSha1( $sha1 ) {
+               Assert::parameterType( 'string', $sha1, '$sha1' );
+
+               $this->mSha1 = $sha1;
+       }
+
+       /**
+        * Set nominal revision size, for optimization. Prevents getSize() from re-calculating the size.
+        *
+        * @note This should only be used if the calling code is sure that the given size is correct
+        * for the revision's content, and there is no chance of the content being manipulated
+        * later. When in doubt, this method should not be called.
+        *
+        * @param int $size nominal size in bogo-bytes
+        */
+       public function setSize( $size ) {
+               Assert::parameterType( 'integer', $size, '$size' );
+
+               $this->mSize = $size;
+       }
+
+       /**
+        * @param int $visibility
+        */
+       public function setVisibility( $visibility ) {
+               Assert::parameterType( 'integer', $visibility, '$visibility' );
+
+               $this->mDeleted = $visibility;
+       }
+
+       /**
+        * @param string $timestamp A timestamp understood by wfTimestamp
+        */
+       public function setTimestamp( $timestamp ) {
+               Assert::parameterType( 'string', $timestamp, '$timestamp' );
+
+               $this->mTimestamp = wfTimestamp( TS_MW, $timestamp );
+       }
+
+       /**
+        * @param bool $minorEdit
+        */
+       public function setMinorEdit( $minorEdit ) {
+               Assert::parameterType( 'boolean', $minorEdit, '$minorEdit' );
+
+               $this->mMinorEdit = $minorEdit;
+       }
+
+       /**
+        * Set the revision ID.
+        *
+        * MCR migration note: this replaces Revision::setId()
+        *
+        * @warning Use this with care, especially when preparing a revision for insertion
+        *          into the database! The revision ID should only be fixed in special cases
+        *          like preserving the original ID when restoring a revision.
+        *
+        * @param int $id
+        */
+       public function setId( $id ) {
+               Assert::parameterType( 'integer', $id, '$id' );
+
+               $this->mId = $id;
+       }
+
+       /**
+        * Sets the user identity associated with the revision
+        *
+        * @param UserIdentity $user
+        */
+       public function setUser( UserIdentity $user ) {
+               $this->mUser = $user;
+       }
+
+       /**
+        * @param int $pageId
+        */
+       public function setPageId( $pageId ) {
+               Assert::parameterType( 'integer', $pageId, '$pageId' );
+
+               if ( $this->mTitle->exists() && $pageId !== $this->mTitle->getArticleID() ) {
+                       throw new InvalidArgumentException(
+                               'The given Title does not belong to page ID ' . $this->mPageId
+                       );
+               }
+
+               $this->mPageId = $pageId;
+       }
+
+       /**
+        * Returns the nominal size of this revision.
+        *
+        * MCR migration note: this replaces Revision::getSize
+        *
+        * @return int The nominal size, may be computed on the fly if not yet known.
+        */
+       public function getSize() {
+               // If not known, re-calculate and remember. Will be reset when slots change.
+               if ( $this->mSize === null ) {
+                       $this->mSize = $this->mSlots->computeSize();
+               }
+
+               return $this->mSize;
+       }
+
+       /**
+        * Returns the base36 sha1 of this revision.
+        *
+        * MCR migration note: this replaces Revision::getSha1
+        *
+        * @return string The revision hash, may be computed on the fly if not yet known.
+        */
+       public function getSha1() {
+               // If not known, re-calculate and remember. Will be reset when slots change.
+               if ( $this->mSha1 === null ) {
+                       $this->mSha1 = $this->mSlots->computeSha1();
+               }
+
+               return $this->mSha1;
+       }
+
+       /**
+        * Invalidate cached aggregate values such as hash and size.
+        */
+       private function resetAggregateValues() {
+               $this->mSize = null;
+               $this->mSha1 = null;
+       }
+
+}
diff --git a/includes/Storage/MutableRevisionSlots.php b/includes/Storage/MutableRevisionSlots.php
new file mode 100644 (file)
index 0000000..2e675c8
--- /dev/null
@@ -0,0 +1,137 @@
+<?php
+/**
+ * Mutable version of RevisionSlots, for constructing a new revision.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use Content;
+
+/**
+ * Mutable version of RevisionSlots, for constructing a new revision.
+ *
+ * @since 1.31
+ */
+class MutableRevisionSlots extends RevisionSlots {
+
+       /**
+        * Constructs a MutableRevisionSlots that inherits from the given
+        * list of slots.
+        *
+        * @param SlotRecord[] $slots
+        *
+        * @return MutableRevisionSlots
+        */
+       public static function newFromParentRevisionSlots( array $slots ) {
+               $inherited = [];
+               foreach ( $slots as $slot ) {
+                       $role = $slot->getRole();
+                       $inherited[$role] = SlotRecord::newInherited( $slot );
+               }
+
+               return new MutableRevisionSlots( $inherited );
+       }
+
+       /**
+        * @param SlotRecord[] $slots An array of SlotRecords.
+        */
+       public function __construct( array $slots = [] ) {
+               parent::__construct( $slots );
+       }
+
+       /**
+        * Sets the given slot.
+        * If a slot with the same role is already present, it is replaced.
+        *
+        * @note This may cause the slot meta-data for the revision to be lazy-loaded.
+        *
+        * @param SlotRecord $slot
+        */
+       public function setSlot( SlotRecord $slot ) {
+               if ( !is_array( $this->slots ) ) {
+                       $this->getSlots(); // initialize $this->slots
+               }
+
+               $role = $slot->getRole();
+               $this->slots[$role] = $slot;
+       }
+
+       /**
+        * Sets the content for the slot with the given role.
+        * If a slot with the same role is already present, it is replaced.
+        *
+        * @note This may cause the slot meta-data for the revision to be lazy-loaded.
+        *
+        * @param string $role
+        * @param Content $content
+        */
+       public function setContent( $role, Content $content ) {
+               $slot = SlotRecord::newUnsaved( $role, $content );
+               $this->setSlot( $slot );
+       }
+
+       /**
+        * Remove the slot for the given role, discontinue the corresponding stream.
+        *
+        * @note This may cause the slot meta-data for the revision to be lazy-loaded.
+        *
+        * @param string $role
+        */
+       public function removeSlot( $role ) {
+               if ( !is_array( $this->slots ) ) {
+                       $this->getSlots();  // initialize $this->slots
+               }
+
+               unset( $this->slots[$role] );
+       }
+
+       /**
+        * Return all slots that are not inherited.
+        *
+        * @note This may cause the slot meta-data for the revision to be lazy-loaded.
+        *
+        * @return SlotRecord[]
+        */
+       public function getTouchedSlots() {
+               return array_filter(
+                       $this->getSlots(),
+                       function ( SlotRecord $slot ) {
+                               return !$slot->isInherited();
+                       }
+               );
+       }
+
+       /**
+        * Return all slots that are inherited.
+        *
+        * @note This may cause the slot meta-data for the revision to be lazy-loaded.
+        *
+        * @return SlotRecord[]
+        */
+       public function getInheritedSlots() {
+               return array_filter(
+                       $this->getSlots(),
+                       function ( SlotRecord $slot ) {
+                               return $slot->isInherited();
+                       }
+               );
+       }
+
+}
diff --git a/includes/Storage/RevisionAccessException.php b/includes/Storage/RevisionAccessException.php
new file mode 100644 (file)
index 0000000..ee6efc0
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Exception representing a failure to look up a revision.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use RuntimeException;
+
+/**
+ * Exception representing a failure to look up a revision.
+ *
+ * @since 1.31
+ */
+class RevisionAccessException extends RuntimeException {
+
+}
diff --git a/includes/Storage/RevisionArchiveRecord.php b/includes/Storage/RevisionArchiveRecord.php
new file mode 100644 (file)
index 0000000..419cb95
--- /dev/null
@@ -0,0 +1,165 @@
+<?php
+/**
+ * A RevisionRecord representing a revision of a deleted page persisted in the archive table.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use CommentStoreComment;
+use MediaWiki\User\UserIdentity;
+use Title;
+use User;
+use Wikimedia\Assert\Assert;
+
+/**
+ * A RevisionRecord representing a revision of a deleted page persisted in the archive table.
+ * Most getters on RevisionArchiveRecord will never return null. However, getId() and
+ * getParentId() may indeed return null if this information was not stored when the archive entry
+ * was created.
+ *
+ * @since 1.31
+ */
+class RevisionArchiveRecord extends RevisionRecord {
+
+       /**
+        * @var int
+        */
+       protected $mArchiveId;
+
+       /**
+        * @note Avoid calling this constructor directly. Use the appropriate methods
+        * in RevisionStore instead.
+        *
+        * @param Title $title The title of the page this Revision is associated with.
+        * @param UserIdentity $user
+        * @param CommentStoreComment $comment
+        * @param object $row An archive table row. Use RevisionStore::getArchiveQueryInfo() to build
+        *        a query that yields the required fields.
+        * @param RevisionSlots $slots The slots of this revision.
+        * @param bool|string $wikiId the wiki ID of the site this Revision belongs to,
+        *        or false for the local site.
+        */
+       function __construct(
+               Title $title,
+               UserIdentity $user,
+               CommentStoreComment $comment,
+               $row,
+               RevisionSlots $slots,
+               $wikiId = false
+       ) {
+               parent::__construct( $title, $slots, $wikiId );
+               Assert::parameterType( 'object', $row, '$row' );
+
+               $this->mArchiveId = intval( $row->ar_id );
+
+               // NOTE: ar_page_id may be different from $this->mTitle->getArticleID() in some cases,
+               // notably when a partially restored page has been moved, and a new page has been created
+               // with the same title. Archive rows for that title will then have the wrong page id.
+               $this->mPageId = isset( $row->ar_page_id ) ? intval( $row->ar_page_id ) : $title->getArticleID();
+
+               // NOTE: ar_parent_id = 0 indicates that there is no parent revision, while null
+               // indicates that the parent revision is unknown. As per MW 1.31, the database schema
+               // allows ar_parent_id to be NULL.
+               $this->mParentId = isset( $row->ar_parent_id ) ? intval( $row->ar_parent_id ) : null;
+               $this->mId = isset( $row->ar_rev_id ) ? intval( $row->ar_rev_id ) : null;
+               $this->mComment = $comment;
+               $this->mUser = $user;
+               $this->mTimestamp = wfTimestamp( TS_MW, $row->ar_timestamp );
+               $this->mMinorEdit = boolval( $row->ar_minor_edit );
+               $this->mDeleted = intval( $row->ar_deleted );
+               $this->mSize = intval( $row->ar_len );
+               $this->mSha1 = isset( $row->ar_sha1 ) ? $row->ar_sha1 : null;
+       }
+
+       /**
+        * Get archive row ID
+        *
+        * @return int
+        */
+       public function getArchiveId() {
+               return $this->mId;
+       }
+
+       /**
+        * @return int|null The revision id, or null if the original revision ID
+        *         was not recorded in the archive table.
+        */
+       public function getId() {
+               // overwritten just to refine the contract specification.
+               return parent::getId();
+       }
+
+       /**
+        * @return int The nominal revision size, never null. May be computed on the fly.
+        */
+       public function getSize() {
+               // If length is null, calculate and remember it (potentially SLOW!).
+               // This is for compatibility with old database rows that don't have the field set.
+               if ( $this->mSize === null ) {
+                       $this->mSize = $this->mSlots->computeSize();
+               }
+
+               return $this->mSize;
+       }
+
+       /**
+        * @return string The revision hash, never null. May be computed on the fly.
+        */
+       public function getSha1() {
+               // If hash is null, calculate it and remember (potentially SLOW!)
+               // This is for compatibility with old database rows that don't have the field set.
+               if ( $this->mSha1 === null ) {
+                       $this->mSha1 = $this->mSlots->computeSha1();
+               }
+
+               return $this->mSha1;
+       }
+
+       /**
+        * @param int $audience
+        * @param User|null $user
+        *
+        * @return UserIdentity The identity of the revision author, null if access is forbidden.
+        */
+       public function getUser( $audience = self::FOR_PUBLIC, User $user = null ) {
+               // overwritten just to add a guarantee to the contract
+               return parent::getUser( $audience, $user );
+       }
+
+       /**
+        * @param int $audience
+        * @param User|null $user
+        *
+        * @return CommentStoreComment The revision comment, null if access is forbidden.
+        */
+       public function getComment( $audience = self::FOR_PUBLIC, User $user = null ) {
+               // overwritten just to add a guarantee to the contract
+               return parent::getComment( $audience, $user );
+       }
+
+       /**
+        * @return string never null
+        */
+       public function getTimestamp() {
+               // overwritten just to add a guarantee to the contract
+               return parent::getTimestamp();
+       }
+
+}
diff --git a/includes/Storage/RevisionFactory.php b/includes/Storage/RevisionFactory.php
new file mode 100644 (file)
index 0000000..86e8c06
--- /dev/null
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Service for constructing revision objects.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use MWException;
+use Title;
+
+/**
+ * Service for constructing revision objects.
+ *
+ * @since 1.31
+ *
+ * @note This was written to act as a drop-in replacement for the corresponding
+ *       static methods in Revision.
+ */
+interface RevisionFactory {
+
+       /**
+        * Constructs a new RevisionRecord based on the given associative array following the MW1.29
+        * database convention for the Revision constructor.
+        *
+        * MCR migration note: this replaces Revision::newFromRow
+        *
+        * @deprecated since 1.31. Use a MutableRevisionRecord instead.
+        *
+        * @param array $fields
+        * @param int $queryFlags Flags for lazy loading behavior, see IDBAccessObject::READ_XXX.
+        * @param Title|null $title
+        *
+        * @return MutableRevisionRecord
+        * @throws MWException
+        */
+       public function newMutableRevisionFromArray( array $fields, $queryFlags = 0, Title $title = null );
+
+       /**
+        * Constructs a RevisionRecord given a database row and content slots.
+        *
+        * MCR migration note: this replaces Revision::newFromRow for rows based on the
+        * revision, slot, and content tables defined for MCR since MW1.31.
+        *
+        * @param object $row A query result row as a raw object.
+        *        Use RevisionStore::getQueryInfo() to build a query that yields the required fields.
+        * @param int $queryFlags Flags for lazy loading behavior, see IDBAccessObject::READ_XXX.
+        * @param Title|null $title
+        *
+        * @return RevisionRecord
+        */
+       public function newRevisionFromRow( $row, $queryFlags = 0, Title $title = null );
+
+       /**
+        * Make a fake revision object from an archive table row. This is queried
+        * for permissions or even inserted (as in Special:Undelete)
+        *
+        * MCR migration note: this replaces Revision::newFromArchiveRow
+        *
+        * @param object $row A query result row as a raw object.
+        *        Use RevisionStore::getArchiveQueryInfo() to build a query that yields the
+        *        required fields.
+        * @param int $queryFlags Flags for lazy loading behavior, see IDBAccessObject::READ_XXX.
+        * @param Title $title
+        * @param array $overrides An associative array that allows fields in $row to be overwritten.
+        *        Keys in this array correspond to field names in $row without the "ar_" prefix, so
+        *        $overrides['user'] will override $row->ar_user, etc.
+        *
+        * @return RevisionRecord
+        */
+       public function newRevisionFromArchiveRow(
+               $row,
+               $queryFlags = 0,
+               Title $title = null,
+               array $overrides = []
+       );
+
+}
diff --git a/includes/Storage/RevisionLookup.php b/includes/Storage/RevisionLookup.php
new file mode 100644 (file)
index 0000000..5cd157b
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+/**
+ *  Service for looking up page revisions.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use \IDBAccessObject;
+use MediaWiki\Linker\LinkTarget;
+use Title;
+
+/**
+ * Service for looking up page revisions.
+ *
+ * @note This was written to act as a drop-in replacement for the corresponding
+ *       static methods in Revision.
+ *
+ * @since 1.31
+ */
+interface RevisionLookup extends IDBAccessObject {
+
+       /**
+        * Load a page revision from a given revision ID number.
+        * Returns null if no such revision can be found.
+        *
+        * MCR migration note: this replaces Revision::newFromId
+        *
+        * $flags include:
+        *
+        * @param int $id
+        * @param int $flags bit field, see IDBAccessObject::READ_XXX
+        * @return RevisionRecord|null
+        */
+       public function getRevisionById( $id, $flags = 0 );
+
+       /**
+        * Load either the current, or a specified, revision
+        * that's attached to a given link target. If not attached
+        * to that link target, will return null.
+        *
+        * MCR migration note: this replaces Revision::newFromTitle
+        *
+        * @param LinkTarget $linkTarget
+        * @param int $revId (optional)
+        * @param int $flags bit field, see IDBAccessObject::READ_XXX
+        * @return RevisionRecord|null
+        */
+       public function getRevisionByTitle( LinkTarget $linkTarget, $revId = 0, $flags = 0 );
+
+       /**
+        * Load either the current, or a specified, revision
+        * that's attached to a given page ID.
+        * Returns null if no such revision can be found.
+        *
+        * MCR migration note: this replaces Revision::newFromPageId
+        *
+        * @param int $pageId
+        * @param int $revId (optional)
+        * @param int $flags bit field, see IDBAccessObject::READ_XXX
+        * @return RevisionRecord|null
+        */
+       public function getRevisionByPageId( $pageId, $revId = 0, $flags = 0 );
+
+       /**
+        * Get previous revision for this title
+        *
+        * MCR migration note: this replaces Revision::getPrevious
+        *
+        * @param RevisionRecord $rev
+        *
+        * @return RevisionRecord|null
+        */
+       public function getPreviousRevision( RevisionRecord $rev );
+
+       /**
+        * Get next revision for this title
+        *
+        * MCR migration note: this replaces Revision::getNext
+        *
+        * @param RevisionRecord $rev
+        *
+        * @return RevisionRecord|null
+        */
+       public function getNextRevision( RevisionRecord $rev );
+
+       /**
+        * Load a revision based on a known page ID and current revision ID from the DB
+        *
+        * This method allows for the use of caching, though accessing anything that normally
+        * requires permission checks (aside from the text) will trigger a small DB lookup.
+        *
+        * MCR migration note: this replaces Revision::newKnownCurrent
+        *
+        * @param Title $title the associated page title
+        * @param int $revId current revision of this page
+        *
+        * @return RevisionRecord|bool Returns false if missing
+        */
+       public function getKnownCurrentRevision( Title $title, $revId );
+
+}
diff --git a/includes/Storage/RevisionRecord.php b/includes/Storage/RevisionRecord.php
new file mode 100644 (file)
index 0000000..f490f9b
--- /dev/null
@@ -0,0 +1,479 @@
+<?php
+/**
+ * Page revision base class.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use CommentStoreComment;
+use Content;
+use InvalidArgumentException;
+use LogicException;
+use MediaWiki\Linker\LinkTarget;
+use MediaWiki\User\UserIdentity;
+use MWException;
+use Title;
+use User;
+use Wikimedia\Assert\Assert;
+
+/**
+ * Page revision base class.
+ *
+ * RevisionRecords are considered value objects, but they may use callbacks for lazy loading.
+ * Note that while the base class has no setters, subclasses may offer a mutable interface.
+ *
+ * @since 1.31
+ */
+abstract class RevisionRecord {
+
+       // RevisionRecord deletion constants
+       const DELETED_TEXT = 1;
+       const DELETED_COMMENT = 2;
+       const DELETED_USER = 4;
+       const DELETED_RESTRICTED = 8;
+       const SUPPRESSED_USER = 12; // convenience
+       const SUPPRESSED_ALL = 15; // convenience
+
+       // Audience options for accessors
+       const FOR_PUBLIC = 1;
+       const FOR_THIS_USER = 2;
+       const RAW = 3;
+
+       /** @var string Wiki ID; false means the current wiki */
+       protected $mWiki = false;
+       /** @var int|null */
+       protected $mId;
+       /** @var int|null */
+       protected $mPageId;
+       /** @var UserIdentity|null */
+       protected $mUser;
+       /** @var bool */
+       protected $mMinorEdit = false;
+       /** @var string|null */
+       protected $mTimestamp;
+       /** @var int using the DELETED_XXX and SUPPRESSED_XXX flags */
+       protected $mDeleted = 0;
+       /** @var int|null */
+       protected $mSize;
+       /** @var string|null */
+       protected $mSha1;
+       /** @var int|null */
+       protected $mParentId;
+       /** @var CommentStoreComment|null */
+       protected $mComment;
+
+       /**  @var Title */
+       protected $mTitle; // TODO: we only need the title for permission checks!
+
+       /** @var RevisionSlots */
+       protected $mSlots;
+
+       /**
+        * @note Avoid calling this constructor directly. Use the appropriate methods
+        * in RevisionStore instead.
+        *
+        * @param Title $title The title of the page this Revision is associated with.
+        * @param RevisionSlots $slots The slots of this revision.
+        * @param bool|string $wikiId the wiki ID of the site this Revision belongs to,
+        *        or false for the local site.
+        *
+        * @throws MWException
+        */
+       function __construct( Title $title, RevisionSlots $slots, $wikiId = false ) {
+               Assert::parameterType( 'string|boolean', $wikiId, '$wikiId' );
+
+               $this->mTitle = $title;
+               $this->mSlots = $slots;
+               $this->mWiki = $wikiId;
+
+               // XXX: this is a sensible default, but we may not have a Title object here in the future.
+               $this->mPageId = $title->getArticleID();
+       }
+
+       /**
+        * Implemented to defy serialization.
+        *
+        * @throws LogicException always
+        */
+       public function __sleep() {
+               throw new LogicException( __CLASS__ . ' is not serializable.' );
+       }
+
+       /**
+        * @param RevisionRecord $rec
+        *
+        * @return bool True if this RevisionRecord is known to have same content as $rec.
+        *         False if the content is different (or not known to be the same).
+        */
+       public function hasSameContent( RevisionRecord $rec ) {
+               if ( $rec === $this ) {
+                       return true;
+               }
+
+               if ( $this->getId() !== null && $this->getId() === $rec->getId() ) {
+                       return true;
+               }
+
+               // check size before hash, since size is quicker to compute
+               if ( $this->getSize() !== $rec->getSize() ) {
+                       return false;
+               }
+
+               // instead of checking the hash, we could also check the content addresses of all slots.
+
+               if ( $this->getSha1() === $rec->getSha1() ) {
+                       return true;
+               }
+
+               return false;
+       }
+
+       /**
+        * Returns the Content of the given slot of this revision.
+        * Call getSlotNames() to get a list of available slots.
+        *
+        * Note that for mutable Content objects, each call to this method will return a
+        * fresh clone.
+        *
+        * MCR migration note: this replaces Revision::getContent
+        *
+        * @param string $role The role name of the desired slot
+        * @param int $audience
+        * @param User|null $user
+        *
+        * @throws RevisionAccessException if the slot does not exist or slot data
+        *        could not be lazy-loaded.
+        * @return Content|null The content of the given slot, or null if access is forbidden.
+        */
+       public function getContent( $role, $audience = self::FOR_PUBLIC, User $user = null ) {
+               // XXX: throwing an exception would be nicer, but would a further
+               // departure from the signature of Revision::getContent(), and thus
+               // more complex and error prone refactoring.
+               if ( !$this->audienceCan( self::DELETED_TEXT, $audience, $user ) ) {
+                       return null;
+               }
+
+               $content = $this->getSlot( $role, $audience, $user )->getContent();
+               return $content->copy();
+       }
+
+       /**
+        * Returns meta-data for the given slot.
+        *
+        * @param string $role The role name of the desired slot
+        * @param int $audience
+        * @param User|null $user
+        *
+        * @throws RevisionAccessException if the slot does not exist or slot data
+        *        could not be lazy-loaded.
+        * @return SlotRecord The slot meta-data. If access to the slot content is forbidden,
+        *         calling getContent() on the SlotRecord will throw an exception.
+        */
+       public function getSlot( $role, $audience = self::FOR_PUBLIC, User $user = null ) {
+               $slot = $this->mSlots->getSlot( $role );
+
+               if ( !$this->audienceCan( self::DELETED_TEXT, $audience, $user ) ) {
+                       return SlotRecord::newWithSuppressedContent( $slot );
+               }
+
+               return $slot;
+       }
+
+       /**
+        * Returns the slot names (roles) of all slots present in this revision.
+        * getContent() will succeed only for the names returned by this method.
+        *
+        * @return string[]
+        */
+       public function getSlotRoles() {
+               return $this->mSlots->getSlotRoles();
+       }
+
+       /**
+        * Get revision ID. Depending on the concrete subclass, this may return null if
+        * the revision ID is not known (e.g. because the revision does not yet exist
+        * in the database).
+        *
+        * MCR migration note: this replaces Revision::getId
+        *
+        * @return int|null
+        */
+       public function getId() {
+               return $this->mId;
+       }
+
+       /**
+        * Get parent revision ID (the original previous page revision).
+        * If there is no parent revision, this returns 0.
+        * If the parent revision is undefined or unknown, this returns null.
+        *
+        * @note As of MW 1.31, the database schema allows the parent ID to be
+        * NULL to indicate that it is unknown.
+        *
+        * MCR migration note: this replaces Revision::getParentId
+        *
+        * @return int|null
+        */
+       public function getParentId() {
+               return $this->mParentId;
+       }
+
+       /**
+        * Returns the nominal size of this revision, in bogo-bytes.
+        * May be calculated on the fly if not known, which may in the worst
+        * case may involve loading all content.
+        *
+        * MCR migration note: this replaces Revision::getSize
+        *
+        * @return int
+        */
+       abstract public function getSize();
+
+       /**
+        * Returns the base36 sha1 of this revision. This hash is derived from the
+        * hashes of all slots associated with the revision.
+        * May be calculated on the fly if not known, which may in the worst
+        * case may involve loading all content.
+        *
+        * MCR migration note: this replaces Revision::getSha1
+        *
+        * @return string
+        */
+       abstract public function getSha1();
+
+       /**
+        * Get the page ID. If the page does not yet exist, the page ID is 0.
+        *
+        * MCR migration note: this replaces Revision::getPage
+        *
+        * @return int
+        */
+       public function getPageId() {
+               return $this->mPageId;
+       }
+
+       /**
+        * Get the ID of the wiki this revision belongs to.
+        *
+        * @return string|false The wiki's logical name, of false to indicate the local wiki.
+        */
+       public function getWikiId() {
+               return $this->mWiki;
+       }
+
+       /**
+        * Returns the title of the page this revision is associated with as a LinkTarget object.
+        *
+        * MCR migration note: this replaces Revision::getTitle
+        *
+        * @return LinkTarget
+        */
+       public function getPageAsLinkTarget() {
+               return $this->mTitle;
+       }
+
+       /**
+        * Fetch revision's author's user identity, if it's available to the specified audience.
+        * If the specified audience does not have access to it, null will be
+        * returned. Depending on the concrete subclass, null may also be returned if the user is
+        * not yet specified.
+        *
+        * MCR migration note: this replaces Revision::getUser
+        *
+        * @param int $audience One of:
+        *   RevisionRecord::FOR_PUBLIC       to be displayed to all users
+        *   RevisionRecord::FOR_THIS_USER    to be displayed to the given user
+        *   RevisionRecord::RAW              get the ID regardless of permissions
+        * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
+        *   to the $audience parameter
+        * @return UserIdentity|null
+        */
+       public function getUser( $audience = self::FOR_PUBLIC, User $user = null ) {
+               if ( !$this->audienceCan( self::DELETED_USER, $audience, $user ) ) {
+                       return null;
+               } else {
+                       return $this->mUser;
+               }
+       }
+
+       /**
+        * Fetch revision comment, if it's available to the specified audience.
+        * If the specified audience does not have access to the comment,
+        * this will return null. Depending on the concrete subclass, null may also be returned
+        * if the comment is not yet specified.
+        *
+        * MCR migration note: this replaces Revision::getComment
+        *
+        * @param int $audience One of:
+        *   RevisionRecord::FOR_PUBLIC       to be displayed to all users
+        *   RevisionRecord::FOR_THIS_USER    to be displayed to the given user
+        *   RevisionRecord::RAW              get the text regardless of permissions
+        * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
+        *   to the $audience parameter
+        *
+        * @return CommentStoreComment|null
+        */
+       public function getComment( $audience = self::FOR_PUBLIC, User $user = null ) {
+               if ( !$this->audienceCan( self::DELETED_COMMENT, $audience, $user ) ) {
+                       return null;
+               } else {
+                       return $this->mComment;
+               }
+       }
+
+       /**
+        * MCR migration note: this replaces Revision::isMinor
+        *
+        * @return bool
+        */
+       public function isMinor() {
+               return (bool)$this->mMinorEdit;
+       }
+
+       /**
+        * MCR migration note: this replaces Revision::isDeleted
+        *
+        * @param int $field One of DELETED_* bitfield constants
+        *
+        * @return bool
+        */
+       public function isDeleted( $field ) {
+               return ( $this->getVisibility() & $field ) == $field;
+       }
+
+       /**
+        * Get the deletion bitfield of the revision
+        *
+        * MCR migration note: this replaces Revision::getVisibility
+        *
+        * @return int
+        */
+       public function getVisibility() {
+               return (int)$this->mDeleted;
+       }
+
+       /**
+        * MCR migration note: this replaces Revision::getTimestamp.
+        *
+        * May return null if the timestamp was not specified.
+        *
+        * @return string|null
+        */
+       public function getTimestamp() {
+               return $this->mTimestamp;
+       }
+
+       /**
+        * Check that the given audience has access to the given field.
+        *
+        * MCR migration note: this corresponds to Revision::userCan
+        *
+        * @param int $field One of self::DELETED_TEXT,
+        *        self::DELETED_COMMENT,
+        *        self::DELETED_USER
+        * @param int $audience One of:
+        *        RevisionRecord::FOR_PUBLIC       to be displayed to all users
+        *        RevisionRecord::FOR_THIS_USER    to be displayed to the given user
+        *        RevisionRecord::RAW              get the text regardless of permissions
+        * @param User|null $user User object to check. Required if $audience is FOR_THIS_USER,
+        *        ignored otherwise.
+        *
+        * @return bool
+        */
+       protected function audienceCan( $field, $audience, User $user = null ) {
+               if ( $audience == self::FOR_PUBLIC && $this->isDeleted( $field ) ) {
+                       return false;
+               } elseif ( $audience == self::FOR_THIS_USER ) {
+                       if ( !$user ) {
+                               throw new InvalidArgumentException(
+                                       'A User object must be given when checking FOR_THIS_USER audience.'
+                               );
+                       }
+
+                       if ( !$this->userCan( $field, $user ) ) {
+                               return false;
+                       }
+               }
+
+               return true;
+       }
+
+       /**
+        * Determine if the current user is allowed to view a particular
+        * field of this revision, if it's marked as deleted.
+        *
+        * MCR migration note: this corresponds to Revision::userCan
+        *
+        * @param int $field One of self::DELETED_TEXT,
+        *                              self::DELETED_COMMENT,
+        *                              self::DELETED_USER
+        * @param User $user User object to check
+        * @return bool
+        */
+       protected function userCan( $field, User $user ) {
+               // TODO: use callback for permission checks, so we don't need to know a Title object!
+               return self::userCanBitfield( $this->getVisibility(), $field, $user, $this->mTitle );
+       }
+
+       /**
+        * Determine if the current user is allowed to view a particular
+        * field of this revision, if it's marked as deleted. This is used
+        * by various classes to avoid duplication.
+        *
+        * MCR migration note: this replaces Revision::userCanBitfield
+        *
+        * @param int $bitfield Current field
+        * @param int $field One of self::DELETED_TEXT = File::DELETED_FILE,
+        *                               self::DELETED_COMMENT = File::DELETED_COMMENT,
+        *                               self::DELETED_USER = File::DELETED_USER
+        * @param User $user User object to check
+        * @param Title|null $title A Title object to check for per-page restrictions on,
+        *                          instead of just plain userrights
+        * @return bool
+        */
+       public static function userCanBitfield( $bitfield, $field, User $user, Title $title = null ) {
+               if ( $bitfield & $field ) { // aspect is deleted
+                       if ( $bitfield & self::DELETED_RESTRICTED ) {
+                               $permissions = [ 'suppressrevision', 'viewsuppressed' ];
+                       } elseif ( $field & self::DELETED_TEXT ) {
+                               $permissions = [ 'deletedtext' ];
+                       } else {
+                               $permissions = [ 'deletedhistory' ];
+                       }
+                       $permissionlist = implode( ', ', $permissions );
+                       if ( $title === null ) {
+                               wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" );
+                               return call_user_func_array( [ $user, 'isAllowedAny' ], $permissions );
+                       } else {
+                               $text = $title->getPrefixedText();
+                               wfDebug( "Checking for $permissionlist on $text due to $field match on $bitfield\n" );
+                               foreach ( $permissions as $perm ) {
+                                       if ( $title->userCan( $perm, $user ) ) {
+                                               return true;
+                                       }
+                               }
+                               return false;
+                       }
+               } else {
+                       return true;
+               }
+       }
+
+}
diff --git a/includes/Storage/RevisionSlots.php b/includes/Storage/RevisionSlots.php
new file mode 100644 (file)
index 0000000..8d3d7e3
--- /dev/null
@@ -0,0 +1,189 @@
+<?php
+/**
+ * Value object representing the set of slots belonging to a revision.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use Content;
+use LogicException;
+use Wikimedia\Assert\Assert;
+
+/**
+ * Value object representing the set of slots belonging to a revision.
+ *
+ * @since 1.31
+ */
+class RevisionSlots {
+
+       /** @var SlotRecord[]|callable */
+       protected $slots;
+
+       /**
+        * @param SlotRecord[]|callable $slots SlotRecords,
+        *        or a callback that returns such a structure.
+        */
+       public function __construct( $slots ) {
+               Assert::parameterType( 'array|callable', $slots, '$slots' );
+
+               if ( is_callable( $slots ) ) {
+                       $this->slots = $slots;
+               } else {
+                       $this->setSlotsInternal( $slots );
+               }
+       }
+
+       /**
+        * @param SlotRecord[] $slots
+        */
+       private function setSlotsInternal( array $slots ) {
+               $this->slots = [];
+
+               // re-key the slot array
+               foreach ( $slots as $slot ) {
+                       $role = $slot->getRole();
+                       $this->slots[$role] = $slot;
+               }
+       }
+
+       /**
+        * Implemented to defy serialization.
+        *
+        * @throws LogicException always
+        */
+       public function __sleep() {
+               throw new LogicException( __CLASS__ . ' is not serializable.' );
+       }
+
+       /**
+        * Returns the Content of the given slot.
+        * Call getSlotNames() to get a list of available slots.
+        *
+        * Note that for mutable Content objects, each call to this method will return a
+        * fresh clone.
+        *
+        * @param string $role The role name of the desired slot
+        *
+        * @throws RevisionAccessException if the slot does not exist or slot data
+        *        could not be lazy-loaded.
+        * @return Content
+        */
+       public function getContent( $role ) {
+               // Return a copy to be safe. Immutable content objects return $this from copy().
+               return $this->getSlot( $role )->getContent()->copy();
+       }
+
+       /**
+        * Returns the SlotRecord of the given slot.
+        * Call getSlotNames() to get a list of available slots.
+        *
+        * @param string $role The role name of the desired slot
+        *
+        * @throws RevisionAccessException if the slot does not exist or slot data
+        *        could not be lazy-loaded.
+        * @return SlotRecord
+        */
+       public function getSlot( $role ) {
+               $slots = $this->getSlots();
+
+               if ( isset( $slots[$role] ) ) {
+                       return $slots[$role];
+               } else {
+                       throw new RevisionAccessException( 'No such slot: ' . $role );
+               }
+       }
+
+       /**
+        * Returns the slot names (roles) of all slots present in this revision.
+        * getContent() will succeed only for the names returned by this method.
+        *
+        * @return string[]
+        */
+       public function getSlotRoles() {
+               $slots = $this->getSlots();
+               return array_keys( $slots );
+       }
+
+       /**
+        * Computes the total nominal size of the revision's slots, in bogo-bytes.
+        *
+        * @warn This is potentially expensive! It may cause all slot's content to be loaded
+        * and deserialized.
+        *
+        * @return int
+        */
+       public function computeSize() {
+               return array_reduce( $this->getSlots(), function ( $accu, SlotRecord $slot ) {
+                       return $accu + $slot->getSize();
+               }, 0 );
+       }
+
+       /**
+        * Returns an associative array that maps role names to SlotRecords. Each SlotRecord
+        * represents the content meta-data of a slot, together they define the content of
+        * a revision.
+        *
+        * @note This may cause the content meta-data for the revision to be lazy-loaded.
+        *
+        * @return SlotRecord[] revision slot/content rows, keyed by slot role name.
+        */
+       public function getSlots() {
+               if ( is_callable( $this->slots ) ) {
+                       $slots = call_user_func( $this->slots );
+
+                       Assert::postcondition(
+                               is_array( $slots ),
+                               'Slots info callback should return an array of objects'
+                       );
+
+                       $this->setSlotsInternal( $slots );
+               }
+
+               return $this->slots;
+       }
+
+       /**
+        * Computes the combined hash of the revisions's slots.
+        *
+        * @note For backwards compatibility, the combined hash of a single slot
+        * is that slot's hash. For consistency, the combined hash of an empty set of slots
+        * is the hash of the empty string.
+        *
+        * @warn This is potentially expensive! It may cause all slot's content to be loaded
+        * and deserialized, then re-serialized and hashed.
+        *
+        * @return string
+        */
+       public function computeSha1() {
+               $slots = $this->getSlots();
+               ksort( $slots );
+
+               if ( empty( $slots ) ) {
+                       return SlotRecord::base36Sha1( '' );
+               }
+
+               return array_reduce( $slots, function ( $accu, SlotRecord $slot ) {
+                       return $accu === null
+                               ? $slot->getSha1()
+                               : SlotRecord::base36Sha1( $accu . $slot->getSha1() );
+               }, null );
+       }
+
+}
diff --git a/includes/Storage/RevisionStore.php b/includes/Storage/RevisionStore.php
new file mode 100644 (file)
index 0000000..b8debb8
--- /dev/null
@@ -0,0 +1,1914 @@
+<?php
+/**
+ * Service for looking up page revisions.
+ *
+ * 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
+ *
+ * Attribution notice: when this file was created, much of its content was taken
+ * from the Revision.php file as present in release 1.30. Refer to the history
+ * of that file for original authorship.
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use CommentStore;
+use CommentStoreComment;
+use Content;
+use ContentHandler;
+use DBAccessObjectUtils;
+use Hooks;
+use \IDBAccessObject;
+use InvalidArgumentException;
+use IP;
+use LogicException;
+use MediaWiki\Linker\LinkTarget;
+use MediaWiki\User\UserIdentity;
+use MediaWiki\User\UserIdentityValue;
+use Message;
+use MWException;
+use MWUnknownContentModelException;
+use RecentChange;
+use stdClass;
+use Title;
+use User;
+use WANObjectCache;
+use Wikimedia\Assert\Assert;
+use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\DBConnRef;
+use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\LoadBalancer;
+
+/**
+ * Service for looking up page revisions.
+ *
+ * @since 1.31
+ *
+ * @note This was written to act as a drop-in replacement for the corresponding
+ *       static methods in Revision.
+ */
+class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup {
+
+       /**
+        * @var SqlBlobStore
+        */
+       private $blobStore;
+
+       /**
+        * @var bool|string
+        */
+       private $wikiId;
+
+       /**
+        * @var boolean
+        */
+       private $contentHandlerUseDB = true;
+
+       /**
+        * @var LoadBalancer
+        */
+       private $loadBalancer;
+
+       /**
+        * @var WANObjectCache
+        */
+       private $cache;
+
+       /**
+        * @todo $blobStore should be allowed to be any BlobStore!
+        *
+        * @param LoadBalancer $loadBalancer
+        * @param SqlBlobStore $blobStore
+        * @param WANObjectCache $cache
+        * @param bool|string $wikiId
+        */
+       public function __construct(
+               LoadBalancer $loadBalancer,
+               SqlBlobStore $blobStore,
+               WANObjectCache $cache,
+               $wikiId = false
+       ) {
+               Assert::parameterType( 'string|boolean', $wikiId, '$wikiId' );
+
+               $this->loadBalancer = $loadBalancer;
+               $this->blobStore = $blobStore;
+               $this->cache = $cache;
+               $this->wikiId = $wikiId;
+       }
+
+       /**
+        * @return bool
+        */
+       public function getContentHandlerUseDB() {
+               return $this->contentHandlerUseDB;
+       }
+
+       /**
+        * @param bool $contentHandlerUseDB
+        */
+       public function setContentHandlerUseDB( $contentHandlerUseDB ) {
+               $this->contentHandlerUseDB = $contentHandlerUseDB;
+       }
+
+       /**
+        * @return LoadBalancer
+        */
+       private function getDBLoadBalancer() {
+               return $this->loadBalancer;
+       }
+
+       /**
+        * @param int $mode DB_MASTER or DB_REPLICA
+        *
+        * @return IDatabase
+        */
+       private function getDBConnection( $mode ) {
+               $lb = $this->getDBLoadBalancer();
+               return $lb->getConnection( $mode, [], $this->wikiId );
+       }
+
+       /**
+        * @param IDatabase $connection
+        */
+       private function releaseDBConnection( IDatabase $connection ) {
+               $lb = $this->getDBLoadBalancer();
+               $lb->reuseConnection( $connection );
+       }
+
+       /**
+        * @param int $mode DB_MASTER or DB_REPLICA
+        *
+        * @return DBConnRef
+        */
+       private function getDBConnectionRef( $mode ) {
+               $lb = $this->getDBLoadBalancer();
+               return $lb->getConnectionRef( $mode, [], $this->wikiId );
+       }
+
+       /**
+        * Determines the page Title based on the available information.
+        *
+        * MCR migration note: this corresponds to Revision::getTitle
+        *
+        * @param int|null $pageId
+        * @param int|null $revId
+        * @param int $queryFlags
+        *
+        * @return Title
+        * @throws RevisionAccessException
+        */
+       private function getTitle( $pageId, $revId, $queryFlags = 0 ) {
+               if ( !$pageId && !$revId ) {
+                       throw new InvalidArgumentException( '$pageId and $revId cannot both be 0 or null' );
+               }
+
+               $title = null;
+
+               // Loading by ID is best, but Title::newFromID does not support that for foreign IDs.
+               if ( $pageId !== null && $pageId > 0 && $this->wikiId === false ) {
+                       // TODO: better foreign title handling (introduce TitleFactory)
+                       $title = Title::newFromID( $pageId, $queryFlags );
+               }
+
+               // rev_id is defined as NOT NULL, but this revision may not yet have been inserted.
+               if ( !$title && $revId !== null && $revId > 0 ) {
+                       list( $dbMode, $dbOptions, , ) = DBAccessObjectUtils::getDBOptions( $queryFlags );
+
+                       $dbr = $this->getDbConnectionRef( $dbMode );
+                       // @todo: Title::getSelectFields(), or Title::getQueryInfo(), or something like that
+                       $row = $dbr->selectRow(
+                               [ 'revision', 'page' ],
+                               [
+                                       'page_namespace',
+                                       'page_title',
+                                       'page_id',
+                                       'page_latest',
+                                       'page_is_redirect',
+                                       'page_len',
+                               ],
+                               [ 'rev_id' => $revId ],
+                               __METHOD__,
+                               $dbOptions,
+                               [ 'page' => [ 'JOIN', 'page_id=rev_page' ] ]
+                       );
+                       if ( $row ) {
+                               // TODO: better foreign title handling (introduce TitleFactory)
+                               $title = Title::newFromRow( $row );
+                       }
+               }
+
+               if ( !$title ) {
+                       throw new RevisionAccessException(
+                               "Could not determine title for page ID $pageId and revision ID $revId"
+                       );
+               }
+
+               return $title;
+       }
+
+       /**
+        * @param mixed $value
+        * @param string $name
+        *
+        * @throw IncompleteRevisionException if $value is null
+        * @return mixed $value, if $value is not null
+        */
+       private function failOnNull( $value, $name ) {
+               if ( $value === null ) {
+                       throw new IncompleteRevisionException(
+                               "$name must not be " . var_export( $value, true ) . "!"
+                       );
+               }
+
+               return $value;
+       }
+
+       /**
+        * @param mixed $value
+        * @param string $name
+        *
+        * @throw IncompleteRevisionException if $value is empty
+        * @return mixed $value, if $value is not null
+        */
+       private function failOnEmpty( $value, $name ) {
+               if ( $value === null || $value === 0 || $value === '' ) {
+                       throw new IncompleteRevisionException(
+                               "$name must not be " . var_export( $value, true ) . "!"
+                       );
+               }
+
+               return $value;
+       }
+
+       /**
+        * Insert a new revision into the database, returning the new revision ID
+        * number on success and dies horribly on failure.
+        *
+        * MCR migration note: this replaces Revision::insertOn
+        *
+        * @param RevisionRecord $rev
+        * @param IDatabase $dbw (master connection)
+        *
+        * @throws InvalidArgumentException
+        * @return RevisionRecord the new revision record.
+        */
+       public function insertRevisionOn( RevisionRecord $rev, IDatabase $dbw ) {
+               // TODO: pass in a DBTransactionContext instead of a database connection.
+               $this->checkDatabaseWikiId( $dbw );
+
+               if ( !$rev->getSlotRoles() ) {
+                       throw new InvalidArgumentException( 'At least one slot needs to be defined!' );
+               }
+
+               if ( $rev->getSlotRoles() !== [ 'main' ] ) {
+                       throw new InvalidArgumentException( 'Only the main slot is supported for now!' );
+               }
+
+               // TODO: we shouldn't need an actual Title here.
+               $title = Title::newFromLinkTarget( $rev->getPageAsLinkTarget() );
+               $pageId = $this->failOnEmpty( $rev->getPageId(), 'rev_page field' ); // check this early
+
+               $parentId = $rev->getParentId() === null
+                       ? $this->getPreviousRevisionId( $dbw, $rev )
+                       : $rev->getParentId();
+
+               // Record the text (or external storage URL) to the blob store
+               $slot = $rev->getSlot( 'main', RevisionRecord::RAW );
+
+               $size = $this->failOnNull( $rev->getSize(), 'size field' );
+               $sha1 = $this->failOnEmpty( $rev->getSha1(), 'sha1 field' );
+
+               if ( !$slot->hasAddress() ) {
+                       $content = $slot->getContent();
+                       $format = $content->getDefaultFormat();
+                       $model = $content->getModel();
+
+                       $this->checkContentModel( $content, $title );
+
+                       $data = $content->serialize( $format );
+
+                       // Hints allow the blob store to optimize by "leaking" application level information to it.
+                       // TODO: with the new MCR storage schema, we rev_id have this before storing the blobs.
+                       // When we have it, add rev_id as a hint. Can be used with rev_parent_id for
+                       // differential storage or compression of subsequent revisions.
+                       $blobHints = [
+                               BlobStore::DESIGNATION_HINT => 'page-content', // BlobStore may be used for other things too.
+                               BlobStore::PAGE_HINT => $pageId,
+                               BlobStore::ROLE_HINT => $slot->getRole(),
+                               BlobStore::PARENT_HINT => $parentId,
+                               BlobStore::SHA1_HINT => $slot->getSha1(),
+                               BlobStore::MODEL_HINT => $model,
+                               BlobStore::FORMAT_HINT => $format,
+                       ];
+
+                       $blobAddress = $this->blobStore->storeBlob( $data, $blobHints );
+               } else {
+                       $blobAddress = $slot->getAddress();
+                       $model = $slot->getModel();
+                       $format = $slot->getFormat();
+               }
+
+               $textId = $this->blobStore->getTextIdFromAddress( $blobAddress );
+
+               if ( !$textId ) {
+                       throw new LogicException(
+                               'Blob address not supported in 1.29 database schema: ' . $blobAddress
+                       );
+               }
+
+               // getTextIdFromAddress() is free to insert something into the text table, so $textId
+               // may be a new value, not anything already contained in $blobAddress.
+               $blobAddress = 'tt:' . $textId;
+
+               $comment = $this->failOnNull( $rev->getComment( RevisionRecord::RAW ), 'comment' );
+               $user = $this->failOnNull( $rev->getUser( RevisionRecord::RAW ), 'user' );
+               $timestamp = $this->failOnEmpty( $rev->getTimestamp(), 'timestamp field' );
+
+               # Record the edit in revisions
+               $row = [
+                       'rev_page'       => $pageId,
+                       'rev_parent_id'  => $parentId,
+                       'rev_text_id'    => $textId,
+                       'rev_minor_edit' => $rev->isMinor() ? 1 : 0,
+                       'rev_user'       => $this->failOnNull( $user->getId(), 'user field' ),
+                       'rev_user_text'  => $this->failOnEmpty( $user->getName(), 'user_text field' ),
+                       'rev_timestamp'  => $dbw->timestamp( $timestamp ),
+                       'rev_deleted'    => $rev->getVisibility(),
+                       'rev_len'        => $size,
+                       'rev_sha1'       => $sha1,
+               ];
+
+               if ( $rev->getId() !== null ) {
+                       // Needed to restore revisions with their original ID
+                       $row['rev_id'] = $rev->getId();
+               }
+
+               list( $commentFields, $commentCallback ) =
+                       CommentStore::newKey( 'rev_comment' )->insertWithTempTable( $dbw, $comment );
+               $row += $commentFields;
+
+               if ( $this->contentHandlerUseDB ) {
+                       // MCR migration note: rev_content_model and rev_content_format will go away
+
+                       $defaultModel = ContentHandler::getDefaultModelFor( $title );
+                       $defaultFormat = ContentHandler::getForModelID( $defaultModel )->getDefaultFormat();
+
+                       $row['rev_content_model'] = ( $model === $defaultModel ) ? null : $model;
+                       $row['rev_content_format'] = ( $format === $defaultFormat ) ? null : $format;
+               }
+
+               $dbw->insert( 'revision', $row, __METHOD__ );
+
+               if ( !isset( $row['rev_id'] ) ) {
+                       // only if auto-increment was used
+                       $row['rev_id'] = intval( $dbw->insertId() );
+               }
+               $commentCallback( $row['rev_id'] );
+
+               // Insert IP revision into ip_changes for use when querying for a range.
+               if ( $row['rev_user'] === 0 && IP::isValid( $row['rev_user_text'] ) ) {
+                       $ipcRow = [
+                               'ipc_rev_id'        => $row['rev_id'],
+                               'ipc_rev_timestamp' => $row['rev_timestamp'],
+                               'ipc_hex'           => IP::toHex( $row['rev_user_text'] ),
+                       ];
+                       $dbw->insert( 'ip_changes', $ipcRow, __METHOD__ );
+               }
+
+               $newSlot = SlotRecord::newSaved( $row['rev_id'], $blobAddress, $slot );
+               $slots = new RevisionSlots( [ 'main' => $newSlot ] );
+
+               $user = new UserIdentityValue( intval( $row['rev_user'] ), $row['rev_user_text'] );
+
+               $rev = new RevisionStoreRecord(
+                       $title,
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots,
+                       $this->wikiId
+               );
+
+               $newSlot = $rev->getSlot( 'main', RevisionRecord::RAW );
+
+               // sanity checks
+               Assert::postcondition( $rev->getId() > 0, 'revision must have an ID' );
+               Assert::postcondition( $rev->getPageId() > 0, 'revision must have a page ID' );
+               Assert::postcondition(
+                       $rev->getComment( RevisionRecord::RAW ) !== null,
+                       'revision must have a comment'
+               );
+               Assert::postcondition(
+                       $rev->getUser( RevisionRecord::RAW ) !== null,
+                       'revision must have a user'
+               );
+
+               Assert::postcondition( $newSlot !== null, 'revision must have a main slot' );
+               Assert::postcondition(
+                       $newSlot->getAddress() !== null,
+                       'main slot must have an addess'
+               );
+
+               Hooks::run( 'RevisionRecordInserted', [ $rev ] );
+
+               return $rev;
+       }
+
+       /**
+        * MCR migration note: this corresponds to Revision::checkContentModel
+        *
+        * @param Content $content
+        * @param Title $title
+        *
+        * @throws MWException
+        * @throws MWUnknownContentModelException
+        */
+       private function checkContentModel( Content $content, Title $title ) {
+               // Note: may return null for revisions that have not yet been inserted
+
+               $model = $content->getModel();
+               $format = $content->getDefaultFormat();
+               $handler = $content->getContentHandler();
+
+               $name = "$title";
+
+               if ( !$handler->isSupportedFormat( $format ) ) {
+                       throw new MWException( "Can't use format $format with content model $model on $name" );
+               }
+
+               if ( !$this->contentHandlerUseDB ) {
+                       // if $wgContentHandlerUseDB is not set,
+                       // all revisions must use the default content model and format.
+
+                       $defaultModel = ContentHandler::getDefaultModelFor( $title );
+                       $defaultHandler = ContentHandler::getForModelID( $defaultModel );
+                       $defaultFormat = $defaultHandler->getDefaultFormat();
+
+                       if ( $model != $defaultModel ) {
+                               throw new MWException( "Can't save non-default content model with "
+                                       . "\$wgContentHandlerUseDB disabled: model is $model, "
+                                       . "default for $name is $defaultModel"
+                               );
+                       }
+
+                       if ( $format != $defaultFormat ) {
+                               throw new MWException( "Can't use non-default content format with "
+                                       . "\$wgContentHandlerUseDB disabled: format is $format, "
+                                       . "default for $name is $defaultFormat"
+                               );
+                       }
+               }
+
+               if ( !$content->isValid() ) {
+                       throw new MWException(
+                               "New content for $name is not valid! Content model is $model"
+                       );
+               }
+       }
+
+       /**
+        * Create a new null-revision for insertion into a page's
+        * history. This will not re-save the text, but simply refer
+        * to the text from the previous version.
+        *
+        * Such revisions can for instance identify page rename
+        * operations and other such meta-modifications.
+        *
+        * MCR migration note: this replaces Revision::newNullRevision
+        *
+        * @todo Introduce newFromParentRevision(). newNullRevision can then be based on that
+        * (or go away).
+        *
+        * @param IDatabase $dbw
+        * @param Title $title Title of the page to read from
+        * @param CommentStoreComment $comment RevisionRecord's summary
+        * @param bool $minor Whether the revision should be considered as minor
+        * @param User $user The user to attribute the revision to
+        * @return RevisionRecord|null RevisionRecord or null on error
+        */
+       public function newNullRevision(
+               IDatabase $dbw,
+               Title $title,
+               CommentStoreComment $comment,
+               $minor,
+               User $user
+       ) {
+               $this->checkDatabaseWikiId( $dbw );
+
+               $fields = [ 'page_latest', 'page_namespace', 'page_title',
+                       'rev_id', 'rev_text_id', 'rev_len', 'rev_sha1' ];
+
+               if ( $this->contentHandlerUseDB ) {
+                       $fields[] = 'rev_content_model';
+                       $fields[] = 'rev_content_format';
+               }
+
+               $current = $dbw->selectRow(
+                       [ 'page', 'revision' ],
+                       $fields,
+                       [
+                               'page_id' => $title->getArticleID(),
+                               'page_latest=rev_id',
+                       ],
+                       __METHOD__,
+                       [ 'FOR UPDATE' ] // T51581
+               );
+
+               if ( $current ) {
+                       $fields = [
+                               'page'       => $title->getArticleID(),
+                               'user_text'  => $user->getName(),
+                               'user'       => $user->getId(),
+                               'comment'    => $comment,
+                               'minor_edit' => $minor,
+                               'text_id'    => $current->rev_text_id,
+                               'parent_id'  => $current->page_latest,
+                               'len'        => $current->rev_len,
+                               'sha1'       => $current->rev_sha1
+                       ];
+
+                       if ( $this->contentHandlerUseDB ) {
+                               $fields['content_model'] = $current->rev_content_model;
+                               $fields['content_format'] = $current->rev_content_format;
+                       }
+
+                       $fields['title'] = Title::makeTitle( $current->page_namespace, $current->page_title );
+
+                       $mainSlot = $this->emulateMainSlot_1_29( $fields, 0, $title );
+                       $revision = new MutableRevisionRecord( $title, $this->wikiId );
+                       $this->initializeMutableRevisionFromArray( $revision, $fields );
+                       $revision->setSlot( $mainSlot );
+               } else {
+                       $revision = null;
+               }
+
+               return $revision;
+       }
+
+       /**
+        * MCR migration note: this replaces Revision::isUnpatrolled
+        *
+        * @return int Rcid of the unpatrolled row, zero if there isn't one
+        */
+       public function isUnpatrolled( RevisionRecord $rev ) {
+               $rc = $this->getRecentChange( $rev );
+               if ( $rc && $rc->getAttribute( 'rc_patrolled' ) == 0 ) {
+                       return $rc->getAttribute( 'rc_id' );
+               } else {
+                       return 0;
+               }
+       }
+
+       /**
+        * Get the RC object belonging to the current revision, if there's one
+        *
+        * MCR migration note: this replaces Revision::getRecentChange
+        *
+        * @todo move this somewhere else?
+        *
+        * @param RevisionRecord $rev
+        * @param int $flags (optional) $flags include:
+        *      IDBAccessObject::READ_LATEST: Select the data from the master
+        *
+        * @return null|RecentChange
+        */
+       public function getRecentChange( RevisionRecord $rev, $flags = 0 ) {
+               $dbr = $this->getDBConnection( DB_REPLICA );
+
+               list( $dbType, ) = DBAccessObjectUtils::getDBOptions( $flags );
+
+               $userIdentity = $rev->getUser( RevisionRecord::RAW );
+
+               if ( !$userIdentity ) {
+                       // If the revision has no user identity, chances are it never went
+                       // into the database, and doesn't have an RC entry.
+                       return null;
+               }
+
+               // TODO: Select by rc_this_oldid alone - but as of Nov 2017, there is no index on that!
+               $rc = RecentChange::newFromConds(
+                       [
+                               'rc_user_text' => $userIdentity->getName(),
+                               'rc_timestamp' => $dbr->timestamp( $rev->getTimestamp() ),
+                               'rc_this_oldid' => $rev->getId()
+                       ],
+                       __METHOD__,
+                       $dbType
+               );
+
+               $this->releaseDBConnection( $dbr );
+
+               // XXX: cache this locally? Glue it to the RevisionRecord?
+               return $rc;
+       }
+
+       /**
+        * Maps fields of the archive row to corresponding revision rows.
+        *
+        * @param object $archiveRow
+        *
+        * @return object a revision row object, corresponding to $archiveRow.
+        */
+       private static function mapArchiveFields( $archiveRow ) {
+               $fieldMap = [
+                       // keep with ar prefix:
+                       'ar_id'        => 'ar_id',
+
+                       // not the same suffix:
+                       'ar_page_id'        => 'rev_page',
+                       'ar_rev_id'         => 'rev_id',
+
+                       // same suffix:
+                       'ar_text_id'        => 'rev_text_id',
+                       'ar_timestamp'      => 'rev_timestamp',
+                       'ar_user_text'      => 'rev_user_text',
+                       'ar_user'           => 'rev_user',
+                       'ar_minor_edit'     => 'rev_minor_edit',
+                       'ar_deleted'        => 'rev_deleted',
+                       'ar_len'            => 'rev_len',
+                       'ar_parent_id'      => 'rev_parent_id',
+                       'ar_sha1'           => 'rev_sha1',
+                       'ar_comment'        => 'rev_comment',
+                       'ar_comment_cid'    => 'rev_comment_cid',
+                       'ar_comment_id'     => 'rev_comment_id',
+                       'ar_comment_text'   => 'rev_comment_text',
+                       'ar_comment_data'   => 'rev_comment_data',
+                       'ar_comment_old'    => 'rev_comment_old',
+                       'ar_content_format' => 'rev_content_format',
+                       'ar_content_model'  => 'rev_content_model',
+               ];
+
+               if ( empty( $archiveRow->ar_text_id ) ) {
+                       $fieldMap['ar_text'] = 'old_text';
+                       $fieldMap['ar_flags'] = 'old_flags';
+               }
+
+               $revRow = new stdClass();
+               foreach ( $fieldMap as $arKey => $revKey ) {
+                       if ( property_exists( $archiveRow, $arKey ) ) {
+                               $revRow->$revKey = $archiveRow->$arKey;
+                       }
+               }
+
+               return $revRow;
+       }
+
+       /**
+        * Constructs a RevisionRecord for the revisions main slot, based on the MW1.29 schema.
+        *
+        * @param object|array $row Either a database row or an array
+        * @param int $queryFlags for callbacks
+        * @param Title $title
+        *
+        * @return SlotRecord The main slot, extracted from the MW 1.29 style row.
+        * @throws MWException
+        */
+       private function emulateMainSlot_1_29( $row, $queryFlags, Title $title ) {
+               $mainSlotRow = new stdClass();
+               $mainSlotRow->role_name = 'main';
+
+               $content = null;
+               $blobData = null;
+               $blobFlags = '';
+
+               if ( is_object( $row ) ) {
+                       // archive row
+                       if ( !isset( $row->rev_id ) && isset( $row->ar_user ) ) {
+                               $row = $this->mapArchiveFields( $row );
+                       }
+
+                       if ( isset( $row->rev_text_id ) && $row->rev_text_id > 0 ) {
+                               $mainSlotRow->cont_address = 'tt:' . $row->rev_text_id;
+                       } elseif ( isset( $row->ar_id ) ) {
+                               $mainSlotRow->cont_address = 'ar:' . $row->ar_id;
+                       }
+
+                       if ( isset( $row->old_text ) ) {
+                               // this happens when the text-table gets joined directly, in the pre-1.30 schema
+                               $blobData = isset( $row->old_text ) ? strval( $row->old_text ) : null;
+                               $blobFlags = isset( $row->old_flags ) ? strval( $row->old_flags ) : '';
+                       }
+
+                       $mainSlotRow->slot_revision = intval( $row->rev_id );
+
+                       $mainSlotRow->cont_size = isset( $row->rev_len ) ? intval( $row->rev_len ) : null;
+                       $mainSlotRow->cont_sha1 = isset( $row->rev_sha1 ) ? strval( $row->rev_sha1 ) : null;
+                       $mainSlotRow->model_name = isset( $row->rev_content_model )
+                               ? strval( $row->rev_content_model )
+                               : null;
+                       // XXX: in the future, we'll probably always use the default format, and drop content_format
+                       $mainSlotRow->format_name = isset( $row->rev_content_format )
+                               ? strval( $row->rev_content_format )
+                               : null;
+               } elseif ( is_array( $row ) ) {
+                       $mainSlotRow->slot_revision = isset( $row['id'] ) ? intval( $row['id'] ) : null;
+
+                       $mainSlotRow->cont_address = isset( $row['text_id'] )
+                               ? 'tt:' . intval( $row['text_id'] )
+                               : null;
+                       $mainSlotRow->cont_size = isset( $row['len'] ) ? intval( $row['len'] ) : null;
+                       $mainSlotRow->cont_sha1 = isset( $row['sha1'] ) ? strval( $row['sha1'] ) : null;
+
+                       $mainSlotRow->model_name = isset( $row['content_model'] )
+                               ? strval( $row['content_model'] ) : null;  // XXX: must be a string!
+                       // XXX: in the future, we'll probably always use the default format, and drop content_format
+                       $mainSlotRow->format_name = isset( $row['content_format'] )
+                               ? strval( $row['content_format'] ) : null;
+                       $blobData = isset( $row['text'] ) ? rtrim( strval( $row['text'] ) ) : null;
+                       $blobFlags = isset( $row['flags'] ) ? trim( strval( $row['flags'] ) ) : '';
+
+                       // if we have a Content object, override mText and mContentModel
+                       if ( !empty( $row['content'] ) ) {
+                               if ( !( $row['content'] instanceof Content ) ) {
+                                       throw new MWException( 'content field must contain a Content object.' );
+                               }
+
+                               /** @var Content $content */
+                               $content = $row['content'];
+                               $handler = $content->getContentHandler();
+
+                               $mainSlotRow->model_name = $content->getModel();
+
+                               // XXX: in the future, we'll probably always use the default format.
+                               if ( $mainSlotRow->format_name === null ) {
+                                       $mainSlotRow->format_name = $handler->getDefaultFormat();
+                               }
+                       }
+               } else {
+                       throw new MWException( 'Revision constructor passed invalid row format.' );
+               }
+
+               // With the old schema, the content changes with every revision.
+               // ...except for null-revisions. Would be nice if we could detect them.
+               $mainSlotRow->slot_inherited = 0;
+
+               if ( $mainSlotRow->model_name === null ) {
+                       $mainSlotRow->model_name = function ( SlotRecord $slot ) use ( $title ) {
+                               // TODO: MCR: consider slot role in getDefaultModelFor()! Use LinkTarget!
+                               // TODO: MCR: deprecate $title->getModel().
+                               return ContentHandler::getDefaultModelFor( $title );
+                       };
+               }
+
+               if ( !$content ) {
+                       $content = function ( SlotRecord $slot )
+                               use ( $blobData, $blobFlags, $queryFlags, $mainSlotRow )
+                       {
+                               return $this->loadSlotContent(
+                                       $slot,
+                                       $blobData,
+                                       $blobFlags,
+                                       $mainSlotRow->format_name,
+                                       $queryFlags
+                               );
+                       };
+               }
+
+               return new SlotRecord( $mainSlotRow, $content );
+       }
+
+       /**
+        * Loads a Content object based on a slot row.
+        *
+        * This method does not call $slot->getContent(), and may be used as a callback
+        * called by $slot->getContent().
+        *
+        * MCR migration note: this roughly corresponds to Revision::getContentInternal
+        *
+        * @param SlotRecord $slot The SlotRecord to load content for
+        * @param string|null $blobData The content blob, in the form indicated by $blobFlags
+        * @param string $blobFlags Flags indicating how $blobData needs to be processed
+        * @param string|null $blobFormat MIME type indicating how $dataBlob is encoded
+        * @param int $queryFlags
+        *
+        * @throw RevisionAccessException
+        * @return Content
+        */
+       private function loadSlotContent(
+               SlotRecord $slot,
+               $blobData = null,
+               $blobFlags = '',
+               $blobFormat = null,
+               $queryFlags = 0
+       ) {
+               if ( $blobData !== null ) {
+                       Assert::parameterType( 'string', $blobData, '$blobData' );
+                       Assert::parameterType( 'string', $blobFlags, '$blobFlags' );
+
+                       $cacheKey = $slot->hasAddress() ? $slot->getAddress() : null;
+
+                       $data = $this->blobStore->expandBlob( $blobData, $blobFlags, $cacheKey );
+
+                       if ( $data === false ) {
+                               throw new RevisionAccessException(
+                                       "Failed to expand blob data using flags $blobFlags (key: $cacheKey)"
+                               );
+                       }
+               } else {
+                       $address = $slot->getAddress();
+                       try {
+                               $data = $this->blobStore->getBlob( $address, $queryFlags );
+                       } catch ( BlobAccessException $e ) {
+                               throw new RevisionAccessException(
+                                       "Failed to load data blob from $address: " . $e->getMessage(), 0, $e
+                               );
+                       }
+               }
+
+               // Unserialize content
+               $handler = ContentHandler::getForModelID( $slot->getModel() );
+
+               $content = $handler->unserializeContent( $data, $blobFormat );
+               return $content;
+       }
+
+       /**
+        * Load a page revision from a given revision ID number.
+        * Returns null if no such revision can be found.
+        *
+        * MCR migration note: this replaces Revision::newFromId
+        *
+        * $flags include:
+        *      IDBAccessObject::READ_LATEST: Select the data from the master
+        *      IDBAccessObject::READ_LOCKING : Select & lock the data from the master
+        *
+        * @param int $id
+        * @param int $flags (optional)
+        * @return RevisionRecord|null
+        */
+       public function getRevisionById( $id, $flags = 0 ) {
+               return $this->newRevisionFromConds( [ 'rev_id' => intval( $id ) ], $flags );
+       }
+
+       /**
+        * Load either the current, or a specified, revision
+        * that's attached to a given link target. If not attached
+        * to that link target, will return null.
+        *
+        * MCR migration note: this replaces Revision::newFromTitle
+        *
+        * $flags include:
+        *      IDBAccessObject::READ_LATEST: Select the data from the master
+        *      IDBAccessObject::READ_LOCKING : Select & lock the data from the master
+        *
+        * @param LinkTarget $linkTarget
+        * @param int $revId (optional)
+        * @param int $flags Bitfield (optional)
+        * @return RevisionRecord|null
+        */
+       public function getRevisionByTitle( LinkTarget $linkTarget, $revId = 0, $flags = 0 ) {
+               $conds = [
+                       'page_namespace' => $linkTarget->getNamespace(),
+                       'page_title' => $linkTarget->getDBkey()
+               ];
+               if ( $revId ) {
+                       // Use the specified revision ID.
+                       // Note that we use newRevisionFromConds here because we want to retry
+                       // and fall back to master if the page is not found on a replica.
+                       // Since the caller supplied a revision ID, we are pretty sure the revision is
+                       // supposed to exist, so we should try hard to find it.
+                       $conds['rev_id'] = $revId;
+                       return $this->newRevisionFromConds( $conds, $flags );
+               } else {
+                       // Use a join to get the latest revision.
+                       // Note that we don't use newRevisionFromConds here because we don't want to retry
+                       // and fall back to master. The assumption is that we only want to force the fallback
+                       // if we are quite sure the revision exists because the caller supplied a revision ID.
+                       // If the page isn't found at all on a replica, it probably simply does not exist.
+                       $db = $this->getDBConnection( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
+
+                       $conds[] = 'rev_id=page_latest';
+                       $rev = $this->loadRevisionFromConds( $db, $conds, $flags );
+
+                       $this->releaseDBConnection( $db );
+                       return $rev;
+               }
+       }
+
+       /**
+        * Load either the current, or a specified, revision
+        * that's attached to a given page ID.
+        * Returns null if no such revision can be found.
+        *
+        * MCR migration note: this replaces Revision::newFromPageId
+        *
+        * $flags include:
+        *      IDBAccessObject::READ_LATEST: Select the data from the master (since 1.20)
+        *      IDBAccessObject::READ_LOCKING : Select & lock the data from the master
+        *
+        * @param int $pageId
+        * @param int $revId (optional)
+        * @param int $flags Bitfield (optional)
+        * @return RevisionRecord|null
+        */
+       public function getRevisionByPageId( $pageId, $revId = 0, $flags = 0 ) {
+               $conds = [ 'page_id' => $pageId ];
+               if ( $revId ) {
+                       // Use the specified revision ID.
+                       // Note that we use newRevisionFromConds here because we want to retry
+                       // and fall back to master if the page is not found on a replica.
+                       // Since the caller supplied a revision ID, we are pretty sure the revision is
+                       // supposed to exist, so we should try hard to find it.
+                       $conds['rev_id'] = $revId;
+                       return $this->newRevisionFromConds( $conds, $flags );
+               } else {
+                       // Use a join to get the latest revision.
+                       // Note that we don't use newRevisionFromConds here because we don't want to retry
+                       // and fall back to master. The assumption is that we only want to force the fallback
+                       // if we are quite sure the revision exists because the caller supplied a revision ID.
+                       // If the page isn't found at all on a replica, it probably simply does not exist.
+                       $db = $this->getDBConnection( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
+
+                       $conds[] = 'rev_id=page_latest';
+                       $rev = $this->loadRevisionFromConds( $db, $conds, $flags );
+
+                       $this->releaseDBConnection( $db );
+                       return $rev;
+               }
+       }
+
+       /**
+        * Load the revision for the given title with the given timestamp.
+        * WARNING: Timestamps may in some circumstances not be unique,
+        * so this isn't the best key to use.
+        *
+        * MCR migration note: this replaces Revision::loadFromTimestamp
+        *
+        * @param Title $title
+        * @param string $timestamp
+        * @return RevisionRecord|null
+        */
+       public function getRevisionFromTimestamp( $title, $timestamp ) {
+               return $this->newRevisionFromConds(
+                       [
+                               'rev_timestamp' => $timestamp,
+                               'page_namespace' => $title->getNamespace(),
+                               'page_title' => $title->getDBkey()
+                       ],
+                       0,
+                       $title
+               );
+       }
+
+       /**
+        * Make a fake revision object from an archive table row. This is queried
+        * for permissions or even inserted (as in Special:Undelete)
+        *
+        * MCR migration note: this replaces Revision::newFromArchiveRow
+        *
+        * @param object $row
+        * @param int $queryFlags
+        * @param Title|null $title
+        * @param array $overrides associative array with fields of $row to override. This may be
+        *   used e.g. to force the parent revision ID or page ID. Keys in the array are fields
+        *   names from the archive table without the 'ar_' prefix, i.e. use 'parent_id' to
+        *   override ar_parent_id.
+        *
+        * @return RevisionRecord
+        * @throws MWException
+        */
+       public function newRevisionFromArchiveRow(
+               $row,
+               $queryFlags = 0,
+               Title $title = null,
+               array $overrides = []
+       ) {
+               Assert::parameterType( 'object', $row, '$row' );
+
+               // check second argument, since Revision::newFromArchiveRow had $overrides in that spot.
+               Assert::parameterType( 'integer', $queryFlags, '$queryFlags' );
+
+               if ( !$title && isset( $overrides['title'] ) ) {
+                       if ( !( $overrides['title'] instanceof Title ) ) {
+                               throw new MWException( 'title field override must contain a Title object.' );
+                       }
+
+                       $title = $overrides['title'];
+               }
+
+               if ( !isset( $title ) ) {
+                       if ( isset( $row->ar_namespace ) && isset( $row->ar_title ) ) {
+                               $title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
+                       } else {
+                               throw new InvalidArgumentException(
+                                       'A Title or ar_namespace and ar_title must be given'
+                               );
+                       }
+               }
+
+               foreach ( $overrides as $key => $value ) {
+                       $field = "ar_$key";
+                       $row->$field = $value;
+               }
+
+               $user = $this->getUserIdentityFromRowObject( $row, 'ar_' );
+
+               $comment = CommentStore::newKey( 'ar_comment' )
+                       // Legacy because $row may have come from self::selectFields()
+                       ->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), $row, true );
+
+               $mainSlot = $this->emulateMainSlot_1_29( $row, $queryFlags, $title );
+               $slots = new RevisionSlots( [ 'main' => $mainSlot ] );
+
+               return new RevisionArchiveRecord( $title, $user, $comment, $row, $slots, $this->wikiId );
+       }
+
+       /**
+        * @param object $row
+        * @param string $prefix Field prefix, such as 'rev_' or 'ar_'.
+        *
+        * @return UserIdentityValue
+        */
+       private function getUserIdentityFromRowObject( $row, $prefix = 'rev_' ) {
+               $idField = "{$prefix}user";
+               $nameField = "{$prefix}user_text";
+
+               $userId = intval( $row->$idField );
+
+               if ( isset( $row->user_name ) ) {
+                       $userName = $row->user_name;
+               } elseif ( isset( $row->$nameField ) ) {
+                       $userName = $row->$nameField;
+               } else {
+                       $userName = User::whoIs( $userId );
+               }
+
+               if ( $userName === false ) {
+                       wfWarn( __METHOD__ . ': Cannot determine user name for user ID ' . $userId );
+                       $userName = '';
+               }
+
+               return new UserIdentityValue( $userId, $userName );
+       }
+
+       /**
+        * @see RevisionFactory::newRevisionFromRow_1_29
+        *
+        * MCR migration note: this replaces Revision::newFromRow
+        *
+        * @param object $row
+        * @param int $queryFlags
+        * @param Title|null $title
+        *
+        * @return RevisionRecord
+        * @throws MWException
+        * @throws RevisionAccessException
+        */
+       private function newRevisionFromRow_1_29( $row, $queryFlags = 0, Title $title = null ) {
+               Assert::parameterType( 'object', $row, '$row' );
+
+               if ( !$title ) {
+                       $pageId = isset( $row->rev_page ) ? $row->rev_page : 0; // XXX: also check page_id?
+                       $revId = isset( $row->rev_id ) ? $row->rev_id : 0;
+
+                       $title = $this->getTitle( $pageId, $revId );
+               }
+
+               if ( !isset( $row->page_latest ) ) {
+                       $row->page_latest = $title->getLatestRevID();
+                       if ( $row->page_latest === 0 && $title->exists() ) {
+                               wfWarn( 'Encountered title object in limbo: ID ' . $title->getArticleID() );
+                       }
+               }
+
+               $user = $this->getUserIdentityFromRowObject( $row );
+
+               $comment = CommentStore::newKey( 'rev_comment' )
+                       // Legacy because $row may have come from self::selectFields()
+                       ->getCommentLegacy( $this->getDBConnection( DB_REPLICA ), $row, true );
+
+               $mainSlot = $this->emulateMainSlot_1_29( $row, $queryFlags, $title );
+               $slots = new RevisionSlots( [ 'main' => $mainSlot ] );
+
+               return new RevisionStoreRecord( $title, $user, $comment, $row, $slots, $this->wikiId );
+       }
+
+       /**
+        * @see RevisionFactory::newRevisionFromRow
+        *
+        * MCR migration note: this replaces Revision::newFromRow
+        *
+        * @param object $row
+        * @param int $queryFlags
+        * @param Title|null $title
+        *
+        * @return RevisionRecord
+        */
+       public function newRevisionFromRow( $row, $queryFlags = 0, Title $title = null ) {
+               return $this->newRevisionFromRow_1_29( $row, $queryFlags, $title );
+       }
+
+       /**
+        * Constructs a new MutableRevisionRecord based on the given associative array following
+        * the MW1.29 convention for the Revision constructor.
+        *
+        * MCR migration note: this replaces Revision::newFromRow
+        *
+        * @param array $fields
+        * @param int $queryFlags
+        * @param Title|null $title
+        *
+        * @return MutableRevisionRecord
+        * @throws MWException
+        * @throws RevisionAccessException
+        */
+       public function newMutableRevisionFromArray(
+               array $fields,
+               $queryFlags = 0,
+               Title $title = null
+       ) {
+               if ( !$title && isset( $fields['title'] ) ) {
+                       if ( !( $fields['title'] instanceof Title ) ) {
+                               throw new MWException( 'title field must contain a Title object.' );
+                       }
+
+                       $title = $fields['title'];
+               }
+
+               if ( !$title ) {
+                       $pageId = isset( $fields['page'] ) ? $fields['page'] : 0;
+                       $revId = isset( $fields['id'] ) ? $fields['id'] : 0;
+
+                       $title = $this->getTitle( $pageId, $revId );
+               }
+
+               if ( !isset( $fields['page'] ) ) {
+                       $fields['page'] = $title->getArticleID( $queryFlags );
+               }
+
+               // if we have a content object, use it to set the model and type
+               if ( !empty( $fields['content'] ) ) {
+                       if ( !( $fields['content'] instanceof Content ) ) {
+                               throw new MWException( 'content field must contain a Content object.' );
+                       }
+
+                       if ( !empty( $fields['text_id'] ) ) {
+                               throw new MWException(
+                                       "Text already stored in external store (id {$fields['text_id']}), " .
+                                       "can't serialize content object"
+                               );
+                       }
+               }
+
+               // Replaces old lazy loading logic in Revision::getUserText.
+               if ( !isset( $fields['user_text'] ) && isset( $fields['user'] ) ) {
+                       if ( $fields['user'] instanceof UserIdentity ) {
+                               /** @var User $user */
+                               $user = $fields['user'];
+                               $fields['user_text'] = $user->getName();
+                               $fields['user'] = $user->getId();
+                       } else {
+                               // TODO: wrap this in a callback to make it lazy again.
+                               $name = $fields['user'] === 0 ? false : User::whoIs( $fields['user'] );
+
+                               if ( $name === false ) {
+                                       throw new MWException(
+                                               'user_text not given, and unknown user ID ' . $fields['user']
+                                       );
+                               }
+
+                               $fields['user_text'] = $name;
+                       }
+               }
+
+               if (
+                       isset( $fields['comment'] )
+                       && !( $fields['comment'] instanceof CommentStoreComment )
+               ) {
+                       $commentData = isset( $fields['comment_data'] ) ? $fields['comment_data'] : null;
+
+                       if ( $fields['comment'] instanceof Message ) {
+                               $fields['comment'] = CommentStoreComment::newUnsavedComment(
+                                       $fields['comment'],
+                                       $commentData
+                               );
+                       } else {
+                               $commentText = trim( strval( $fields['comment'] ) );
+                               $fields['comment'] = CommentStoreComment::newUnsavedComment(
+                                       $commentText,
+                                       $commentData
+                               );
+                       }
+               }
+
+               $mainSlot = $this->emulateMainSlot_1_29( $fields, $queryFlags, $title );
+
+               $revision = new MutableRevisionRecord( $title, $this->wikiId );
+               $this->initializeMutableRevisionFromArray( $revision, $fields );
+               $revision->setSlot( $mainSlot );
+
+               return $revision;
+       }
+
+       /**
+        * @param MutableRevisionRecord $record
+        * @param array $fields
+        */
+       private function initializeMutableRevisionFromArray(
+               MutableRevisionRecord $record,
+               array $fields
+       ) {
+               /** @var UserIdentity $user */
+               $user = null;
+
+               if ( isset( $fields['user'] ) && ( $fields['user'] instanceof UserIdentity ) ) {
+                       $user = $fields['user'];
+               } elseif ( isset( $fields['user'] ) && isset( $fields['user_text'] ) ) {
+                       $user = new UserIdentityValue( intval( $fields['user'] ), $fields['user_text'] );
+               } elseif ( isset( $fields['user'] ) ) {
+                       $user = User::newFromId( intval( $fields['user'] ) );
+               } elseif ( isset( $fields['user_text'] ) ) {
+                       $user = User::newFromName( $fields['user_text'] );
+
+                       // User::newFromName will return false for IP addresses (and invalid names)
+                       if ( $user == false ) {
+                               $user = new UserIdentityValue( 0, $fields['user_text'] );
+                       }
+               }
+
+               if ( $user ) {
+                       $record->setUser( $user );
+               }
+
+               $timestamp = isset( $fields['timestamp'] )
+                       ? strval( $fields['timestamp'] )
+                       : wfTimestampNow(); // TODO: use a callback, so we can override it for testing.
+
+               $record->setTimestamp( $timestamp );
+
+               if ( isset( $fields['page'] ) ) {
+                       $record->setPageId( intval( $fields['page'] ) );
+               }
+
+               if ( isset( $fields['id'] ) ) {
+                       $record->setId( intval( $fields['id'] ) );
+               }
+               if ( isset( $fields['parent_id'] ) ) {
+                       $record->setParentId( intval( $fields['parent_id'] ) );
+               }
+
+               if ( isset( $fields['sha1'] ) ) {
+                       $record->setSha1( $fields['sha1'] );
+               }
+               if ( isset( $fields['size'] ) ) {
+                       $record->setSize( intval( $fields['size'] ) );
+               }
+
+               if ( isset( $fields['minor_edit'] ) ) {
+                       $record->setMinorEdit( intval( $fields['minor_edit'] ) !== 0 );
+               }
+               if ( isset( $fields['deleted'] ) ) {
+                       $record->setVisibility( intval( $fields['deleted'] ) );
+               }
+
+               if ( isset( $fields['comment'] ) ) {
+                       Assert::parameterType(
+                               CommentStoreComment::class,
+                               $fields['comment'],
+                               '$row[\'comment\']'
+                       );
+                       $record->setComment( $fields['comment'] );
+               }
+       }
+
+       /**
+        * Load a page revision from a given revision ID number.
+        * Returns null if no such revision can be found.
+        *
+        * MCR migration note: this corresponds to Revision::loadFromId
+        *
+        * @note direct use is deprecated!
+        * @todo remove when unused! there seem to be no callers of Revision::loadFromId
+        *
+        * @param IDatabase $db
+        * @param int $id
+        *
+        * @return RevisionRecord|null
+        */
+       public function loadRevisionFromId( IDatabase $db, $id ) {
+               return $this->loadRevisionFromConds( $db, [ 'rev_id' => intval( $id ) ] );
+       }
+
+       /**
+        * Load either the current, or a specified, revision
+        * that's attached to a given page. If not attached
+        * to that page, will return null.
+        *
+        * MCR migration note: this replaces Revision::loadFromPageId
+        *
+        * @note direct use is deprecated!
+        * @todo remove when unused!
+        *
+        * @param IDatabase $db
+        * @param int $pageid
+        * @param int $id
+        * @return RevisionRecord|null
+        */
+       public function loadRevisionFromPageId( IDatabase $db, $pageid, $id = 0 ) {
+               $conds = [ 'rev_page' => intval( $pageid ), 'page_id' => intval( $pageid ) ];
+               if ( $id ) {
+                       $conds['rev_id'] = intval( $id );
+               } else {
+                       $conds[] = 'rev_id=page_latest';
+               }
+               return $this->loadRevisionFromConds( $db, $conds );
+       }
+
+       /**
+        * Load either the current, or a specified, revision
+        * that's attached to a given page. If not attached
+        * to that page, will return null.
+        *
+        * MCR migration note: this replaces Revision::loadFromTitle
+        *
+        * @note direct use is deprecated!
+        * @todo remove when unused!
+        *
+        * @param IDatabase $db
+        * @param Title $title
+        * @param int $id
+        *
+        * @return RevisionRecord|null
+        */
+       public function loadRevisionFromTitle( IDatabase $db, $title, $id = 0 ) {
+               if ( $id ) {
+                       $matchId = intval( $id );
+               } else {
+                       $matchId = 'page_latest';
+               }
+
+               return $this->loadRevisionFromConds(
+                       $db,
+                       [
+                               "rev_id=$matchId",
+                               'page_namespace' => $title->getNamespace(),
+                               'page_title' => $title->getDBkey()
+                       ],
+                       0,
+                       $title
+               );
+       }
+
+       /**
+        * Load the revision for the given title with the given timestamp.
+        * WARNING: Timestamps may in some circumstances not be unique,
+        * so this isn't the best key to use.
+        *
+        * MCR migration note: this replaces Revision::loadFromTimestamp
+        *
+        * @note direct use is deprecated! Use getRevisionFromTimestamp instead!
+        * @todo remove when unused!
+        *
+        * @param IDatabase $db
+        * @param Title $title
+        * @param string $timestamp
+        * @return RevisionRecord|null
+        */
+       public function loadRevisionFromTimestamp( IDatabase $db, $title, $timestamp ) {
+               return $this->loadRevisionFromConds( $db,
+                       [
+                               'rev_timestamp' => $db->timestamp( $timestamp ),
+                               'page_namespace' => $title->getNamespace(),
+                               'page_title' => $title->getDBkey()
+                       ],
+                       0,
+                       $title
+               );
+       }
+
+       /**
+        * Given a set of conditions, fetch a revision
+        *
+        * This method should be used if we are pretty sure the revision exists.
+        * Unless $flags has READ_LATEST set, this method will first try to find the revision
+        * on a replica before hitting the master database.
+        *
+        * MCR migration note: this corresponds to Revision::newFromConds
+        *
+        * @param array $conditions
+        * @param int $flags (optional)
+        * @param Title $title
+        *
+        * @return RevisionRecord|null
+        */
+       private function newRevisionFromConds( $conditions, $flags = 0, Title $title = null ) {
+               $db = $this->getDBConnection( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
+               $rev = $this->loadRevisionFromConds( $db, $conditions, $flags, $title );
+               $this->releaseDBConnection( $db );
+
+               $lb = $this->getDBLoadBalancer();
+
+               // Make sure new pending/committed revision are visibile later on
+               // within web requests to certain avoid bugs like T93866 and T94407.
+               if ( !$rev
+                       && !( $flags & self::READ_LATEST )
+                       && $lb->getServerCount() > 1
+                       && $lb->hasOrMadeRecentMasterChanges()
+               ) {
+                       $flags = self::READ_LATEST;
+                       $db = $this->getDBConnection( DB_MASTER );
+                       $rev = $this->loadRevisionFromConds( $db, $conditions, $flags, $title );
+                       $this->releaseDBConnection( $db );
+               }
+
+               return $rev;
+       }
+
+       /**
+        * Given a set of conditions, fetch a revision from
+        * the given database connection.
+        *
+        * MCR migration note: this corresponds to Revision::loadFromConds
+        *
+        * @param IDatabase $db
+        * @param array $conditions
+        * @param int $flags (optional)
+        * @param Title $title
+        *
+        * @return RevisionRecord|null
+        */
+       private function loadRevisionFromConds(
+               IDatabase $db,
+               $conditions,
+               $flags = 0,
+               Title $title = null
+       ) {
+               $row = $this->fetchRevisionRowFromConds( $db, $conditions, $flags );
+               if ( $row ) {
+                       $rev = $this->newRevisionFromRow( $row, $flags, $title );
+
+                       return $rev;
+               }
+
+               return null;
+       }
+
+       /**
+        * Throws an exception if the given database connection does not belong to the wiki this
+        * RevisionStore is bound to.
+        *
+        * @param IDatabase $db
+        * @throws MWException
+        */
+       private function checkDatabaseWikiId( IDatabase $db ) {
+               $storeWiki = $this->wikiId;
+               $dbWiki = $db->getDomainID();
+
+               if ( $dbWiki === $storeWiki ) {
+                       return;
+               }
+
+               // XXX: we really want the default database ID...
+               $storeWiki = $storeWiki ?: wfWikiID();
+               $dbWiki = $dbWiki ?: wfWikiID();
+
+               if ( $dbWiki !== $storeWiki ) {
+                       throw new MWException( "RevisionStore for $storeWiki "
+                               . "cannot be used with a DB connection for $dbWiki" );
+               }
+       }
+
+       /**
+        * Given a set of conditions, return a row with the
+        * fields necessary to build RevisionRecord objects.
+        *
+        * MCR migration note: this corresponds to Revision::fetchFromConds
+        *
+        * @param IDatabase $db
+        * @param array $conditions
+        * @param int $flags (optional)
+        *
+        * @return object|false data row as a raw object
+        */
+       private function fetchRevisionRowFromConds( IDatabase $db, $conditions, $flags = 0 ) {
+               $this->checkDatabaseWikiId( $db );
+
+               $revQuery = self::getQueryInfo( [ 'page', 'user' ] );
+               $options = [];
+               if ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING ) {
+                       $options[] = 'FOR UPDATE';
+               }
+               return $db->selectRow(
+                       $revQuery['tables'],
+                       $revQuery['fields'],
+                       $conditions,
+                       __METHOD__,
+                       $options,
+                       $revQuery['joins']
+               );
+       }
+
+       /**
+        * Return the tables, fields, and join conditions to be selected to create
+        * a new revision object.
+        *
+        * MCR migration note: this replaces Revision::getQueryInfo
+        *
+        * @since 1.31
+        *
+        * @param array $options Any combination of the following strings
+        *  - 'page': Join with the page table, and select fields to identify the page
+        *  - 'user': Join with the user table, and select the user name
+        *  - 'text': Join with the text table, and select fields to load page text
+        *
+        * @return array With three keys:
+        *  - tables: (string[]) to include in the `$table` to `IDatabase->select()`
+        *  - fields: (string[]) to include in the `$vars` to `IDatabase->select()`
+        *  - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
+        */
+       public function getQueryInfo( $options = [] ) {
+               $ret = [
+                       'tables' => [],
+                       'fields' => [],
+                       'joins'  => [],
+               ];
+
+               $ret['tables'][] = 'revision';
+               $ret['fields'] = array_merge( $ret['fields'], [
+                       'rev_id',
+                       'rev_page',
+                       'rev_text_id',
+                       'rev_timestamp',
+                       'rev_user_text',
+                       'rev_user',
+                       'rev_minor_edit',
+                       'rev_deleted',
+                       'rev_len',
+                       'rev_parent_id',
+                       'rev_sha1',
+               ] );
+
+               $commentQuery = CommentStore::newKey( 'rev_comment' )->getJoin();
+               $ret['tables'] = array_merge( $ret['tables'], $commentQuery['tables'] );
+               $ret['fields'] = array_merge( $ret['fields'], $commentQuery['fields'] );
+               $ret['joins'] = array_merge( $ret['joins'], $commentQuery['joins'] );
+
+               if ( $this->contentHandlerUseDB ) {
+                       $ret['fields'][] = 'rev_content_format';
+                       $ret['fields'][] = 'rev_content_model';
+               }
+
+               if ( in_array( 'page', $options, true ) ) {
+                       $ret['tables'][] = 'page';
+                       $ret['fields'] = array_merge( $ret['fields'], [
+                               'page_namespace',
+                               'page_title',
+                               'page_id',
+                               'page_latest',
+                               'page_is_redirect',
+                               'page_len',
+                       ] );
+                       $ret['joins']['page'] = [ 'INNER JOIN', [ 'page_id = rev_page' ] ];
+               }
+
+               if ( in_array( 'user', $options, true ) ) {
+                       $ret['tables'][] = 'user';
+                       $ret['fields'] = array_merge( $ret['fields'], [
+                               'user_name',
+                       ] );
+                       $ret['joins']['user'] = [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ];
+               }
+
+               if ( in_array( 'text', $options, true ) ) {
+                       $ret['tables'][] = 'text';
+                       $ret['fields'] = array_merge( $ret['fields'], [
+                               'old_text',
+                               'old_flags'
+                       ] );
+                       $ret['joins']['text'] = [ 'INNER JOIN', [ 'rev_text_id=old_id' ] ];
+               }
+
+               return $ret;
+       }
+
+       /**
+        * Return the tables, fields, and join conditions to be selected to create
+        * a new archived revision object.
+        *
+        * MCR migration note: this replaces Revision::getArchiveQueryInfo
+        *
+        * @since 1.31
+        *
+        * @return array With three keys:
+        *   - tables: (string[]) to include in the `$table` to `IDatabase->select()`
+        *   - fields: (string[]) to include in the `$vars` to `IDatabase->select()`
+        *   - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
+        */
+       public function getArchiveQueryInfo() {
+               $commentQuery = CommentStore::newKey( 'ar_comment' )->getJoin();
+               $ret = [
+                       'tables' => [ 'archive' ] + $commentQuery['tables'],
+                       'fields' => [
+                                       'ar_id',
+                                       'ar_page_id',
+                                       'ar_namespace',
+                                       'ar_title',
+                                       'ar_rev_id',
+                                       'ar_text',
+                                       'ar_text_id',
+                                       'ar_timestamp',
+                                       'ar_user_text',
+                                       'ar_user',
+                                       'ar_minor_edit',
+                                       'ar_deleted',
+                                       'ar_len',
+                                       'ar_parent_id',
+                                       'ar_sha1',
+                               ] + $commentQuery['fields'],
+                       'joins' => $commentQuery['joins'],
+               ];
+
+               if ( $this->contentHandlerUseDB ) {
+                       $ret['fields'][] = 'ar_content_format';
+                       $ret['fields'][] = 'ar_content_model';
+               }
+
+               return $ret;
+       }
+
+       /**
+        * Do a batched query for the sizes of a set of revisions.
+        *
+        * MCR migration note: this replaces Revision::getParentLengths
+        *
+        * @param IDatabase $db
+        * @param int[] $revIds
+        * @return int[] associative array mapping revision IDs from $revIds to the nominal size
+        *         of the corresponding revision.
+        */
+       public function listRevisionSizes( IDatabase $db, array $revIds ) {
+               $this->checkDatabaseWikiId( $db );
+
+               $revLens = [];
+               if ( !$revIds ) {
+                       return $revLens; // empty
+               }
+
+               $res = $db->select(
+                       'revision',
+                       [ 'rev_id', 'rev_len' ],
+                       [ 'rev_id' => $revIds ],
+                       __METHOD__
+               );
+
+               foreach ( $res as $row ) {
+                       $revLens[$row->rev_id] = intval( $row->rev_len );
+               }
+
+               return $revLens;
+       }
+
+       /**
+        * Get previous revision for this title
+        *
+        * MCR migration note: this replaces Revision::getPrevious
+        *
+        * @param RevisionRecord $rev
+        *
+        * @return RevisionRecord|null
+        */
+       public function getPreviousRevision( RevisionRecord $rev ) {
+               $title = $this->getTitle( $rev->getPageId(), $rev->getId() );
+               $prev = $title->getPreviousRevisionID( $rev->getId() );
+               if ( $prev ) {
+                       return $this->getRevisionByTitle( $title, $prev );
+               }
+               return null;
+       }
+
+       /**
+        * Get next revision for this title
+        *
+        * MCR migration note: this replaces Revision::getNext
+        *
+        * @param RevisionRecord $rev
+        *
+        * @return RevisionRecord|null
+        */
+       public function getNextRevision( RevisionRecord $rev ) {
+               $title = $this->getTitle( $rev->getPageId(), $rev->getId() );
+               $next = $title->getNextRevisionID( $rev->getId() );
+               if ( $next ) {
+                       return $this->getRevisionByTitle( $title, $next );
+               }
+               return null;
+       }
+
+       /**
+        * Get previous revision Id for this page_id
+        * This is used to populate rev_parent_id on save
+        *
+        * MCR migration note: this corresponds to Revision::getPreviousRevisionId
+        *
+        * @param IDatabase $db
+        * @param RevisionRecord $rev
+        *
+        * @return int
+        */
+       private function getPreviousRevisionId( IDatabase $db, RevisionRecord $rev ) {
+               $this->checkDatabaseWikiId( $db );
+
+               if ( $rev->getPageId() === null ) {
+                       return 0;
+               }
+               # Use page_latest if ID is not given
+               if ( !$rev->getId() ) {
+                       $prevId = $db->selectField(
+                               'page', 'page_latest',
+                               [ 'page_id' => $rev->getPageId() ],
+                               __METHOD__
+                       );
+               } else {
+                       $prevId = $db->selectField(
+                               'revision', 'rev_id',
+                               [ 'rev_page' => $rev->getPageId(), 'rev_id < ' . $rev->getId() ],
+                               __METHOD__,
+                               [ 'ORDER BY' => 'rev_id DESC' ]
+                       );
+               }
+               return intval( $prevId );
+       }
+
+       /**
+        * Get rev_timestamp from rev_id, without loading the rest of the row
+        *
+        * MCR migration note: this replaces Revision::getTimestampFromId
+        *
+        * @param Title $title
+        * @param int $id
+        * @param int $flags
+        * @return string|bool False if not found
+        */
+       public function getTimestampFromId( $title, $id, $flags = 0 ) {
+               $db = $this->getDBConnection(
+                       ( $flags & IDBAccessObject::READ_LATEST ) ? DB_MASTER : DB_REPLICA
+               );
+
+               $conds = [ 'rev_id' => $id ];
+               $conds['rev_page'] = $title->getArticleID();
+               $timestamp = $db->selectField( 'revision', 'rev_timestamp', $conds, __METHOD__ );
+
+               $this->releaseDBConnection( $db );
+               return ( $timestamp !== false ) ? wfTimestamp( TS_MW, $timestamp ) : false;
+       }
+
+       /**
+        * Get count of revisions per page...not very efficient
+        *
+        * MCR migration note: this replaces Revision::countByPageId
+        *
+        * @param IDatabase $db
+        * @param int $id Page id
+        * @return int
+        */
+       public function countRevisionsByPageId( IDatabase $db, $id ) {
+               $this->checkDatabaseWikiId( $db );
+
+               $row = $db->selectRow( 'revision',
+                       [ 'revCount' => 'COUNT(*)' ],
+                       [ 'rev_page' => $id ],
+                       __METHOD__
+               );
+               if ( $row ) {
+                       return intval( $row->revCount );
+               }
+               return 0;
+       }
+
+       /**
+        * Get count of revisions per page...not very efficient
+        *
+        * MCR migration note: this replaces Revision::countByTitle
+        *
+        * @param IDatabase $db
+        * @param Title $title
+        * @return int
+        */
+       public function countRevisionsByTitle( IDatabase $db, $title ) {
+               $id = $title->getArticleID();
+               if ( $id ) {
+                       return $this->countRevisionsByPageId( $db, $id );
+               }
+               return 0;
+       }
+
+       /**
+        * Check if no edits were made by other users since
+        * the time a user started editing the page. Limit to
+        * 50 revisions for the sake of performance.
+        *
+        * MCR migration note: this replaces Revision::userWasLastToEdit
+        *
+        * @deprecated since 1.31; Can possibly be removed, since the self-conflict suppression
+        *       logic in EditPage that uses this seems conceptually dubious. Revision::userWasLastToEdit
+        *       has been deprecated since 1.24.
+        *
+        * @param IDatabase $db The Database to perform the check on.
+        * @param int $pageId The ID of the page in question
+        * @param int $userId The ID of the user in question
+        * @param string $since Look at edits since this time
+        *
+        * @return bool True if the given user was the only one to edit since the given timestamp
+        */
+       public function userWasLastToEdit( IDatabase $db, $pageId, $userId, $since ) {
+               $this->checkDatabaseWikiId( $db );
+
+               if ( !$userId ) {
+                       return false;
+               }
+
+               $res = $db->select(
+                       'revision',
+                       'rev_user',
+                       [
+                               'rev_page' => $pageId,
+                               'rev_timestamp > ' . $db->addQuotes( $db->timestamp( $since ) )
+                       ],
+                       __METHOD__,
+                       [ 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 50 ]
+               );
+               foreach ( $res as $row ) {
+                       if ( $row->rev_user != $userId ) {
+                               return false;
+                       }
+               }
+               return true;
+       }
+
+       /**
+        * Load a revision based on a known page ID and current revision ID from the DB
+        *
+        * This method allows for the use of caching, though accessing anything that normally
+        * requires permission checks (aside from the text) will trigger a small DB lookup.
+        *
+        * MCR migration note: this replaces Revision::newKnownCurrent
+        *
+        * @param Title $title the associated page title
+        * @param int $revId current revision of this page. Defaults to $title->getLatestRevID().
+        *
+        * @return RevisionRecord|bool Returns false if missing
+        */
+       public function getKnownCurrentRevision( Title $title, $revId ) {
+               $db = $this->getDBConnectionRef( DB_REPLICA );
+
+               $pageId = $title->getArticleID();
+
+               if ( !$pageId ) {
+                       return false;
+               }
+
+               if ( !$revId ) {
+                       $revId = $title->getLatestRevID();
+               }
+
+               if ( !$revId ) {
+                       wfWarn(
+                               'No latest revision known for page ' . $title->getPrefixedDBkey()
+                               . ' even though it exists with page ID ' . $pageId
+                       );
+                       return false;
+               }
+
+               $row = $this->cache->getWithSetCallback(
+                       // Page/rev IDs passed in from DB to reflect history merges
+                       $this->cache->makeGlobalKey( 'revision-row-1.29', $db->getDomainID(), $pageId, $revId ),
+                       WANObjectCache::TTL_WEEK,
+                       function ( $curValue, &$ttl, array &$setOpts ) use ( $db, $pageId, $revId ) {
+                               $setOpts += Database::getCacheSetOptions( $db );
+
+                               $conds = [
+                                       'rev_page' => intval( $pageId ),
+                                       'page_id' => intval( $pageId ),
+                                       'rev_id' => intval( $revId ),
+                               ];
+
+                               $row = $this->fetchRevisionRowFromConds( $db, $conds );
+                               return $row ?: false; // don't cache negatives
+                       }
+               );
+
+               // Reflect revision deletion and user renames
+               if ( $row ) {
+                       return $this->newRevisionFromRow( $row, 0, $title );
+               } else {
+                       return false;
+               }
+       }
+
+       // TODO: move relevant methods from Title here, e.g. getFirstRevision, isBigDeletion, etc.
+
+}
diff --git a/includes/Storage/RevisionStoreRecord.php b/includes/Storage/RevisionStoreRecord.php
new file mode 100644 (file)
index 0000000..50ae8d5
--- /dev/null
@@ -0,0 +1,207 @@
+<?php
+/**
+ * A RevisionRecord representing an existing revision persisted in the revision table.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use CommentStoreComment;
+use InvalidArgumentException;
+use MediaWiki\User\UserIdentity;
+use Title;
+use User;
+use Wikimedia\Assert\Assert;
+
+/**
+ * A RevisionRecord representing an existing revision persisted in the revision table.
+ * RevisionStoreRecord has no optional fields, getters will never return null.
+ *
+ * @since 1.31
+ */
+class RevisionStoreRecord extends RevisionRecord {
+
+       /** @var bool */
+       protected $mCurrent = false;
+
+       /**
+        * @note Avoid calling this constructor directly. Use the appropriate methods
+        * in RevisionStore instead.
+        *
+        * @param Title $title The title of the page this Revision is associated with.
+        * @param UserIdentity $user
+        * @param CommentStoreComment $comment
+        * @param object $row A row from the revision table. Use RevisionStore::getQueryInfo() to build
+        *        a query that yields the required fields.
+        * @param RevisionSlots $slots The slots of this revision.
+        * @param bool|string $wikiId the wiki ID of the site this Revision belongs to,
+        *        or false for the local site.
+        */
+       function __construct(
+               Title $title,
+               UserIdentity $user,
+               CommentStoreComment $comment,
+               $row,
+               RevisionSlots $slots,
+               $wikiId = false
+       ) {
+               parent::__construct( $title, $slots, $wikiId );
+               Assert::parameterType( 'object', $row, '$row' );
+
+               $this->mId = intval( $row->rev_id );
+               $this->mPageId = intval( $row->rev_page );
+               $this->mComment = $comment;
+
+               $timestamp = wfTimestamp( TS_MW, $row->rev_timestamp );
+               Assert::parameter( is_string( $timestamp ), '$row->rev_timestamp', 'must be a valid timestamp' );
+
+               $this->mUser = $user;
+               $this->mMinorEdit = boolval( $row->rev_minor_edit );
+               $this->mTimestamp = $timestamp;
+               $this->mDeleted = intval( $row->rev_deleted );
+
+               // NOTE: rev_parent_id = 0 indicates that there is no parent revision, while null
+               // indicates that the parent revision is unknown. As per MW 1.31, the database schema
+               // allows rev_parent_id to be NULL.
+               $this->mParentId = isset( $row->rev_parent_id ) ? intval( $row->rev_parent_id ) : null;
+               $this->mSize = isset( $row->rev_len ) ? intval( $row->rev_len ) : null;
+               $this->mSha1 = isset( $row->rev_sha1 ) ? $row->rev_sha1 : null;
+
+               // NOTE: we must not call $this->mTitle->getLatestRevID() here, since the state of
+               // page_latest may be in limbo during revision creation. In that case, calling
+               // $this->mTitle->getLatestRevID() would cause a bad value to be cached in the Title
+               // object. During page creation, that bad value would be 0.
+               if ( isset( $row->page_latest ) ) {
+                       $this->mCurrent = ( $row->rev_id == $row->page_latest );
+               }
+
+               // sanity check
+               if (
+                       $this->mPageId && $this->mTitle->exists()
+                       && $this->mPageId !== $this->mTitle->getArticleID()
+               ) {
+                       throw new InvalidArgumentException(
+                               'The given Title does not belong to page ID ' . $this->mPageId
+                       );
+               }
+       }
+
+       /**
+        * MCR migration note: this replaces Revision::isCurrent
+        *
+        * @return bool
+        */
+       public function isCurrent() {
+               return $this->mCurrent;
+       }
+
+       /**
+        * MCR migration note: this replaces Revision::isDeleted
+        *
+        * @param int $field One of DELETED_* bitfield constants
+        *
+        * @return bool
+        */
+       public function isDeleted( $field ) {
+               if ( $this->isCurrent() && $field === self::DELETED_TEXT ) {
+                       // Current revisions of pages cannot have the content hidden. Skipping this
+                       // check is very useful for Parser as it fetches templates using newKnownCurrent().
+                       // Calling getVisibility() in that case triggers a verification database query.
+                       return false; // no need to check
+               }
+
+               return parent::isDeleted( $field );
+       }
+
+       protected function userCan( $field, User $user ) {
+               if ( $this->isCurrent() && $field === self::DELETED_TEXT ) {
+                       // Current revisions of pages cannot have the content hidden. Skipping this
+                       // check is very useful for Parser as it fetches templates using newKnownCurrent().
+                       // Calling getVisibility() in that case triggers a verification database query.
+                       return true; // no need to check
+               }
+
+               return parent::userCan( $field, $user );
+       }
+
+       /**
+        * @return int The revision id, never null.
+        */
+       public function getId() {
+               // overwritten just to add a guarantee to the contract
+               return parent::getId();
+       }
+
+       /**
+        * @return string The nominal revision size, never null. May be computed on the fly.
+        */
+       public function getSize() {
+               // If length is null, calculate and remember it (potentially SLOW!).
+               // This is for compatibility with old database rows that don't have the field set.
+               if ( $this->mSize === null ) {
+                       $this->mSize = $this->mSlots->computeSize();
+               }
+
+               return $this->mSize;
+       }
+
+       /**
+        * @return string The revision hash, never null. May be computed on the fly.
+        */
+       public function getSha1() {
+               // If hash is null, calculate it and remember (potentially SLOW!)
+               // This is for compatibility with old database rows that don't have the field set.
+               if ( $this->mSha1 === null ) {
+                       $this->mSha1 = $this->mSlots->computeSha1();
+               }
+
+               return $this->mSha1;
+       }
+
+       /**
+        * @param int $audience
+        * @param User|null $user
+        *
+        * @return UserIdentity The identity of the revision author, null if access is forbidden.
+        */
+       public function getUser( $audience = self::FOR_PUBLIC, User $user = null ) {
+               // overwritten just to add a guarantee to the contract
+               return parent::getUser( $audience, $user );
+       }
+
+       /**
+        * @param int $audience
+        * @param User|null $user
+        *
+        * @return CommentStoreComment The revision comment, null if access is forbidden.
+        */
+       public function getComment( $audience = self::FOR_PUBLIC, User $user = null ) {
+               // overwritten just to add a guarantee to the contract
+               return parent::getComment( $audience, $user );
+       }
+
+       /**
+        * @return string timestamp, never null
+        */
+       public function getTimestamp() {
+               // overwritten just to add a guarantee to the contract
+               return parent::getTimestamp();
+       }
+
+}
diff --git a/includes/Storage/SlotRecord.php b/includes/Storage/SlotRecord.php
new file mode 100644 (file)
index 0000000..8769330
--- /dev/null
@@ -0,0 +1,430 @@
+<?php
+/**
+ * Value object representing a content slot associated with a page revision.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use Content;
+use LogicException;
+use OutOfBoundsException;
+use Wikimedia\Assert\Assert;
+
+/**
+ * Value object representing a content slot associated with a page revision.
+ * SlotRecord provides direct access to a Content object.
+ * That access may be implemented through a callback.
+ *
+ * @since 1.31
+ */
+class SlotRecord {
+
+       /**
+        * @var object database result row, as a raw object
+        */
+       private $row;
+
+       /**
+        * @var Content|callable
+        */
+       private $content;
+
+       /**
+        * Returns a new SlotRecord just like the given $slot, except that calling getContent()
+        * will fail with an exception.
+        *
+        * @param SlotRecord $slot
+        *
+        * @return SlotRecord
+        */
+       public static function newWithSuppressedContent( SlotRecord $slot ) {
+               $row = $slot->row;
+
+               return new SlotRecord( $row, function () {
+                       throw new SuppressedDataException( 'Content suppressed!' );
+               } );
+       }
+
+       /**
+        * Constructs a new SlotRecord from an existing SlotRecord, overriding some fields.
+        * The slot's content cannot be overwritten.
+        *
+        * @param SlotRecord $slot
+        * @param array $overrides
+        *
+        * @return SlotRecord
+        */
+       private static function newDerived( SlotRecord $slot, array $overrides = [] ) {
+               $row = $slot->row;
+
+               foreach ( $overrides as $key => $value ) {
+                       $row->$key = $value;
+               }
+
+               return new SlotRecord( $row, $slot->content );
+       }
+
+       /**
+        * Constructs a new SlotRecord for a new revision, inheriting the content of the given SlotRecord
+        * of a previous revision.
+        *
+        * @param SlotRecord $slot
+        *
+        * @return SlotRecord
+        */
+       public static function newInherited( SlotRecord $slot ) {
+               return self::newDerived( $slot, [
+                       'slot_inherited' => true,
+                       'slot_revision' => null,
+               ] );
+       }
+
+       /**
+        * Constructs a new Slot from a Content object for a new revision.
+        * This is the preferred way to construct a slot for storing Content that
+        * resulted from a user edit.
+        *
+        * @param string $role
+        * @param Content $content
+        * @param bool $inherited
+        *
+        * @return SlotRecord
+        */
+       public static function newUnsaved( $role, Content $content, $inherited = false ) {
+               Assert::parameterType( 'boolean', $inherited, '$inherited' );
+               Assert::parameterType( 'string', $role, '$role' );
+
+               $row = [
+                       'slot_id' => null, // not yet known
+                       'slot_address' => null, // not yet known. need setter?
+                       'slot_revision' => null, // not yet known
+                       'slot_inherited' => $inherited,
+                       'cont_size' => null, // compute later
+                       'cont_sha1' => null, // compute later
+                       'role_name' => $role,
+                       'model_name' => $content->getModel(),
+               ];
+
+               return new SlotRecord( (object)$row, $content );
+       }
+
+       /**
+        * Constructs a SlotRecord for a newly saved revision, based on the proto-slot that was
+        * supplied to the code that performed the save operation. This adds information that
+        * has only become available during saving, particularly the revision ID and blob address.
+        *
+        * @param int $revisionId
+        * @param string $blobAddress
+        * @param SlotRecord $protoSlot The proto-slot that was provided to the code that then
+        *
+        * @return SlotRecord
+        */
+       public static function newSaved( $revisionId, $blobAddress, SlotRecord $protoSlot ) {
+               Assert::parameterType( 'integer', $revisionId, '$revisionId' );
+               Assert::parameterType( 'string', $blobAddress, '$blobAddress' );
+
+               return self::newDerived( $protoSlot, [
+                       'slot_revision' => $revisionId,
+                       'cont_address' => $blobAddress,
+               ] );
+       }
+
+       /**
+        * SlotRecord constructor.
+        *
+        * The following fields are supported by the $row parameter:
+        *
+        *   $row->blob_data
+        *   $row->blob_address
+        *
+        * @param object $row A database row composed of fields of the slot and content tables,
+        *        as a raw object. Any field value can be a callback that produces the field value
+        *        given this SlotRecord as a parameter. However, plain strings cannot be used as
+        *        callbacks here, for security reasons.
+        * @param Content|callable $content The content object associated with the slot, or a
+        *        callback that will return that Content object, given this SlotRecord as a parameter.
+        */
+       public function __construct( $row, $content ) {
+               Assert::parameterType( 'object', $row, '$row' );
+               Assert::parameterType( 'Content|callable', $content, '$content' );
+
+               $this->row = $row;
+               $this->content = $content;
+       }
+
+       /**
+        * Implemented to defy serialization.
+        *
+        * @throws LogicException always
+        */
+       public function __sleep() {
+               throw new LogicException( __CLASS__ . ' is not serializable.' );
+       }
+
+       /**
+        * Returns the Content of the given slot.
+        *
+        * @note This is free to load Content from whatever subsystem is necessary,
+        * performing potentially expensive operations and triggering I/O-related
+        * failure modes.
+        *
+        * @note This method does not apply audience filtering.
+        *
+        * @throws SuppressedDataException if access to the content is not allowed according
+        * to the audience check performed by RevisionRecord::getSlot().
+        *
+        * @return Content The slot's content. This is a direct reference to the internal instance,
+        * copy before exposing to application logic!
+        */
+       public function getContent() {
+               if ( $this->content instanceof Content ) {
+                       return $this->content;
+               }
+
+               $obj = call_user_func( $this->content, $this );
+
+               Assert::postcondition(
+                       $obj instanceof Content,
+                       'Slot content callback should return a Content object'
+               );
+
+               $this->content = $obj;
+
+               return $this->content;
+       }
+
+       /**
+        * Returns the string value of a data field from the database row supplied to the constructor.
+        * If the field was set to a callback, that callback is invoked and the result returned.
+        *
+        * @param string $name
+        *
+        * @throws OutOfBoundsException
+        * @return mixed Returns the field's value, or null if the field is NULL in the DB row.
+        */
+       private function getField( $name ) {
+               if ( !isset( $this->row->$name ) ) {
+                       // distinguish between unknown and uninitialized fields
+                       if ( property_exists( $this->row, $name ) ) {
+                               throw new IncompleteRevisionException( 'Uninitialized field: ' . $name );
+                       } else {
+                               throw new OutOfBoundsException( 'No such field: ' . $name );
+                       }
+               }
+
+               $value = $this->row->$name;
+
+               // NOTE: allow callbacks, but don't trust plain string callables from the database!
+               if ( !is_string( $value ) && is_callable( $value ) ) {
+                       $value = call_user_func( $value, $this );
+                       $this->setField( $name, $value );
+               }
+
+               return $value;
+       }
+
+       /**
+        * Returns the string value of a data field from the database row supplied to the constructor.
+        *
+        * @param string $name
+        *
+        * @throws OutOfBoundsException
+        * @throws IncompleteRevisionException
+        * @return string Returns the string value
+        */
+       private function getStringField( $name ) {
+               return strval( $this->getField( $name ) );
+       }
+
+       /**
+        * Returns the int value of a data field from the database row supplied to the constructor.
+        *
+        * @param string $name
+        *
+        * @throws OutOfBoundsException
+        * @throws IncompleteRevisionException
+        * @return int Returns the int value
+        */
+       private function getIntField( $name ) {
+               return intval( $this->getField( $name ) );
+       }
+
+       /**
+        * @param string $name
+        * @return bool whether this record contains the given field
+        */
+       private function hasField( $name ) {
+               return isset( $this->row->$name );
+       }
+
+       /**
+        * Returns the ID of the revision this slot is associated with.
+        *
+        * @return int
+        */
+       public function getRevision() {
+               return $this->getIntField( 'slot_revision' );
+       }
+
+       /**
+        * Whether this slot was inherited from an older revision.
+        *
+        * @return bool
+        */
+       public function isInherited() {
+               return $this->getIntField( 'slot_inherited' ) !== 0;
+       }
+
+       /**
+        * Whether this slot has an address. Slots will have an address if their
+        * content has been stored. While building a new revision,
+        * SlotRecords will not have an address associated.
+        *
+        * @return bool
+        */
+       public function hasAddress() {
+               return $this->hasField( 'cont_address' );
+       }
+
+       /**
+        * Whether this slot has revision ID associated. Slots will have a revision ID associated
+        * only if they were loaded as part of an existing revision. While building a new revision,
+        * Slotrecords will not have a revision ID associated.
+        *
+        * @return bool
+        */
+       public function hasRevision() {
+               return $this->hasField( 'slot_revision' );
+       }
+
+       /**
+        * Returns the role of the slot.
+        *
+        * @return string
+        */
+       public function getRole() {
+               return $this->getStringField( 'role_name' );
+       }
+
+       /**
+        * Returns the address of this slot's content.
+        * This address can be used with BlobStore to load the Content object.
+        *
+        * @return string
+        */
+       public function getAddress() {
+               return $this->getStringField( 'cont_address' );
+       }
+
+       /**
+        * Returns the content size
+        *
+        * @return int size of the content, in bogo-bytes, as reported by Content::getSize.
+        */
+       public function getSize() {
+               try {
+                       $size = $this->getIntField( 'cont_size' );
+               } catch ( IncompleteRevisionException $ex ) {
+                       $size = $this->getContent()->getSize();
+                       $this->setField( 'cont_size', $size );
+               }
+
+               return $size;
+       }
+
+       /**
+        * Returns the content size
+        *
+        * @return string hash of the content.
+        */
+       public function getSha1() {
+               try {
+                       $sha1 = $this->getStringField( 'cont_sha1' );
+               } catch ( IncompleteRevisionException $ex ) {
+                       $format = $this->hasField( 'format_name' )
+                               ? $this->getStringField( 'format_name' )
+                               : null;
+
+                       $data = $this->getContent()->serialize( $format );
+                       $sha1 = self::base36Sha1( $data );
+                       $this->setField( 'cont_sha1', $sha1 );
+               }
+
+               return $sha1;
+       }
+
+       /**
+        * Returns the content model. This is the model name that decides
+        * which ContentHandler is appropriate for interpreting the
+        * data of the blob referenced by the address returned by getAddress().
+        *
+        * @return string the content model of the content
+        */
+       public function getModel() {
+               try {
+                       $model = $this->getStringField( 'model_name' );
+               } catch ( IncompleteRevisionException $ex ) {
+                       $model = $this->getContent()->getModel();
+                       $this->setField( 'model_name', $model );
+               }
+
+               return $model;
+       }
+
+       /**
+        * Returns the blob serialization format as a MIME type.
+        *
+        * @note When this method returns null, the caller is expected
+        * to auto-detect the serialization format, or to rely on
+        * the default format associated with the content model.
+        *
+        * @return string|null
+        */
+       public function getFormat() {
+               // XXX: we currently do not plan to store the format for each slot!
+
+               if ( $this->hasField( 'format_name' ) ) {
+                       return $this->getStringField( 'format_name' );
+               }
+
+               return null;
+       }
+
+       /**
+        * @param string $name
+        * @param string|int|null $value
+        */
+       private function setField( $name, $value ) {
+               $this->row->$name = $value;
+       }
+
+       /**
+        * Get the base 36 SHA-1 value for a string of text
+        *
+        * MCR migration note: this replaces Revision::base36Sha1
+        *
+        * @param string $blob
+        * @return string
+        */
+       public static function base36Sha1( $blob ) {
+               return \Wikimedia\base_convert( sha1( $blob ), 16, 36, 31 );
+       }
+
+}
diff --git a/includes/Storage/SqlBlobStore.php b/includes/Storage/SqlBlobStore.php
new file mode 100644 (file)
index 0000000..0714633
--- /dev/null
@@ -0,0 +1,580 @@
+<?php
+/**
+ * Service for storing and loading data blobs representing revision content.
+ *
+ * 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
+ *
+ * Attribution notice: when this file was created, much of its content was taken
+ * from the Revision.php file as present in release 1.30. Refer to the history
+ * of that file for original authorship.
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+use DBAccessObjectUtils;
+use ExternalStore;
+use IDBAccessObject;
+use IExpiringStore;
+use InvalidArgumentException;
+use Language;
+use MWException;
+use WANObjectCache;
+use Wikimedia\Assert\Assert;
+use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\LoadBalancer;
+
+/**
+ * Service for storing and loading Content objects.
+ *
+ * @since 1.31
+ *
+ * @note This was written to act as a drop-in replacement for the corresponding
+ *       static methods in Revision.
+ */
+class SqlBlobStore implements IDBAccessObject, BlobStore {
+
+       // Note: the name has been taken unchanged from the Revision class.
+       const TEXT_CACHE_GROUP = 'revisiontext:10';
+
+       /**
+        * @var LoadBalancer
+        */
+       private $dbLoadBalancer;
+
+       /**
+        * @var WANObjectCache
+        */
+       private $cache;
+
+       /**
+        * @var bool|string Wiki ID
+        */
+       private $wikiId;
+
+       /**
+        * @var int
+        */
+       private $cacheExpiry = 604800; // 7 days
+
+       /**
+        * @var bool
+        */
+       private $compressBlobs = false;
+
+       /**
+        * @var bool|string
+        */
+       private $legacyEncoding = false;
+
+       /**
+        * @var Language|null
+        */
+       private $legacyEncodingConversionLang = null;
+
+       /**
+        * @var boolean
+        */
+       private $useExternalStore = false;
+
+       /**
+        * @param LoadBalancer $dbLoadBalancer A load balancer for acquiring database connections
+        * @param WANObjectCache $cache A cache manager for caching blobs
+        * @param bool|string $wikiId The ID of the target wiki database. Use false for the local wiki.
+        */
+       public function __construct(
+               LoadBalancer $dbLoadBalancer,
+               WANObjectCache $cache,
+               $wikiId = false
+       ) {
+               $this->dbLoadBalancer = $dbLoadBalancer;
+               $this->cache = $cache;
+               $this->wikiId = $wikiId;
+       }
+
+       /**
+        * @return int time for which blobs can be cached, in seconds
+        */
+       public function getCacheExpiry() {
+               return $this->cacheExpiry;
+       }
+
+       /**
+        * @param int $cacheExpiry time for which blobs can be cached, in seconds
+        */
+       public function setCacheExpiry( $cacheExpiry ) {
+               Assert::parameterType( 'integer', $cacheExpiry, '$cacheExpiry' );
+
+               $this->cacheExpiry = $cacheExpiry;
+       }
+
+       /**
+        * @return bool whether blobs should be compressed for storage
+        */
+       public function getCompressBlobs() {
+               return $this->compressBlobs;
+       }
+
+       /**
+        * @param bool $compressBlobs whether blobs should be compressed for storage
+        */
+       public function setCompressBlobs( $compressBlobs ) {
+               $this->compressBlobs = $compressBlobs;
+       }
+
+       /**
+        * @return false|string The legacy encoding to assume for blobs that are not marked as utf8.
+        *         False means handling of legacy encoding is disabled, and utf8 assumed.
+        */
+       public function getLegacyEncoding() {
+               return $this->legacyEncoding;
+       }
+
+       /**
+        * @return Language|null The locale to use when decoding from a legacy encoding, or null
+        *         if handling of legacy encoding is disabled.
+        */
+       public function getLegacyEncodingConversionLang() {
+               return $this->legacyEncodingConversionLang;
+       }
+
+       /**
+        * @param string $legacyEncoding The legacy encoding to assume for blobs that are
+        *        not marked as utf8.
+        * @param Language $language The locale to use when decoding from a legacy encoding.
+        */
+       public function setLegacyEncoding( $legacyEncoding, Language $language ) {
+               Assert::parameterType( 'string', $legacyEncoding, '$legacyEncoding' );
+
+               $this->legacyEncoding = $legacyEncoding;
+               $this->legacyEncodingConversionLang = $language;
+       }
+
+       /**
+        * @return bool Whether to use the ExternalStore mechanism for storing blobs.
+        */
+       public function getUseExternalStore() {
+               return $this->useExternalStore;
+       }
+
+       /**
+        * @param bool $useExternalStore Whether to use the ExternalStore mechanism for storing blobs.
+        */
+       public function setUseExternalStore( $useExternalStore ) {
+               Assert::parameterType( 'boolean', $useExternalStore, '$useExternalStore' );
+
+               $this->useExternalStore = $useExternalStore;
+       }
+
+       /**
+        * @return LoadBalancer
+        */
+       private function getDBLoadBalancer() {
+               return $this->dbLoadBalancer;
+       }
+
+       /**
+        * @param int $index A database index, like DB_MASTER or DB_REPLICA
+        *
+        * @return IDatabase
+        */
+       private function getDBConnection( $index ) {
+               $lb = $this->getDBLoadBalancer();
+               return $lb->getConnection( $index, [], $this->wikiId );
+       }
+
+       /**
+        * Stores an arbitrary blob of data and returns an address that can be used with
+        * getBlob() to retrieve the same blob of data,
+        *
+        * @param string $data
+        * @param array $hints An array of hints.
+        *
+        * @throws BlobAccessException
+        * @return string an address that can be used with getBlob() to retrieve the data.
+        */
+       public function storeBlob( $data, $hints = [] ) {
+               try {
+                       $flags = $this->compressData( $data );
+
+                       # Write to external storage if required
+                       if ( $this->useExternalStore ) {
+                               // Store and get the URL
+                               $data = ExternalStore::insertToDefault( $data );
+                               if ( !$data ) {
+                                       throw new BlobAccessException( "Failed to store text to external storage" );
+                               }
+                               if ( $flags ) {
+                                       $flags .= ',';
+                               }
+                               $flags .= 'external';
+
+                               // TODO: we could also return an address for the external store directly here.
+                               // That would mean bypassing the text table entirely when the external store is
+                               // used. We'll need to assess expected fallout before doing that.
+                       }
+
+                       $dbw = $this->getDBConnection( DB_REPLICA );
+
+                       $old_id = $dbw->nextSequenceValue( 'text_old_id_seq' );
+                       $dbw->insert(
+                               'text',
+                               [
+                                       'old_id' => $old_id,
+                                       'old_text' => $data,
+                                       'old_flags' => $flags,
+                               ],
+                               __METHOD__
+                       );
+
+                       $textId = $dbw->insertId();
+
+                       return 'tt:' . $textId;
+               } catch ( MWException $e ) {
+                       throw new BlobAccessException( $e->getMessage(), 0, $e );
+               }
+       }
+
+       /**
+        * Retrieve a blob, given an address.
+        * Currently hardcoded to the 'text' table storage engine.
+        *
+        * MCR migration note: this replaces Revision::loadText
+        *
+        * @param string $blobAddress
+        * @param int $queryFlags
+        *
+        * @throws BlobAccessException
+        * @return string
+        */
+       public function getBlob( $blobAddress, $queryFlags = 0 ) {
+               Assert::parameterType( 'string', $blobAddress, '$blobAddress' );
+
+               // No negative caching; negative hits on text rows may be due to corrupted replica DBs
+               $blob = $this->cache->getWithSetCallback(
+                       // TODO: change key, since this is not necessarily revision text!
+                       $this->cache->makeKey( 'revisiontext', 'textid', $blobAddress ),
+                       $this->getCacheTTL(),
+                       function () use ( $blobAddress, $queryFlags ) {
+                               return $this->fetchBlob( $blobAddress, $queryFlags );
+                       },
+                       [ 'pcGroup' => self::TEXT_CACHE_GROUP, 'pcTTL' => IExpiringStore::TTL_PROC_LONG ]
+               );
+
+               if ( $blob === false ) {
+                       throw new BlobAccessException( 'Failed to load blob from address ' . $blobAddress );
+               }
+
+               return $blob;
+       }
+
+       /**
+        * MCR migration note: this corresponds to Revision::fetchText
+        *
+        * @param string $blobAddress
+        * @param int $queryFlags
+        *
+        * @throw BlobAccessException
+        * @return string|false
+        */
+       private function fetchBlob( $blobAddress, $queryFlags ) {
+               list( $schema, $id, ) = self::splitBlobAddress( $blobAddress );
+
+               //TODO: MCR: also support 'ex' schema with ExternalStore URLs, plus flags encoded in the URL!
+               //TODO: MCR: also support 'ar' schema for content blobs in old style archive rows!
+               if ( $schema === 'tt' ) {
+                       $textId = intval( $id );
+               } else {
+                       // XXX: change to better exceptions! That makes migration more difficult, though.
+                       throw new BlobAccessException( "Unknown blob address schema: $schema" );
+               }
+
+               if ( !$textId || $id !== (string)$textId ) {
+                       // XXX: change to better exceptions! That makes migration more difficult, though.
+                       throw new BlobAccessException( "Bad blob address: $blobAddress" );
+               }
+
+               // Callers doing updates will pass in READ_LATEST as usual. Since the text/blob tables
+               // do not normally get rows changed around, set READ_LATEST_IMMUTABLE in those cases.
+               $queryFlags |= DBAccessObjectUtils::hasFlags( $queryFlags, self::READ_LATEST )
+                       ? self::READ_LATEST_IMMUTABLE
+                       : 0;
+
+               list( $index, $options, $fallbackIndex, $fallbackOptions ) =
+                       DBAccessObjectUtils::getDBOptions( $queryFlags );
+
+               // Text data is immutable; check replica DBs first.
+               $row = $this->getDBConnection( $index )->selectRow(
+                       'text',
+                       [ 'old_text', 'old_flags' ],
+                       [ 'old_id' => $textId ],
+                       __METHOD__,
+                       $options
+               );
+
+               // Fallback to DB_MASTER in some cases if the row was not found, using the appropriate
+               // options, such as FOR UPDATE to avoid missing rows due to REPEATABLE-READ.
+               if ( !$row && $fallbackIndex !== null ) {
+                       $row = $this->getDBConnection( $fallbackIndex )->selectRow(
+                               'text',
+                               [ 'old_text', 'old_flags' ],
+                               [ 'old_id' => $textId ],
+                               __METHOD__,
+                               $fallbackOptions
+                       );
+               }
+
+               if ( !$row ) {
+                       wfWarn( __METHOD__ . ": No text row with ID $textId." );
+                       return false;
+               }
+
+               $blob = $this->expandBlob( $row->old_text, $row->old_flags, $blobAddress );
+
+               if ( $blob === false ) {
+                       wfWarn( __METHOD__ . ": Bad data in text row $textId." );
+                       return false;
+               }
+
+               return $blob;
+       }
+
+       /**
+        * Expand a raw data blob according to the flags given.
+        *
+        * MCR migration note: this replaces Revision::getRevisionText
+        *
+        * @note direct use is deprecated, use getBlob() or SlotRecord::getContent() instead.
+        * @todo make this private, there should be no need to use this method outside this class.
+        *
+        * @param string $raw The raw blob data, to be processed according to $flags.
+        *        May be the blob itself, or the blob compressed, or just the address
+        *        of the actual blob, depending on $flags.
+        * @param string|string[] $flags Blob flags, such as 'external' or 'gzip'.
+        * @param string|null $cacheKey May be used for caching if given
+        *
+        * @return false|string The expanded blob or false on failure
+        */
+       public function expandBlob( $raw, $flags, $cacheKey = null ) {
+               if ( is_string( $flags ) ) {
+                       $flags = explode( ',', $flags );
+               }
+
+               // Use external methods for external objects, text in table is URL-only then
+               if ( in_array( 'external', $flags ) ) {
+                       $url = $raw;
+                       $parts = explode( '://', $url, 2 );
+                       if ( count( $parts ) == 1 || $parts[1] == '' ) {
+                               return false;
+                       }
+
+                       if ( $cacheKey ) {
+                               // Make use of the wiki-local revision text cache.
+                               // The cached value should be decompressed, so handle that and return here.
+                               // NOTE: we rely on $this->cache being the right cache for $this->wikiId!
+                               return $this->cache->getWithSetCallback(
+                                       // TODO: change key, since this is not necessarily revision text!
+                                       $this->cache->makeKey( 'revisiontext', 'textid', $cacheKey ),
+                                       $this->getCacheTTL(),
+                                       function () use ( $url, $flags ) {
+                                               // No negative caching per BlobStore::getBlob()
+                                               $blob = ExternalStore::fetchFromURL( $url, [ 'wiki' => $this->wikiId ] );
+
+                                               return $this->decompressData( $blob, $flags );
+                                       },
+                                       [ 'pcGroup' => self::TEXT_CACHE_GROUP, 'pcTTL' => WANObjectCache::TTL_PROC_LONG ]
+                               );
+                       } else {
+                               $blob = ExternalStore::fetchFromURL( $url, [ 'wiki' => $this->wikiId ] );
+                               return $this->decompressData( $blob, $flags );
+                       }
+               } else {
+                       return $this->decompressData( $raw, $flags );
+               }
+       }
+
+       /**
+        * If $wgCompressRevisions is enabled, we will compress data.
+        * The input string is modified in place.
+        * Return value is the flags field: contains 'gzip' if the
+        * data is compressed, and 'utf-8' if we're saving in UTF-8
+        * mode.
+        *
+        * MCR migration note: this replaces Revision::compressRevisionText
+        *
+        * @note direct use is deprecated!
+        * @todo make this private, there should be no need to use this method outside this class.
+        *
+        * @param mixed &$blob Reference to a text
+        *
+        * @return string
+        */
+       public function compressData( &$blob ) {
+               $blobFlags = [];
+
+               // Revisions not marked as UTF-8 will have legacy decoding applied by decompressData().
+               // XXX: if $this->legacyEncoding is not set, we could skip this. May be risky, though.
+               $blobFlags[] = 'utf-8';
+
+               if ( $this->compressBlobs ) {
+                       if ( function_exists( 'gzdeflate' ) ) {
+                               $deflated = gzdeflate( $blob );
+
+                               if ( $deflated === false ) {
+                                       wfLogWarning( __METHOD__ . ': gzdeflate() failed' );
+                               } else {
+                                       $blob = $deflated;
+                                       $blobFlags[] = 'gzip';
+                               }
+                       } else {
+                               wfDebug( __METHOD__ . " -- no zlib support, not compressing\n" );
+                       }
+               }
+               return implode( ',', $blobFlags );
+       }
+
+       /**
+        * Re-converts revision text according to its flags.
+        *
+        * MCR migration note: this replaces Revision::decompressRevisionText
+        *
+        * @note direct use is deprecated, use getBlob() or SlotRecord::getContent() instead.
+        * @todo make this private, there should be no need to use this method outside this class.
+        *
+        * @param mixed $blob Reference to a text
+        * @param array $blobFlags Compression flags
+        *
+        * @return string|bool Decompressed text, or false on failure
+        */
+       public function decompressData( $blob, $blobFlags ) {
+               if ( $blob === false ) {
+                       // Text failed to be fetched; nothing to do
+                       return false;
+               }
+
+               if ( in_array( 'gzip', $blobFlags ) ) {
+                       # Deal with optional compression of archived pages.
+                       # This can be done periodically via maintenance/compressOld.php, and
+                       # as pages are saved if $wgCompressRevisions is set.
+                       $blob = gzinflate( $blob );
+
+                       if ( $blob === false ) {
+                               wfLogWarning( __METHOD__ . ': gzinflate() failed' );
+                               return false;
+                       }
+               }
+
+               if ( in_array( 'object', $blobFlags ) ) {
+                       # Generic compressed storage
+                       $obj = unserialize( $blob );
+                       if ( !is_object( $obj ) ) {
+                               // Invalid object
+                               return false;
+                       }
+                       $blob = $obj->getText();
+               }
+
+               // Needed to support old revisions left over from from the 1.4 / 1.5 migration.
+               if ( $blob !== false && $this->legacyEncoding && $this->legacyEncodingConversionLang
+                       && !in_array( 'utf-8', $blobFlags ) && !in_array( 'utf8', $blobFlags )
+               ) {
+                       # Old revisions kept around in a legacy encoding?
+                       # Upconvert on demand.
+                       # ("utf8" checked for compatibility with some broken
+                       #  conversion scripts 2008-12-30)
+                       $blob = $this->legacyEncodingConversionLang->iconv( $this->legacyEncoding, 'UTF-8', $blob );
+               }
+
+               return $blob;
+       }
+
+       /**
+        * Get the text cache TTL
+        *
+        * MCR migration note: this replaces Revision::getCacheTTL
+        *
+        * @return int
+        */
+       private function getCacheTTL() {
+               if ( $this->cache->getQoS( WANObjectCache::ATTR_EMULATION )
+                               <= WANObjectCache::QOS_EMULATION_SQL
+               ) {
+                       // Do not cache RDBMs blobs in...the RDBMs store
+                       $ttl = WANObjectCache::TTL_UNCACHEABLE;
+               } else {
+                       $ttl = $this->cacheExpiry ?: WANObjectCache::TTL_UNCACHEABLE;
+               }
+
+               return $ttl;
+       }
+
+       /**
+        * Returns an ID corresponding to the old_id field in the text table, corresponding
+        * to the given $address.
+        *
+        * Currently, $address must start with 'tt:' followed by a decimal integer representing
+        * the old_id; if $address does not start with 'tt:', null is returned. However,
+        * the implementation may change to insert rows into the text table on the fly.
+        *
+        * @note This method exists for use with the text table based storage schema.
+        * It should not be assumed that is will function with all future kinds of content addresses.
+        *
+        * @deprecated since 1.31, so not assume that all blob addresses refer to a row in the text
+        * table. This method should become private once the relevant refactoring in WikiPage is
+        * complete.
+        *
+        * @param string $address
+        *
+        * @return int|null
+        */
+       public function getTextIdFromAddress( $address ) {
+               list( $schema, $id, ) = self::splitBlobAddress( $address );
+
+               if ( $schema !== 'tt' ) {
+                       return null;
+               }
+
+               $textId = intval( $id );
+
+               if ( !$textId || $id !== (string)$textId ) {
+                       throw new InvalidArgumentException( "Malformed text_id: $id" );
+               }
+
+               return $textId;
+       }
+
+       /**
+        * Splits a blob address into three parts: the schema, the ID, and parameters/flags.
+        *
+        * @param string $address
+        *
+        * @throws InvalidArgumentException
+        * @return array [ $schema, $id, $parameters ], with $parameters being an assoc array.
+        */
+       private static function splitBlobAddress( $address ) {
+               if ( !preg_match( '/^(\w+):(\w+)(\?(.*))?$/', $address, $m ) ) {
+                       throw new InvalidArgumentException( "Bad blob address: $address" );
+               }
+
+               $schema = strtolower( $m[1] );
+               $id = $m[2];
+               $parameters = isset( $m[4] ) ? wfCgiToArray( $m[4] ) : [];
+
+               return [ $schema, $id, $parameters ];
+       }
+
+}
diff --git a/includes/Storage/SuppressedDataException.php b/includes/Storage/SuppressedDataException.php
new file mode 100644 (file)
index 0000000..24f16a6
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Exception representing a failure to look up a revision.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Storage;
+
+/**
+ * Exception raised in response to an audience check when attempting to
+ * access suppressed information without permission.
+ *
+ * @since 1.31
+ */
+class SuppressedDataException extends RevisionAccessException {
+
+}
index 0e964bf..85e8db6 100644 (file)
@@ -335,8 +335,8 @@ class HistoryAction extends FormlessAction {
         * @return FeedItem
         */
        function feedItem( $row ) {
-               $rev = new Revision( $row );
-               $rev->setTitle( $this->getTitle() );
+               $rev = new Revision( $row, 0, $this->getTitle() );
+
                $text = FeedUtils::formatDiffRow(
                        $this->getTitle(),
                        $this->getTitle()->getPreviousRevisionID( $rev->getId() ),
@@ -639,12 +639,10 @@ class HistoryPager extends ReverseChronologicalPager {
         */
        function historyLine( $row, $next, $notificationtimestamp = false,
                $latest = false, $firstInList = false ) {
-               $rev = new Revision( $row );
-               $rev->setTitle( $this->getTitle() );
+               $rev = new Revision( $row, 0, $this->getTitle() );
 
                if ( is_object( $next ) ) {
-                       $prevRev = new Revision( $next );
-                       $prevRev->setTitle( $this->getTitle() );
+                       $prevRev = new Revision( $next, 0, $this->getTitle() );
                } else {
                        $prevRev = null;
                }
index edc1a3e..3bda3e8 100644 (file)
@@ -1933,7 +1933,7 @@ class ApiMain extends ApiBase {
                        $id = Sanitizer::escapeIdForAttribute( 'main/datatypes', Sanitizer::ID_PRIMARY );
                        $idFallback = Sanitizer::escapeIdForAttribute( 'main/datatypes', Sanitizer::ID_FALLBACK );
                        $headline = Linker::makeHeadline( min( 6, $level ),
-                               ' class="apihelp-header"',
+                               ' class="apihelp-header">',
                                $id,
                                $header,
                                '',
@@ -1961,7 +1961,7 @@ class ApiMain extends ApiBase {
                        $id = Sanitizer::escapeIdForAttribute( 'main/credits', Sanitizer::ID_PRIMARY );
                        $idFallback = Sanitizer::escapeIdForAttribute( 'main/credits', Sanitizer::ID_FALLBACK );
                        $headline = Linker::makeHeadline( min( 6, $level ),
-                               ' class="apihelp-header"',
+                               ' class="apihelp-header">',
                                $id,
                                $header,
                                '',
index ba8d2f9..85b65cf 100644 (file)
        "apihelp-query+search-param-prop": "Eigenschaften zur Rückgabe:",
        "apihelp-query+search-param-qiprofile": "Zu verwendendes anfrageunabhängiges Profil (wirkt sich auf den Ranking-Algorithmus aus).",
        "apihelp-query+search-paramvalue-prop-wordcount": "Ergänzt den Wortzähler der Seite.",
+       "apihelp-query+search-paramvalue-prop-extensiondata": "Ergänzt zusätzliche von Erweiterungen erzeugte Daten.",
        "apihelp-query+search-param-limit": "Wie viele Seiten insgesamt zurückgegeben werden sollen.",
        "apihelp-query+search-example-simple": "Nach <kbd>meaning</kbd> suchen.",
        "apihelp-query+search-example-text": "Texte nach <kbd>meaning</kbd> durchsuchen.",
index b84057e..ef5f50d 100644 (file)
        "apihelp-query+search-paramvalue-prop-sectiontitle": "Añade el título de la sección correspondiente.",
        "apihelp-query+search-paramvalue-prop-categorysnippet": "Añade un fragmento analizado de la categoría correspondiente.",
        "apihelp-query+search-paramvalue-prop-isfilematch": "Añade un booleano que indica si la búsqueda corresponde al contenido del archivo.",
+       "apihelp-query+search-paramvalue-prop-extensiondata": "Añade datos adicionales generados por las extensiones.",
        "apihelp-query+search-paramvalue-prop-score": "Ignorado.",
        "apihelp-query+search-paramvalue-prop-hasrelated": "Ignorado",
        "apihelp-query+search-param-limit": "Cuántas páginas en total se devolverán.",
index a56b42f..d9bf39c 100644 (file)
@@ -28,7 +28,8 @@
                        "Pols12",
                        "The RedBurn",
                        "Umherirrender",
-                       "Thibaut120094"
+                       "Thibaut120094",
+                       "KATRINE1992"
                ]
        },
        "apihelp-main-extended-description": "<div class=\"hlist plainlinks api-main-links\">\n* [[mw:Special:MyLanguage/API:Main_page|Documentation]]\n* [[mw:Special:MyLanguage/API:FAQ|FAQ]]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api Liste de diffusion]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce Annonces de l’API]\n* [https://phabricator.wikimedia.org/maniphest/query/GebfyV4uCaLd/#R Bogues et demandes]\n</div>\n<strong>État :</strong> Toutes les fonctionnalités affichées sur cette page devraient fonctionner, mais l’API est encore en cours de développement et peut changer à tout moment. Inscrivez-vous à [https://lists.wikimedia.org/pipermail/mediawiki-api-announce/ la liste de diffusion mediawiki-api-announce] pour être informé des mises à jour.\n\n<strong>Requêtes erronées :</strong> Si des requêtes erronées sont envoyées à l’API, un entête HTTP sera renvoyé avec la clé « MediaWiki-API-Error ». La valeur de cet entête et le code d’erreur renvoyé prendront la même valeur. Pour plus d’information, voyez [[mw:Special:MyLanguage/API:Errors_and_warnings|API: Errors and warnings]].\n\n<strong>Test :</strong> Pour faciliter le test des requêtes de l’API, voyez [[Special:ApiSandbox]].",
        "apihelp-query+search-paramvalue-prop-sectiontitle": "Ajoute le titre de la section correspondante.",
        "apihelp-query+search-paramvalue-prop-categorysnippet": "Ajoute un extrait analysé de la catégorie correspondante.",
        "apihelp-query+search-paramvalue-prop-isfilematch": "Ajoute un booléen indiquant si la recherche correspond au contenu du fichier.",
+       "apihelp-query+search-paramvalue-prop-extensiondata": "Va ajouter des données générées supplémentaires par extension.",
        "apihelp-query+search-paramvalue-prop-score": "Ignoré.",
        "apihelp-query+search-paramvalue-prop-hasrelated": "Ignoré.",
        "apihelp-query+search-param-limit": "Combien de pages renvoyer au total.",
index aa21cd7..fb36923 100644 (file)
        "api-help-param-direction": "En que dirección enumerar:\n;newer:Lista os máis antigos primeiro. Nota: $1start ten que estar antes que $1end.\n;older:Lista os máis novos primeiro (por defecto). Nota: $1start ten que estar despois que $1end.",
        "api-help-param-continue": "Cando estean dispoñibles máis resultados, use isto para continuar.",
        "api-help-param-no-description": "<span class=\"apihelp-empty\">(sen descrición)</span>",
+       "api-help-param-maxbytes": "Non pode ser máis longo que $1 {{PLURAL:$1|byte|bytes}}.",
+       "api-help-param-maxchars": "Non pode ser máis longo que $1 {{PLURAL:$1|carácter|caracteres}}.",
        "api-help-examples": "{{PLURAL:$1|Exemplo|Exemplos}}:",
        "api-help-permissions": "{{PLURAL:$1|Permiso|Permisos}}:",
        "api-help-permissions-granted-to": "{{PLURAL:$1|Concedida a|Concedidas a}}: $2",
index 2726944..6f4c6a3 100644 (file)
        "apihelp-query+logevents-param-prop": "Kurias savybes gauti:",
        "apihelp-query+logevents-paramvalue-prop-ids": "Prideda žurnalo įvykio ID.",
        "apihelp-query+logevents-paramvalue-prop-type": "Prideda žurnalo įvykio tipą.",
+       "apihelp-query+search-paramvalue-prop-extensiondata": "Prideda papildomus duomenis, sugeneruotus plėtinių.",
        "apihelp-query+transcludedin-paramvalue-prop-pageid": "Kiekvieno puslapio ID.",
        "apihelp-query+transcludedin-paramvalue-prop-title": "Kiekvieno puslapio pavadinimas.",
        "apihelp-query+transcludedin-param-limit": "Kiek gražinti.",
index f2ba86a..2a3bb6b 100644 (file)
@@ -66,6 +66,7 @@
        "apihelp-compare-param-totitle": "Andre tittel å sammenligne.",
        "apihelp-compare-param-toid": "Andre side-ID å sammenligne.",
        "apihelp-compare-param-torev": "Andre revisjon å sammenligne.",
+       "apihelp-compare-param-torelative": "Bruk en revisjon som er relativ til revisjonen som hentes fra <var>fromtitle</var>, <var>fromid</var> eller <var>fromrev</var>. Alle de andre «to»-alternativene vil ignoreres.",
        "apihelp-compare-param-totext": "Bruk denne teksten i stedet for innholdet i revisjonen spesifisert av <var>totitle</var>, <var>toid</var> eller <var>torev</var>.",
        "apihelp-compare-param-topst": "Gjør en transformering av <var>totext</var> før lagring.",
        "apihelp-compare-param-tocontentmodel": "Innholdsmodellen til <var>totext</var>. Om denne ikke angis vil den bli gjettet ut fra andre parametere.",
@@ -78,6 +79,7 @@
        "apihelp-compare-paramvalue-prop-title": "Sidetitlene for «from»- og «to»-revisjonene.",
        "apihelp-compare-paramvalue-prop-user": "Brukernavnet og ID-en til «from»- og «to»-revisjonene.",
        "apihelp-compare-paramvalue-prop-comment": "Kommentaren til «from»- og «to»-revisjonene.",
+       "apihelp-compare-paramvalue-prop-parsedcomment": "Den parsede kommentaren til «from»- og «to»-revisjonene.",
        "apihelp-compare-paramvalue-prop-size": "Størrelsen til «from»- og «to»-revisjonene.",
        "apihelp-compare-example-1": "Lag en diff mellom revisjon 1 og 2.",
        "apihelp-createaccount-summary": "Opprett en ny brukerkonto.",
        "apihelp-edit-param-watch": "Legg til siden til aktuell brukers overvåkningsliste.",
        "apihelp-edit-param-unwatch": "Fjern siden fra aktuell brukers overvåkningsliste.",
        "apihelp-edit-param-prependtext": "Legg til denne teksten til starten av siden. Overstyrer $1text.",
+       "apihelp-edit-param-undo": "Fjern (gjør om) denne revisjonen. Overstyrer $1text, $1prependtext og $1appendtext.",
+       "apihelp-edit-param-undoafter": "Fjern alle revisjoner fra $1undo til denne. Om den ikke er satt, fjern kun én revisjon.",
        "apihelp-edit-param-redirect": "Bestem omdirigeringer automatisk.",
        "apihelp-edit-param-contentformat": "Innholdsserialiseringsformat brukt for inndatateksten.",
        "apihelp-edit-param-contentmodel": "Det nye innholdets innholdsmodell.",
+       "apihelp-edit-param-token": "Nøkkelen bør alltid sendes som siste parameter, eller i det minste etter parameteren $1text.",
        "apihelp-edit-example-edit": "Rediger en side.",
+       "apihelp-edit-example-prepend": "Legg til <kbd>_&#95;NOTOC_&#95;</kbd> i begynnelsen av en side.",
+       "apihelp-edit-example-undo": "Fjerner revisjon 13579–13585 med automatisk redigeringsforklaring.",
        "apihelp-emailuser-summary": "Send e-post til en bruker.",
        "apihelp-emailuser-param-target": "Bruker som det skal sendes e-post til.",
        "apihelp-emailuser-param-subject": "Emne.",
        "apihelp-emailuser-param-text": "E-post innhold.",
        "apihelp-emailuser-param-ccme": "Send en kopi av denne e-posten til meg.",
+       "apihelp-emailuser-example-email": "Send en epost til brukeren <kbd>WikiSysop</kbd> med teksten <kbd>Content</kbd>.",
        "apihelp-expandtemplates-summary": "Ekspanderer alle maler i wikitekst.",
        "apihelp-expandtemplates-param-title": "Sidetittel.",
        "apihelp-expandtemplates-param-text": "Wikitekst som skal konverteres.",
+       "apihelp-expandtemplates-param-revid": "Revisjons-ID, for <code><nowiki>{{REVISIONID}}</nowiki></code> og lignende variabler.",
+       "apihelp-expandtemplates-param-prop": "Hvilken informasjon som skal hentes.\n\nMerk at om ingen verdier velges vil resultatet inneholde wikiteksten, men utdataene vil komme i et utdatert format.",
        "apihelp-expandtemplates-paramvalue-prop-wikitext": "Den utvidede wikiteksten.",
        "apihelp-expandtemplates-paramvalue-prop-categories": "Kategorier som er tilstede i innputt som ikke representeres i utputt.",
+       "apihelp-expandtemplates-paramvalue-prop-properties": "Sideegenskaper definert av utvidede magiske ord i wikiteksten.",
+       "apihelp-expandtemplates-paramvalue-prop-volatile": "Hvorvidt utdataene er ustabile og ikke burde gjenbrukes andre steder på siden.",
+       "apihelp-expandtemplates-paramvalue-prop-ttl": "Maksimal tid som skal ha gått før mellomlagrede resultater skal ugyldiggjøres.",
+       "apihelp-expandtemplates-paramvalue-prop-jsconfigvars": "Gir JavaScript-konfigurasjonsvariabler som er spesifikke for siden.",
+       "apihelp-expandtemplates-paramvalue-prop-encodedjsconfigvars": "Gir JavaScript-konfigurasjonsvariabler som er spesifikke for siden som en JSON-streng.",
+       "apihelp-expandtemplates-param-includecomments": "Hvorvidt HTML-kommentarer skal inkluderes i utdataene.",
+       "apihelp-expandtemplates-example-simple": "Utvid wikiteksten <kbd><nowiki>{{Project:Sandbox}}</nowiki></kbd>.",
+       "apihelp-feedcontributions-summary": "Returnerer en mating med brukerbidrag.",
+       "apihelp-feedcontributions-param-feedformat": "Matingens format.",
+       "apihelp-feedcontributions-param-user": "Hvilke brukere det skal hentes bidrag av.",
+       "apihelp-feedcontributions-param-namespace": "Hvilke navnerom bidragene skal filtreres med.",
        "apihelp-feedcontributions-param-year": "Fra år (og tidligere).",
        "apihelp-feedcontributions-param-month": "Fra måned (og tidligere).",
        "apihelp-feedcontributions-param-tagfilter": "Filtrer bidrag som har disse merkene.",
        "apihelp-feedcontributions-param-hideminor": "Skjul mindre endringer.",
        "apihelp-feedcontributions-param-showsizediff": "Vis størrelsesforskjellen mellom revisjoner.",
        "apihelp-feedcontributions-example-simple": "Returner bidrag for brukeren <kbd>Example</kbd>.",
+       "apihelp-feedrecentchanges-summary": "Returnerer en mating med siste endringer.",
        "apihelp-feedrecentchanges-param-feedformat": "Matingens format.",
        "apihelp-feedrecentchanges-param-namespace": "Navnerom resultater skal begrenses til.",
        "apihelp-feedrecentchanges-param-invert": "Alle navnerom utenom det valgte.",
        "apihelp-feedrecentchanges-example-30days": "Vis siste endringer for 30 døgn.",
        "apihelp-feedwatchlist-summary": "Returnerer en overvåkningslistemating.",
        "apihelp-feedwatchlist-param-feedformat": "Matingens format.",
+       "apihelp-feedwatchlist-param-linktosections": "Lenk direkte til endrede seksjoner om mulig.",
+       "apihelp-feedwatchlist-example-default": "Vis matingen til overvåkningslisten.",
+       "apihelp-feedwatchlist-example-all6hrs": "Vis alle endringer på overvåkede sider de siste 6 timene.",
        "apihelp-filerevert-summary": "Tilbakestill en fil til en gammel versjon.",
        "apihelp-filerevert-param-filename": "Målfilnavn, uten prefikset File:.",
        "apihelp-filerevert-param-comment": "Opplastingskommentar.",
        "apihelp-import-extended-description": "Merk at HTTP POST må gjøres som filopplasting (altså med bruk av multipart/form-data) når man sender en fil for parameteren <var>xml</var>.",
        "apihelp-import-param-summary": "Sammendrag for importering av loggelement.",
        "apihelp-import-param-xml": "Opplastet XML-fil.",
+       "apihelp-import-param-assignknownusers": "Tildel redigeringer til lokale brukere der den navngitte brukeren finnes lokalt.",
        "apihelp-import-param-interwikisource": "For interwikiimport: wiki det skal importeres fra.",
        "apihelp-import-param-interwikipage": "For interwikiimport: side som skal importeres.",
        "apihelp-import-param-fullhistory": "For interwikiimport: importer hele historikken, ikke bare den nåværende versjonen.",
        "apihelp-import-param-rootpage": "Importer som underside av denne siden. Kan ikke brukes sammen med <var>$1namespace</var>.",
        "apihelp-import-param-tags": "Endringstagger som skal klistres på oppføringen i importloggen og nullrevisjonen til de importerte sidene.",
        "apihelp-import-example-import": "Importer [[meta:Help:ParserFunctions]] til navnerom 100 med full historikk.",
+       "apihelp-linkaccount-summary": "Lenk en konto fra en tredjepartsleverandør til den gjeldende brukeren.",
+       "apihelp-linkaccount-example-link": "Start prosessen med å lenke til en konto fra <kbd>Example</kbd>.",
+       "apihelp-login-summary": "Logg inn og få autentiseringsinformasjonskapsler.",
        "apihelp-login-param-name": "Brukernavn.",
        "apihelp-login-param-password": "Passord.",
        "apihelp-login-param-domain": "Domene (valgfritt).",
index b85ddc9..bbc83c0 100644 (file)
        "apihelp-query+search-paramvalue-prop-sectiontitle": "Adiciona o título da secção correspondente.",
        "apihelp-query+search-paramvalue-prop-categorysnippet": "Adiciona um fragmento de código com a categoria correspondente, após análise sintática.",
        "apihelp-query+search-paramvalue-prop-isfilematch": "Adiciona um valor booleano que indica se a pesquisa encontrou correspondência no conteúdo de ficheiros.",
+       "apihelp-query+search-paramvalue-prop-extensiondata": "Acrescenta dados adicionais gerados por extensões.",
        "apihelp-query+search-paramvalue-prop-score": "Ignorado.",
        "apihelp-query+search-paramvalue-prop-hasrelated": "Ignorado.",
        "apihelp-query+search-param-limit": "O número total de páginas a serem devolvidas.",
index 2fb6178..3f15916 100644 (file)
        "apihelp-query+search-paramvalue-prop-sectiontitle": "添加匹配章节的标题。",
        "apihelp-query+search-paramvalue-prop-categorysnippet": "添加已解析的匹配分类片段。",
        "apihelp-query+search-paramvalue-prop-isfilematch": "添加布尔值,表明搜索是否匹配文件内容。",
+       "apihelp-query+search-paramvalue-prop-extensiondata": "添加由扩展生成的额外数据。",
        "apihelp-query+search-paramvalue-prop-score": "已忽略。",
        "apihelp-query+search-paramvalue-prop-hasrelated": "已忽略。",
        "apihelp-query+search-param-limit": "返回的总计页面数。",
index 768f980..d6e9b74 100644 (file)
@@ -1048,8 +1048,7 @@ class MessageCache {
                if ( $titleObj->getLatestRevID() ) {
                        $revision = Revision::newKnownCurrent(
                                $dbr,
-                               $titleObj->getArticleID(),
-                               $titleObj->getLatestRevID()
+                               $titleObj
                        );
                } else {
                        $revision = false;
index 2546f2b..1c86d44 100644 (file)
@@ -468,7 +468,7 @@ abstract class ChangesListFilter {
         * @param FormOptions $opts
         * @return bool
         */
-       public function activelyInConflictWithFilter( ChangeslistFilter $filter, FormOptions $opts ) {
+       public function activelyInConflictWithFilter( ChangesListFilter $filter, FormOptions $opts ) {
                if ( $this->isSelected( $opts ) && $filter->isSelected( $opts ) ) {
                        /** @var ChangesListFilter $siblingFilter */
                        foreach ( $this->getSiblings() as $siblingFilter ) {
@@ -484,7 +484,7 @@ abstract class ChangesListFilter {
                return false;
        }
 
-       private function hasConflictWithFilter( ChangeslistFilter $filter ) {
+       private function hasConflictWithFilter( ChangesListFilter $filter ) {
                return in_array( $filter, $this->getConflictingFilters() );
        }
 
index 50cc9b5..edfc81c 100644 (file)
@@ -799,13 +799,13 @@ abstract class ContentHandler {
                }
 
                // New page created
-               if ( $flags & EDIT_NEW && $newContent && $newContent->getSize() > 0 ) {
-                       return 'newpage';
-               }
-
-               // New blank page
-               if ( $flags & EDIT_NEW && $newContent && $newContent->getSize() === 0 ) {
-                       return 'newblank';
+               if ( $flags & EDIT_NEW && $newContent ) {
+                       if ( $newContent->getSize() === 0 ) {
+                               // New blank page
+                               return 'newblank';
+                       } else {
+                               return 'newpage';
+                       }
                }
 
                // Removing more than 90% of the page
index b1eaa4b..6e7e7ee 100644 (file)
@@ -140,6 +140,15 @@ class TextConflictHelper {
         */
        public function incrementResolvedStats() {
                $this->stats->increment( 'edit.failures.conflict.resolved' );
+               // Only include 'standard' namespaces to avoid creating unknown numbers of statsd metrics
+               if (
+                       $this->title->getNamespace() >= NS_MAIN &&
+                       $this->title->getNamespace() <= NS_CATEGORY_TALK
+               ) {
+                       $this->stats->increment(
+                               'edit.failures.conflict.resolved.byNamespaceId.' . $this->title->getNamespace()
+                       );
+               }
        }
 
        /**
index dd4e707..df44626 100644 (file)
@@ -106,6 +106,7 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                                $tooltipAttribs = [
                                        'class' => "mw-htmlform-tooltip $tooltipClass",
                                        'title' => $this->mParams['tooltips'][$rowLabel],
+                                       'aria-label' => $this->mParams['tooltips'][$rowLabel]
                                ];
                                $rowLabel .= ' ' . Html::element( 'span', $tooltipAttribs, '' );
                        }
index c38eb6a..393c2e1 100644 (file)
@@ -657,6 +657,13 @@ END;
                }
        }
 
+       protected function dropSequence( $table, $ns ) {
+               if ( $this->db->sequenceExists( $ns ) ) {
+                       $this->output( "Dropping sequence $ns\n" );
+                       $this->db->query( "DROP SEQUENCE $ns CASCADE" );
+               }
+       }
+
        protected function renameSequence( $old, $new ) {
                if ( $this->db->sequenceExists( $new ) ) {
                        $this->output( "...sequence $new already exists.\n" );
index d7ed72b..62237a4 100644 (file)
        "config-email-auth-help": "Si esta opción está habilitada, los usuarios tienen que confirmar su dirección de correo electrónico mediante un enlace que se les envía a ellos cuando éstos lo establecen o lo cambian.\nSolo las direcciones de correo electrónico autenticadas pueden recibir correos electrónicos de otros usuarios o correos electrónicos de notificación de cambios.\nEsta opción está '''recomendada''' para wikis públicos debido a posibles abusos de las características del correo electrónico.",
        "config-email-sender": "Dirección de correo electrónico de retorno:",
        "config-email-sender-help": "Escribe la dirección de correo electrónico que se usará como dirección de retorno en los mensajes electrónicos de salida.\nAquí llegarán los correos electrónicos que no lleguen a su destino.\nMuchos servidores de correo electrónico exigen que por lo menos la parte del nombre del dominio sea válida.",
-       "config-upload-settings": "Subidas de imágenes y archivos",
+       "config-upload-settings": "Cargas de imágenes y archivos",
        "config-upload-enable": "Habilitar la subida de archivos",
        "config-upload-help": "La subida de archivos potencialmente expone tu servidor a riesgos de seguridad.\nPara obtener más información, consulta la [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Security sección de seguridad] en el manual.\n\nPara activar la subida de archivos, cambia el modo en el subdirectorio <code>images</code> bajo el directorio raíz de MediaWiki para que el servidor web pueda escribir en él.\nLuego, activa esta opción.",
        "config-upload-deleted": "Directorio para los archivos eliminados:",
index e6e4b67..08434f6 100644 (file)
        "config-install-mainpage-failed": "Non se puido inserir a páxina principal: $1",
        "config-install-done": "<strong>Parabéns!</strong>\nInstalou MediaWiki.\n\nO programa de instalación xerou un ficheiro <code>LocalSettings.php</code>.\nEste ficheiro contén toda a súa configuración.\n\nTerá que descargalo e poñelo na base da instalación do seu wiki (no mesmo directorio ca index.php). A descarga debería comezar automaticamente.\n\nSe non comezou a descarga ou se a cancelou, pode facer que comece de novo premendo na ligazón que aparece a continuación:\n\n$3\n\n<strong>Nota:</strong> Se non fai iso agora, este ficheiro de configuración xerado non estará dispoñible máis adiante se sae da instalación sen descargalo.\n\nCando faga todo isto, xa poderá <strong>[$2 entrar no seu wiki]</strong>.",
        "config-install-done-path": "<strong>Parabéns!</strong>\nInstalou MediaWiki.\n\nO instalador xerou un ficheiro <code>LocalSettings.php</code>.\nEste contén toda a súa configuración.\n\nDeberá descargalo e poñerlo en <code>$4</code>. A descarga debería ter comezado automaticamente.\n\nSe non comenzou a descarga, ou se a cancelou, podes reiniciala descarga premendo na seguinte ligazón:\n\n$3\n\n<strong>Nota</strong>: se non fai isto agora, este ficheiro de configuración xerado non estará dispoñible máis tarde se sae da instalación sen descargarlo.\n\nCando o teña feito, poderá <strong>[$2 entrar na súa wiki]</strong>.",
+       "config-install-success": "MediaWiki instalouse con éxito. Agora podes \nvisitar <$1$2> para ver a túa wiki.\nSe tes dúbidas, revisa a nosa lista de preguntas frecuentes:\n<https://www.mediawiki.org/wiki/Manual:FAQ> ou usa un dos\nforos de axuda ligados nesa páxina.",
        "config-download-localsettings": "Descargar o <code>LocalSettings.php</code>",
        "config-help": "axuda",
        "config-help-tooltip": "prema para expandir",
index 5ffb01b..ea7a8d7 100644 (file)
 /**
  * Router job that takes jobs and enqueues them to their proper queues
  *
- * This can be used for several things:
- *   - a) Making multi-job enqueues more robust by atomically enqueueing
- *        a single job that pushes the actual jobs (with retry logic)
- *   - b) Masking the latency of pushing jobs to different queues/wikis
- *   - c) Low-latency enqueues to push jobs from warm to hot datacenters
+ * This can be used for getting sets of multiple jobs or sets of jobs intended for multiple
+ * queues to be inserted more robustly. This is a single job that, upon running, enqueues the
+ * wrapped jobs. If some of those fail to enqueue then the EnqueueJob will be retried. Due to
+ * the possibility of duplicate enqueues, the wrapped jobs should be idempotent.
  *
  * @ingroup JobQueue
  * @since 1.25
index be823a8..931c085 100644 (file)
@@ -129,11 +129,17 @@ class XMPReader implements LoggerAwareInterface {
         */
        private $logger;
 
+       /**
+        * @var string
+        */
+       private $filename;
+
        /**
         * Primary job is to initialize the XMLParser
         * @param LoggerInterface|null $logger
+        * @param string $filename
         */
-       function __construct( LoggerInterface $logger = null ) {
+       function __construct( LoggerInterface $logger = null, $filename = 'unknown' ) {
                if ( !function_exists( 'xml_parser_create_ns' ) ) {
                        // this should already be checked by this point
                        throw new RuntimeException( 'XMP support requires XML Parser' );
@@ -143,6 +149,7 @@ class XMPReader implements LoggerAwareInterface {
                } else {
                        $this->setLogger( new NullLogger() );
                }
+               $this->filename = $filename;
 
                $this->items = XMPInfo::getItems();
 
@@ -372,11 +379,13 @@ class XMPReader implements LoggerAwareInterface {
 
                                $this->logger->info(
                                        '{method} : Error reading XMP content: {error} ' .
-                                       '(line: {line} column: {column} byte offset: {offset})',
+                                       '(file: {file}, line: {line} column: {column} ' .
+                                       'byte offset: {offset})',
                                        [
                                                'method' => __METHOD__,
                                                'error_code' => $code,
                                                'error' => $error,
+                                               'file' => $this->filename,
                                                'line' => $line,
                                                'column' => $col,
                                                'offset' => $offset,
@@ -392,6 +401,7 @@ class XMPReader implements LoggerAwareInterface {
                                [
                                        'method' => __METHOD__,
                                        'exception' => $e,
+                                       'file' => $this->filename,
                                        'content' => $content,
                                ]
                        );
@@ -421,7 +431,11 @@ class XMPReader implements LoggerAwareInterface {
                ) {
                        $this->logger->info( __METHOD__ .
                                " Ignoring XMPExtended block due to wrong guid (guid= '{guid}')",
-                               [ 'guid' => 'guid' ] );
+                                       [
+                                               'guid' => $guid,
+                                               'file' => $this->filename,
+                                       ]
+                       );
 
                        return false;
                }
@@ -433,7 +447,8 @@ class XMPReader implements LoggerAwareInterface {
                        $len['offset'] > $len['length']
                ) {
                        $this->logger->info(
-                               __METHOD__ . 'Error reading extended XMP block, invalid length or offset.'
+                               __METHOD__ . 'Error reading extended XMP block, invalid length or offset.',
+                               [ 'file' => $this->filename ]
                        );
 
                        return false;
@@ -451,7 +466,9 @@ class XMPReader implements LoggerAwareInterface {
 
                if ( $len['offset'] !== $this->extendedXMPOffset ) {
                        $this->logger->info( __METHOD__ . 'Ignoring XMPExtended block due to wrong order. (Offset was '
-                               . $len['offset'] . ' but expected ' . $this->extendedXMPOffset . ')' );
+                               . $len['offset'] . ' but expected ' . $this->extendedXMPOffset . ')',
+                               [ 'file' => $this->filename ]
+                       );
 
                        return false;
                }
@@ -472,7 +489,10 @@ class XMPReader implements LoggerAwareInterface {
                        $atEnd = false;
                }
 
-               $this->logger->debug( __METHOD__ . 'Parsing a XMPExtended block' );
+               $this->logger->debug(
+                       __METHOD__ . 'Parsing a XMPExtended block',
+                       [ 'file' => $this->filename ]
+               );
 
                return $this->parse( $actualContent, $atEnd );
        }
@@ -668,19 +688,28 @@ class XMPReader implements LoggerAwareInterface {
 
                        if ( !isset( $this->results['xmp-' . $info['map_group']][$finalName] ) ) {
                                // This can happen if all the members of the struct failed validation.
-                               $this->logger->debug( __METHOD__ . " <$ns:$tag> has no valid members." );
+                               $this->logger->debug(
+                                       __METHOD__ . " <$ns:$tag> has no valid members.",
+                                       [ 'file' => $this->filename ]
+                               );
                        } elseif ( is_callable( $validate ) ) {
                                $val =& $this->results['xmp-' . $info['map_group']][$finalName];
                                call_user_func_array( $validate, [ $info, &$val, false ] );
                                if ( is_null( $val ) ) {
                                        // the idea being the validation function will unset the variable if
                                        // its invalid.
-                                       $this->logger->info( __METHOD__ . " <$ns:$tag> failed validation." );
+                                       $this->logger->info(
+                                               __METHOD__ . " <$ns:$tag> failed validation.",
+                                               [ 'file' => $this->filename ]
+                                       );
                                        unset( $this->results['xmp-' . $info['map_group']][$finalName] );
                                }
                        } else {
-                               $this->logger->warning( __METHOD__ . " Validation function for $finalName ("
-                                       . $validate[0] . '::' . $validate[1] . '()) is not callable.' );
+                               $this->logger->warning(
+                                       __METHOD__ . " Validation function for $finalName (" .
+                                       $validate[0] . '::' . $validate[1] . '()) is not callable.',
+                                       [ 'file' => $this->filename ]
+                               );
                        }
                }
 
@@ -719,7 +748,10 @@ class XMPReader implements LoggerAwareInterface {
                array_shift( $this->mode );
 
                if ( !isset( $this->results['xmp-' . $info['map_group']][$finalName] ) ) {
-                       $this->logger->debug( __METHOD__ . " Empty compund element $finalName." );
+                       $this->logger->debug(
+                               __METHOD__ . " Empty compund element $finalName.",
+                               [ 'file' => $this->filename ]
+                       );
 
                        return;
                }
@@ -787,7 +819,10 @@ class XMPReader implements LoggerAwareInterface {
                if ( $elm === self::NS_RDF . ' type' ) {
                        // these aren't really supported properly yet.
                        // However, it appears they almost never used.
-                       $this->logger->info( __METHOD__ . ' encountered <rdf:type>' );
+                       $this->logger->info(
+                               __METHOD__ . ' encountered <rdf:type>',
+                               [ 'file' => $this->filename ]
+                       );
                }
 
                if ( strpos( $elm, ' ' ) === false ) {
@@ -795,7 +830,10 @@ class XMPReader implements LoggerAwareInterface {
                        // However, there is a bug in an adobe product
                        // that forgets the namespace on some things.
                        // (Luckily they are unimportant things).
-                       $this->logger->info( __METHOD__ . " Encountered </$elm> which has no namespace. Skipping." );
+                       $this->logger->info(
+                               __METHOD__ . " Encountered </$elm> which has no namespace. Skipping.",
+                               [ 'file' => $this->filename ]
+                       );
 
                        return;
                }
@@ -841,7 +879,10 @@ class XMPReader implements LoggerAwareInterface {
                                $this->endElementModeQDesc( $elm );
                                break;
                        default:
-                               $this->logger->warning( __METHOD__ . " no mode (elm = $elm)" );
+                               $this->logger->info(
+                                       __METHOD__ . " no mode (elm = $elm)",
+                                       [ 'file' => $this->filename ]
+                               );
                                break;
                }
        }
@@ -891,8 +932,11 @@ class XMPReader implements LoggerAwareInterface {
                        array_unshift( $this->mode, self::MODE_LI );
                } elseif ( $elm === self::NS_RDF . ' Bag' ) {
                        # T29105
-                       $this->logger->info( __METHOD__ . ' Expected an rdf:Seq, but got an rdf:Bag. Pretending'
-                               . ' it is a Seq, since some buggy software is known to screw this up.' );
+                       $this->logger->info(
+                               __METHOD__ . ' Expected an rdf:Seq, but got an rdf:Bag. Pretending' .
+                               ' it is a Seq, since some buggy software is known to screw this up.',
+                               [ 'file' => $this->filename ]
+                       );
                        array_unshift( $this->mode, self::MODE_LI );
                } else {
                        throw new RuntimeException( "Expected <rdf:Seq> but got $elm." );
@@ -956,7 +1000,12 @@ class XMPReader implements LoggerAwareInterface {
                        // something else we don't recognize, like a qualifier maybe.
                        $this->logger->info( __METHOD__ .
                                " Encountered element <{element}> where only expecting character data as value of {curitem}",
-                               [ 'element' => $elm, 'curitem' => $this->curItem[0] ] );
+                               [
+                                       'element' => $elm,
+                                       'curitem' => $this->curItem[0],
+                                       'file' => $this->filename,
+                               ]
+                       );
                        array_unshift( $this->mode, self::MODE_IGNORE );
                        array_unshift( $this->curItem, $elm );
                }
@@ -1006,9 +1055,9 @@ class XMPReader implements LoggerAwareInterface {
                                        // a child of a struct), then something weird is
                                        // happening, so ignore this element and its children.
 
-                                       $this->logger->warning(
+                                       $this->logger->info(
                                                'Encountered <{element}> outside of its expected parent. Ignoring.',
-                                               [ 'element' => "$ns:$tag" ]
+                                               [ 'element' => "$ns:$tag", 'file' => $this->filename ]
                                        );
 
                                        array_unshift( $this->mode, self::MODE_IGNORE );
@@ -1031,7 +1080,7 @@ class XMPReader implements LoggerAwareInterface {
                        } else {
                                // This element is not on our list of allowed elements so ignore.
                                $this->logger->debug( __METHOD__ . ' Ignoring unrecognized element <{element}>.',
-                                       [ 'element' => "$ns:$tag" ] );
+                                       [ 'element' => "$ns:$tag", 'file' => $this->filename ] );
                                array_unshift( $this->mode, self::MODE_IGNORE );
                                array_unshift( $this->curItem, $ns . ' ' . $tag );
 
@@ -1208,12 +1257,18 @@ class XMPReader implements LoggerAwareInterface {
                        // on page 25 of part 1 of the xmp standard.
                        // Also it seems as if exiv2 and exiftool do not support
                        // this either (That or I misunderstand the standard)
-                       $this->logger->info( __METHOD__ . ' Encountered <rdf:type> which isn\'t currently supported' );
+                       $this->logger->info(
+                               __METHOD__ . ' Encountered <rdf:type> which isn\'t currently supported',
+                               [ 'file' => $this->filename ]
+                       );
                }
 
                if ( strpos( $elm, ' ' ) === false ) {
                        // This probably shouldn't happen.
-                       $this->logger->info( __METHOD__ . " Encountered <$elm> which has no namespace. Skipping." );
+                       $this->logger->info(
+                               __METHOD__ . " Encountered <$elm> which has no namespace. Skipping.",
+                               [ 'file' => $this->filename ]
+                       );
 
                        return;
                }
@@ -1295,8 +1350,11 @@ class XMPReader implements LoggerAwareInterface {
                        if ( strpos( $name, ' ' ) === false ) {
                                // This shouldn't happen, but so far some old software forgets namespace
                                // on rdf:about.
-                               $this->logger->info( __METHOD__ . ' Encountered non-namespaced attribute: '
-                                       . " $name=\"$val\". Skipping. " );
+                               $this->logger->info(
+                                       __METHOD__ . ' Encountered non-namespaced attribute: ' .
+                                       " $name=\"$val\". Skipping. ",
+                                       [ 'file' => $this->filename ]
+                               );
                                continue;
                        }
                        list( $ns, $tag ) = explode( ' ', $name, 2 );
@@ -1313,7 +1371,10 @@ class XMPReader implements LoggerAwareInterface {
                                }
                                $this->saveValue( $ns, $tag, $val );
                        } else {
-                               $this->logger->debug( __METHOD__ . " Ignoring unrecognized element <$ns:$tag>." );
+                               $this->logger->debug(
+                                       __METHOD__ . " Ignoring unrecognized element <$ns:$tag>.",
+                                       [ 'file' => $this->filename ]
+                               );
                        }
                }
        }
@@ -1346,13 +1407,19 @@ class XMPReader implements LoggerAwareInterface {
                                // the reasoning behind using &$val instead of using the return value
                                // is to be consistent between here and validating structures.
                                if ( is_null( $val ) ) {
-                                       $this->logger->info( __METHOD__ . " <$ns:$tag> failed validation." );
+                                       $this->logger->info(
+                                               __METHOD__ . " <$ns:$tag> failed validation.",
+                                               [ 'file' => $this->filename ]
+                                       );
 
                                        return;
                                }
                        } else {
-                               $this->logger->warning( __METHOD__ . " Validation function for $finalName ("
-                                       . $validate[0] . '::' . $validate[1] . '()) is not callable.' );
+                               $this->logger->warning(
+                                       __METHOD__ . " Validation function for $finalName (" .
+                                       $validate[0] . '::' . $validate[1] . '()) is not callable.',
+                                       [ 'file' => $this->filename ]
+                               );
                        }
                }
 
index 35c9751..2ed5db3 100644 (file)
@@ -170,7 +170,7 @@ class BitmapMetadataHandler {
                        }
                }
                if ( isset( $seg['XMP'] ) && $showXMP ) {
-                       $xmp = new XMPReader( LoggerFactory::getInstance( 'XMP' ) );
+                       $xmp = new XMPReader( LoggerFactory::getInstance( 'XMP' ), $filename );
                        $xmp->parse( $seg['XMP'] );
                        foreach ( $seg['XMP_ext'] as $xmpExt ) {
                                /* Support for extended xmp in jpeg files
@@ -205,7 +205,7 @@ class BitmapMetadataHandler {
                if ( isset( $array['text']['xmp']['x-default'] )
                        && $array['text']['xmp']['x-default'] !== '' && $showXMP
                ) {
-                       $xmp = new XMPReader( LoggerFactory::getInstance( 'XMP' ) );
+                       $xmp = new XMPReader( LoggerFactory::getInstance( 'XMP' ), $filename );
                        $xmp->parse( $array['text']['xmp']['x-default'] );
                        $xmpRes = $xmp->getResults();
                        foreach ( $xmpRes as $type => $xmpSection ) {
@@ -238,7 +238,7 @@ class BitmapMetadataHandler {
                }
 
                if ( $baseArray['xmp'] !== '' && XMPReader::isSupported() ) {
-                       $xmp = new XMPReader( LoggerFactory::getInstance( 'XMP' ) );
+                       $xmp = new XMPReader( LoggerFactory::getInstance( 'XMP' ), $filename );
                        $xmp->parse( $baseArray['xmp'] );
                        $xmpRes = $xmp->getResults();
                        foreach ( $xmpRes as $type => $xmpSection ) {
index ff997ab..7498ca5 100644 (file)
@@ -23,6 +23,7 @@
 use MediaWiki\Edit\PreparedEdit;
 use \MediaWiki\Logger\LoggerFactory;
 use \MediaWiki\MediaWikiServices;
+use Wikimedia\Assert\Assert;
 use Wikimedia\Rdbms\FakeResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
 use Wikimedia\Rdbms\DBError;
@@ -671,7 +672,7 @@ class WikiPage implements Page, IDBAccessObject {
                        $revision = Revision::newFromPageId( $this->getId(), $latest, $flags );
                } else {
                        $dbr = wfGetDB( DB_REPLICA );
-                       $revision = Revision::newKnownCurrent( $dbr, $this->getId(), $latest );
+                       $revision = Revision::newKnownCurrent( $dbr, $this->getTitle(), $latest );
                }
 
                if ( $revision ) { // sanity
@@ -1264,8 +1265,11 @@ class WikiPage implements Page, IDBAccessObject {
                        $conditions['page_latest'] = $lastRevision;
                }
 
+               $revId = $revision->getId();
+               Assert::parameter( $revId > 0, '$revision->getId()', 'must be > 0' );
+
                $row = [ /* SET */
-                       'page_latest'      => $revision->getId(),
+                       'page_latest'      => $revId,
                        'page_touched'     => $dbw->timestamp( $revision->getTimestamp() ),
                        'page_is_new'      => ( $lastRevision === 0 ) ? 1 : 0,
                        'page_is_redirect' => $rt !== null ? 1 : 0,
index 2b03a70..8986ddd 100644 (file)
@@ -406,13 +406,6 @@ class Parser {
                $text, Title $title, ParserOptions $options,
                $linestart = true, $clearState = true, $revid = null
        ) {
-               /**
-                * First pass--just handle <nowiki> sections, pass the rest off
-                * to internalParse() which does all the real work.
-                */
-
-               global $wgShowHostnames;
-
                if ( $clearState ) {
                        // We use U+007F DELETE to construct strip markers, so we have to make
                        // sure that this character does not occur in the input text.
@@ -474,7 +467,7 @@ class Parser {
                        }
                }
 
-               # Done parsing! Compute runtime adaptive expiry if set
+               # Compute runtime adaptive expiry if set
                $this->mOutput->finalizeAdaptiveCacheExpiry();
 
                # Warn if too many heavyweight parser functions were used
@@ -485,110 +478,9 @@ class Parser {
                        );
                }
 
-               # Information on include size limits, for the benefit of users who try to skirt them
+               # Information on limits, for the benefit of users who try to skirt them
                if ( $this->mOptions->getEnableLimitReport() ) {
-                       $max = $this->mOptions->getMaxIncludeSize();
-
-                       $cpuTime = $this->mOutput->getTimeSinceStart( 'cpu' );
-                       if ( $cpuTime !== null ) {
-                               $this->mOutput->setLimitReportData( 'limitreport-cputime',
-                                       sprintf( "%.3f", $cpuTime )
-                               );
-                       }
-
-                       $wallTime = $this->mOutput->getTimeSinceStart( 'wall' );
-                       $this->mOutput->setLimitReportData( 'limitreport-walltime',
-                               sprintf( "%.3f", $wallTime )
-                       );
-
-                       $this->mOutput->setLimitReportData( 'limitreport-ppvisitednodes',
-                               [ $this->mPPNodeCount, $this->mOptions->getMaxPPNodeCount() ]
-                       );
-                       $this->mOutput->setLimitReportData( 'limitreport-ppgeneratednodes',
-                               [ $this->mGeneratedPPNodeCount, $this->mOptions->getMaxGeneratedPPNodeCount() ]
-                       );
-                       $this->mOutput->setLimitReportData( 'limitreport-postexpandincludesize',
-                               [ $this->mIncludeSizes['post-expand'], $max ]
-                       );
-                       $this->mOutput->setLimitReportData( 'limitreport-templateargumentsize',
-                               [ $this->mIncludeSizes['arg'], $max ]
-                       );
-                       $this->mOutput->setLimitReportData( 'limitreport-expansiondepth',
-                               [ $this->mHighestExpansionDepth, $this->mOptions->getMaxPPExpandDepth() ]
-                       );
-                       $this->mOutput->setLimitReportData( 'limitreport-expensivefunctioncount',
-                               [ $this->mExpensiveFunctionCount, $this->mOptions->getExpensiveParserFunctionLimit() ]
-                       );
-                       Hooks::run( 'ParserLimitReportPrepare', [ $this, $this->mOutput ] );
-
-                       $limitReport = "NewPP limit report\n";
-                       if ( $wgShowHostnames ) {
-                               $limitReport .= 'Parsed by ' . wfHostname() . "\n";
-                       }
-                       $limitReport .= 'Cached time: ' . $this->mOutput->getCacheTime() . "\n";
-                       $limitReport .= 'Cache expiry: ' . $this->mOutput->getCacheExpiry() . "\n";
-                       $limitReport .= 'Dynamic content: ' .
-                               ( $this->mOutput->hasDynamicContent() ? 'true' : 'false' ) .
-                               "\n";
-
-                       foreach ( $this->mOutput->getLimitReportData() as $key => $value ) {
-                               if ( Hooks::run( 'ParserLimitReportFormat',
-                                       [ $key, &$value, &$limitReport, false, false ]
-                               ) ) {
-                                       $keyMsg = wfMessage( $key )->inLanguage( 'en' )->useDatabase( false );
-                                       $valueMsg = wfMessage( [ "$key-value-text", "$key-value" ] )
-                                               ->inLanguage( 'en' )->useDatabase( false );
-                                       if ( !$valueMsg->exists() ) {
-                                               $valueMsg = new RawMessage( '$1' );
-                                       }
-                                       if ( !$keyMsg->isDisabled() && !$valueMsg->isDisabled() ) {
-                                               $valueMsg->params( $value );
-                                               $limitReport .= "{$keyMsg->text()}: {$valueMsg->text()}\n";
-                                       }
-                               }
-                       }
-                       // Since we're not really outputting HTML, decode the entities and
-                       // then re-encode the things that need hiding inside HTML comments.
-                       $limitReport = htmlspecialchars_decode( $limitReport );
-                       // Run deprecated hook
-                       Hooks::run( 'ParserLimitReport', [ $this, &$limitReport ], '1.22' );
-
-                       // Sanitize for comment. Note '‐' in the replacement is U+2010,
-                       // which looks much like the problematic '-'.
-                       $limitReport = str_replace( [ '-', '&' ], [ '‐', '&amp;' ], $limitReport );
-                       $text .= "\n<!-- \n$limitReport-->\n";
-
-                       // Add on template profiling data in human/machine readable way
-                       $dataByFunc = $this->mProfiler->getFunctionStats();
-                       uasort( $dataByFunc, function ( $a, $b ) {
-                               return $a['real'] < $b['real']; // descending order
-                       } );
-                       $profileReport = [];
-                       foreach ( array_slice( $dataByFunc, 0, 10 ) as $item ) {
-                               $profileReport[] = sprintf( "%6.2f%% %8.3f %6d %s",
-                                       $item['%real'], $item['real'], $item['calls'],
-                                       htmlspecialchars( $item['name'] ) );
-                       }
-                       $text .= "<!--\nTransclusion expansion time report (%,ms,calls,template)\n";
-                       $text .= implode( "\n", $profileReport ) . "\n-->\n";
-
-                       $this->mOutput->setLimitReportData( 'limitreport-timingprofile', $profileReport );
-
-                       // Add other cache related metadata
-                       if ( $wgShowHostnames ) {
-                               $this->mOutput->setLimitReportData( 'cachereport-origin', wfHostname() );
-                       }
-                       $this->mOutput->setLimitReportData( 'cachereport-timestamp',
-                               $this->mOutput->getCacheTime() );
-                       $this->mOutput->setLimitReportData( 'cachereport-ttl',
-                               $this->mOutput->getCacheExpiry() );
-                       $this->mOutput->setLimitReportData( 'cachereport-transientcontent',
-                               $this->mOutput->hasDynamicContent() );
-
-                       if ( $this->mGeneratedPPNodeCount > $this->mOptions->getMaxGeneratedPPNodeCount() / 10 ) {
-                               wfDebugLog( 'generated-pp-node-count', $this->mGeneratedPPNodeCount . ' ' .
-                                       $this->mTitle->getPrefixedDBkey() );
-                       }
+                       $text .= $this->makeLimitReport();
                }
 
                # Wrap non-interface parser output in a <div> so it can be targeted
@@ -611,6 +503,120 @@ class Parser {
                return $this->mOutput;
        }
 
+       /**
+        * Set the limit report data in the current ParserOutput, and return the
+        * limit report HTML comment.
+        *
+        * @return string
+        */
+       protected function makeLimitReport() {
+               global $wgShowHostnames;
+
+               $maxIncludeSize = $this->mOptions->getMaxIncludeSize();
+
+               $cpuTime = $this->mOutput->getTimeSinceStart( 'cpu' );
+               if ( $cpuTime !== null ) {
+                       $this->mOutput->setLimitReportData( 'limitreport-cputime',
+                               sprintf( "%.3f", $cpuTime )
+                       );
+               }
+
+               $wallTime = $this->mOutput->getTimeSinceStart( 'wall' );
+               $this->mOutput->setLimitReportData( 'limitreport-walltime',
+                       sprintf( "%.3f", $wallTime )
+               );
+
+               $this->mOutput->setLimitReportData( 'limitreport-ppvisitednodes',
+                       [ $this->mPPNodeCount, $this->mOptions->getMaxPPNodeCount() ]
+               );
+               $this->mOutput->setLimitReportData( 'limitreport-ppgeneratednodes',
+                       [ $this->mGeneratedPPNodeCount, $this->mOptions->getMaxGeneratedPPNodeCount() ]
+               );
+               $this->mOutput->setLimitReportData( 'limitreport-postexpandincludesize',
+                       [ $this->mIncludeSizes['post-expand'], $maxIncludeSize ]
+               );
+               $this->mOutput->setLimitReportData( 'limitreport-templateargumentsize',
+                       [ $this->mIncludeSizes['arg'], $maxIncludeSize ]
+               );
+               $this->mOutput->setLimitReportData( 'limitreport-expansiondepth',
+                       [ $this->mHighestExpansionDepth, $this->mOptions->getMaxPPExpandDepth() ]
+               );
+               $this->mOutput->setLimitReportData( 'limitreport-expensivefunctioncount',
+                       [ $this->mExpensiveFunctionCount, $this->mOptions->getExpensiveParserFunctionLimit() ]
+               );
+               Hooks::run( 'ParserLimitReportPrepare', [ $this, $this->mOutput ] );
+
+               $limitReport = "NewPP limit report\n";
+               if ( $wgShowHostnames ) {
+                       $limitReport .= 'Parsed by ' . wfHostname() . "\n";
+               }
+               $limitReport .= 'Cached time: ' . $this->mOutput->getCacheTime() . "\n";
+               $limitReport .= 'Cache expiry: ' . $this->mOutput->getCacheExpiry() . "\n";
+               $limitReport .= 'Dynamic content: ' .
+                       ( $this->mOutput->hasDynamicContent() ? 'true' : 'false' ) .
+                       "\n";
+
+               foreach ( $this->mOutput->getLimitReportData() as $key => $value ) {
+                       if ( Hooks::run( 'ParserLimitReportFormat',
+                               [ $key, &$value, &$limitReport, false, false ]
+                       ) ) {
+                               $keyMsg = wfMessage( $key )->inLanguage( 'en' )->useDatabase( false );
+                               $valueMsg = wfMessage( [ "$key-value-text", "$key-value" ] )
+                                       ->inLanguage( 'en' )->useDatabase( false );
+                               if ( !$valueMsg->exists() ) {
+                                       $valueMsg = new RawMessage( '$1' );
+                               }
+                               if ( !$keyMsg->isDisabled() && !$valueMsg->isDisabled() ) {
+                                       $valueMsg->params( $value );
+                                       $limitReport .= "{$keyMsg->text()}: {$valueMsg->text()}\n";
+                               }
+                       }
+               }
+               // Since we're not really outputting HTML, decode the entities and
+               // then re-encode the things that need hiding inside HTML comments.
+               $limitReport = htmlspecialchars_decode( $limitReport );
+               // Run deprecated hook
+               Hooks::run( 'ParserLimitReport', [ $this, &$limitReport ], '1.22' );
+
+               // Sanitize for comment. Note '‐' in the replacement is U+2010,
+               // which looks much like the problematic '-'.
+               $limitReport = str_replace( [ '-', '&' ], [ '‐', '&amp;' ], $limitReport );
+               $text = "\n<!-- \n$limitReport-->\n";
+
+               // Add on template profiling data in human/machine readable way
+               $dataByFunc = $this->mProfiler->getFunctionStats();
+               uasort( $dataByFunc, function ( $a, $b ) {
+                       return $a['real'] < $b['real']; // descending order
+               } );
+               $profileReport = [];
+               foreach ( array_slice( $dataByFunc, 0, 10 ) as $item ) {
+                       $profileReport[] = sprintf( "%6.2f%% %8.3f %6d %s",
+                               $item['%real'], $item['real'], $item['calls'],
+                               htmlspecialchars( $item['name'] ) );
+               }
+               $text .= "<!--\nTransclusion expansion time report (%,ms,calls,template)\n";
+               $text .= implode( "\n", $profileReport ) . "\n-->\n";
+
+               $this->mOutput->setLimitReportData( 'limitreport-timingprofile', $profileReport );
+
+               // Add other cache related metadata
+               if ( $wgShowHostnames ) {
+                       $this->mOutput->setLimitReportData( 'cachereport-origin', wfHostname() );
+               }
+               $this->mOutput->setLimitReportData( 'cachereport-timestamp',
+                       $this->mOutput->getCacheTime() );
+               $this->mOutput->setLimitReportData( 'cachereport-ttl',
+                       $this->mOutput->getCacheExpiry() );
+               $this->mOutput->setLimitReportData( 'cachereport-transientcontent',
+                       $this->mOutput->hasDynamicContent() );
+
+               if ( $this->mGeneratedPPNodeCount > $this->mOptions->getMaxGeneratedPPNodeCount() / 10 ) {
+                       wfDebugLog( 'generated-pp-node-count', $this->mGeneratedPPNodeCount . ' ' .
+                               $this->mTitle->getPrefixedDBkey() );
+               }
+               return $text;
+       }
+
        /**
         * Half-parse wikitext to half-parsed HTML. This recursive parser entry point
         * can be called from an extension tag hook.
@@ -3492,13 +3498,7 @@ class Parser {
         * @return Revision|bool False if missing
         */
        public static function statelessFetchRevision( Title $title, $parser = false ) {
-               $pageId = $title->getArticleID();
-               $revId = $title->getLatestRevID();
-
-               $rev = Revision::newKnownCurrent( wfGetDB( DB_REPLICA ), $pageId, $revId );
-               if ( $rev ) {
-                       $rev->setTitle( $title );
-               }
+               $rev = Revision::newKnownCurrent( wfGetDB( DB_REPLICA ), $title );
 
                return $rev;
        }
index ff9c28d..153a770 100644 (file)
@@ -596,7 +596,7 @@ class ParserOutput extends CacheTime {
 
                # Replace unnecessary URL escape codes with the referenced character
                # This prevents spammers from hiding links from the filters
-               $url = parser::normalizeLinkUrl( $url );
+               $url = Parser::normalizeLinkUrl( $url );
 
                $registerExternalLink = true;
                if ( !$wgRegisterInternalExternals ) {
index 5dc0b40..fe617c5 100644 (file)
@@ -378,9 +378,10 @@ class ExtensionProcessor implements Processor {
 
        protected function extractExtensionMessagesFiles( $dir, array $info ) {
                if ( isset( $info['ExtensionMessagesFiles'] ) ) {
-                       $this->globals["wgExtensionMessagesFiles"] += array_map( function ( $file ) use ( $dir ) {
-                               return "$dir/$file";
-                       }, $info['ExtensionMessagesFiles'] );
+                       foreach ( $info['ExtensionMessagesFiles'] as &$file ) {
+                               $file = "$dir/$file";
+                       }
+                       $this->globals["wgExtensionMessagesFiles"] += $info['ExtensionMessagesFiles'];
                }
        }
 
index bc2f8e4..6308461 100644 (file)
@@ -323,7 +323,7 @@ class ExtensionRegistry {
                }
 
                if ( isset( $info['autoloaderNS'] ) ) {
-                       Autoloader::$psr4Namespaces += $info['autoloaderNS'];
+                       AutoLoader::$psr4Namespaces += $info['autoloaderNS'];
                }
 
                foreach ( $info['defines'] as $name => $val ) {
@@ -413,13 +413,14 @@ class ExtensionRegistry {
         * Fully expand autoloader paths
         *
         * @param string $dir
-        * @param array $info
+        * @param array $files
         * @return array
         */
-       protected function processAutoLoader( $dir, array $info ) {
+       protected function processAutoLoader( $dir, array $files ) {
                // Make paths absolute, relative to the JSON file
-               return array_map( function ( $file ) use ( $dir ) {
-                       return "$dir/$file";
-               }, $info );
+               foreach ( $files as &$file ) {
+                       $file = "$dir/$file";
+               }
+               return $files;
        }
 }
index bebc188..6eddfc0 100644 (file)
@@ -183,12 +183,10 @@ class ResourceLoaderWikiModule extends ResourceLoaderModule {
         * @return Content|null
         */
        protected function getContentObj( Title $title ) {
-               $revision = Revision::newKnownCurrent( wfGetDB( DB_REPLICA ), $title->getArticleID(),
-                       $title->getLatestRevID() );
+               $revision = Revision::newKnownCurrent( wfGetDB( DB_REPLICA ), $title );
                if ( !$revision ) {
                        return null;
                }
-               $revision->setTitle( $title );
                $content = $revision->getContent( Revision::RAW );
                if ( !$content ) {
                        wfDebugLog( 'resourceloader', __METHOD__ . ': failed to load content of JS/CSS page!' );
index 671ab6f..1639386 100644 (file)
@@ -290,15 +290,16 @@ class SpecialNewpages extends IncludableSpecialPage {
 
        /**
         * @param stdClass $result Result row from recent changes
-        * @return Revision|bool
+        * @param Title $title
+        * @return bool|Revision
         */
-       protected function revisionFromRcResult( stdClass $result ) {
+       protected function revisionFromRcResult( stdClass $result, Title $title ) {
                return new Revision( [
                        'comment' => CommentStore::newKey( 'rc_comment' )->getComment( $result )->text,
                        'deleted' => $result->rc_deleted,
                        'user_text' => $result->rc_user_text,
                        'user' => $result->rc_user,
-               ] );
+               ], 0, $title );
        }
 
        /**
@@ -313,8 +314,7 @@ class SpecialNewpages extends IncludableSpecialPage {
 
                // Revision deletion works on revisions,
                // so cast our recent change row to a revision row.
-               $rev = $this->revisionFromRcResult( $result );
-               $rev->setTitle( $title );
+               $rev = $this->revisionFromRcResult( $result, $title );
 
                $classes = [];
                $attribs = [ 'data-mw-revid' => $result->rev_id ];
diff --git a/includes/templates/AtomHeader.mustache b/includes/templates/AtomHeader.mustache
new file mode 100644 (file)
index 0000000..60ab75e
--- /dev/null
@@ -0,0 +1,8 @@
+<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{{language}}}">
+       <id>{{{feedID}}}</id>
+       <title>{{{title}}}</title>
+       <link rel="self" type="application/atom+xml" href="{{{selfUrl}}}"/>
+       <link rel="alternate" type="text/html" href="{{{url}}}"/>
+       <updated>{{{timestamp}}}Z</updated>
+       <subtitle>{{{description}}}</subtitle>
+       <generator>MediaWiki {{{version}}}</generator>
diff --git a/includes/templates/AtomItem.mustache b/includes/templates/AtomItem.mustache
new file mode 100644 (file)
index 0000000..32d2f01
--- /dev/null
@@ -0,0 +1,10 @@
+       <entry>
+               <id>{{{uniqueID}}}</id>
+               <title>{{{title}}}</title>
+               <link rel="alternate" type="{{{mimeType}}}" href="{{{url}}}"/>
+               {{#date}}<updated>{{{.}}}Z</updated>{{/date}}
+
+               <summary type="html">{{{description}}}</summary>
+               {{#author}}<author><name>{{{.}}}</name></author>{{/author}}
+               {{! FIXME: Need to add comments }}
+       </entry>
diff --git a/includes/templates/RSSHeader.mustache b/includes/templates/RSSHeader.mustache
new file mode 100644 (file)
index 0000000..385369d
--- /dev/null
@@ -0,0 +1,8 @@
+<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
+       <channel>
+               <title>{{{title}}}</title>
+               <link>{{{url}}}</link>
+               <description>{{{description}}}</description>
+               <language>{{{language}}}</language>
+               <generator>MediaWiki {{{version}}}</generator>
+               <lastBuildDate>{{{timestamp}}}</lastBuildDate>
diff --git a/includes/templates/RSSItem.mustache b/includes/templates/RSSItem.mustache
new file mode 100644 (file)
index 0000000..d00c100
--- /dev/null
@@ -0,0 +1,9 @@
+               <item>
+                       <title>{{{title}}}</title>
+                       <link>{{{url}}}</link>
+                       <guid{{^permalink}} isPermaLink="false"{{/permalink}}>{{{uniqueID}}}</guid>
+                       <description>{{{description}}}</description>
+                       {{#date}}<pubDate>{{{.}}}</pubDate>{{/date}}
+                       {{#author}}<dc:creator>{{{.}}}</dc:creator>{{/author}}
+                       {{#comments}}<comments>{{{.}}}</comments>{{/comments}}
+               </item>
diff --git a/includes/user/UserIdentityValue.php b/includes/user/UserIdentityValue.php
new file mode 100644 (file)
index 0000000..e728264
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Value object representing a user's identity.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\User;
+
+use Wikimedia\Assert\Assert;
+
+/**
+ * Value object representing a user's identity.
+ *
+ * @since 1.31
+ */
+class UserIdentityValue implements UserIdentity {
+
+       /**
+        * @var int
+        */
+       private $id;
+
+       /**
+        * @var string
+        */
+       private $name;
+
+       /**
+        * @param int $id
+        * @param string $name
+        */
+       public function __construct( $id, $name ) {
+               Assert::parameterType( 'integer', $id, '$id' );
+               Assert::parameterType( 'string', $name, '$name' );
+
+               $this->id = $id;
+               $this->name = $name;
+       }
+
+       /**
+        * @return int The user ID. May be 0 for anonymous users or for users with no local account.
+        */
+       public function getId() {
+               return $this->id;
+       }
+
+       /**
+        * @return string The user's logical name. May be an IPv4 or IPv6 address for anonymous users.
+        */
+       public function getName() {
+               return $this->name;
+       }
+
+}
index 1c7c9b0..1415ea3 100644 (file)
@@ -74,7 +74,9 @@ class AutoloadGenerator {
         * @param string[] $paths
         */
        public function setExcludePaths( array $paths ) {
-               $this->excludePaths = $paths;
+               foreach ( $paths as $path ) {
+                       $this->excludePaths[] = self::normalizePathSeparator( $path );
+               }
        }
 
        /**
index bfd1d61..43a9c4e 100644 (file)
@@ -18,7 +18,7 @@
  * @file
  * @ingroup Watchlist
  */
-use MediaWiki\MediaWikiServices;
+
 use MediaWiki\Linker\LinkTarget;
 
 /**
@@ -30,34 +30,6 @@ use MediaWiki\Linker\LinkTarget;
  * @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
         */
@@ -77,20 +49,15 @@ class WatchedItem {
         * @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
+               $notificationTimestamp
        ) {
                $this->user = $user;
                $this->linkTarget = $linkTarget;
                $this->notificationTimestamp = $notificationTimestamp;
-               if ( $checkRights !== null ) {
-                       $this->checkRights = $checkRights;
-               }
        }
 
        /**
@@ -113,88 +80,6 @@ class WatchedItem {
         * @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 );
-       }
-
 }
index b28deeb..7751439 100644 (file)
        "newarticle": "(Nuut)",
        "newarticletext": "Hierdie bladsy bestaan nie.\nTik iets in die invoerboks hier onder om 'n nuwe bladsy te skep. Meer inligting is op die [$1 hulpbladsy] beskikbaar.\nAs u per ongeluk hier uitgekom het, gebruik u blaaier se '''terug'''-knoppie.",
        "anontalkpagetext": "----\n<em>Hierdie is die besprekingsblad vir 'n anonieme gebruiker wat nog nie 'n rekening geskep het nie, of wat dit nie gebruik nie.</em>\nDaarom moet ons sy/haar numeriese IP-adres vir identifikasie gebruik.\nSó 'n adres kan deur verskeie gebruikers gedeel word.\nIndien u 'n anonieme gebruiker is wat voel dat ontoepaslike kommentaar teen u gerig is, [[Special:CreateAccount|skep gerus 'n rekening]] of [[Special:UserLogin|meld aan]] om verwarring met ander anonieme gebruikers te voorkom.",
-       "noarticletext": "Hierdie bladsy bevat geen teks nie.\nU kan [[Special:Search/{{PAGENAME}}|vir die bladsytitel in ander bladsye soek]],\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} die verwante logboeke deursoek]\nof [{{fullurl:{{FULLPAGENAME}}|action=edit}} hierdie bladsy wysig]</span>.",
+       "noarticletext": "Hierdie bladsy bevat geen teks nie.\nU kan [[Special:Search/{{PAGENAME}}|vir die bladsytitel in ander bladsye soek]],\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} die verwante logboeke deursoek]\nof [{{fullurl:{{FULLPAGENAME}}|action=edit}} hierdie bladsy skep]</span>.",
        "noarticletext-nopermission": "Hierdie bladsy bevat geen teks nie.\nU kan vir die term [[Special:Search/{{PAGENAME}}|in ander bladsye soek]] of\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} die verwante logboeke deursoek]</span>, maar u kan nie die bladsy skep nie.",
        "missing-revision": "Die weergawe #$1 van die bladsy \"{{FULLPAGENAME}} bestaan nie.\n\nDit word meestal veroorsaak deur die volg van 'n verouderde verwysing na 'n bladsy wat verwyder is.\nMeer gegewens kan moontlik in die [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} skraplogboek] gevind word.",
        "userpage-userdoesnotexist": "U is besig om 'n gebruikersblad wat nie bestaan nie te wysig (gebruiker \"<nowiki>$1</nowiki>\"). Maak asseblief seker of u die bladsy wil skep/ wysig.",
        "rcfilters-activefilters": "Aktiewe filters",
        "rcfilters-advancedfilters": "Gevorderde filters",
        "rcfilters-limit-title": "Wysigings om te wys",
+       "rcfilters-limit-and-date-label": "{{PLURAL:$1|wysiging|$1 wysigings}}, $2",
+       "rcfilters-date-popup-title": "Tydperk om te deursoek",
        "rcfilters-days-title": "Afgelope dae",
        "rcfilters-hours-title": "Afgelope ure",
        "rcfilters-days-show-days": "$1 {{PLURAL:$1|dag|dae}}",
        "rcfilters-days-show-hours": "$1 {{PLURAL:$1|uur|ure}}",
        "rcfilters-highlighted-filters-list": "Bekleurklem: $1",
        "rcfilters-quickfilters": "Gestoorde filters",
-       "rcfilters-quickfilters-placeholder-title": "Geen gestoorde skakels",
+       "rcfilters-quickfilters-placeholder-title": "Geen gestoorde filters",
        "rcfilters-quickfilters-placeholder-description": "Om instellings te stoor en later weer te gebruik, kliek op die bladwyser-piktogram in die Aktiewe Filter-gebied onder.",
        "rcfilters-savedqueries-defaultlabel": "Gestoorde filters",
        "rcfilters-savedqueries-rename": "Hernoem",
        "rcfilters-restore-default-filters": "Stel filters terug",
        "rcfilters-clear-all-filters": "Verwyder alle filters",
        "rcfilters-show-new-changes": "Wys nuutste wysigings",
-       "rcfilters-search-placeholder": "Filter onlangse wysigings (blaai of begin tik)",
+       "rcfilters-search-placeholder": "Filter wysigings (blaai of begin tik)",
        "rcfilters-invalid-filter": "Ongeldig filter",
        "rcfilters-empty-filter": "Geen aktiewe filters. Alle wysigings word gewys.",
        "rcfilters-filterlist-title": "Filters",
        "rcfilters-filter-watchlist-notwatched-label": "Nie in dophoulys",
        "rcfilters-filter-watchlist-notwatched-description": "Alles behalwe wysigings aan bladsye op u dophoulys.",
        "rcfilters-filtergroup-watchlistactivity": "Dophoulys-bedrywighede",
+       "rcfilters-filter-watchlistactivity-unseen-label": "Nie-besigtigde wysigings",
+       "rcfilters-filter-watchlistactivity-unseen-description": "Wysigings aan blaaie wat u nog nie sedert die wysiging besoek het nie.",
+       "rcfilters-filter-watchlistactivity-seen-description": "Wysigings aan blaaie wat u reeds sedert die wysiging besoek het.",
        "rcfilters-filtergroup-changetype": "Soort wysiging",
        "rcfilters-filter-pageedits-label": "Bladsywysigings",
        "rcfilters-filter-pageedits-description": "Wysigings aan wiki-inhoud, besprekings en kategoriebeskrywings…",
        "rcfilters-view-tags": "Geëtiketteerde wysigings",
        "rcfilters-view-namespaces-tooltip": "Filtreer resultate volgens naamruimte",
        "rcfilters-view-tags-tooltip": "Filter resultate volgens wysigingsetikette",
+       "rcfilters-liveupdates-button": "Monitor bywerkings",
+       "rcfilters-liveupdates-button-title-off": "Wys nuwe wysigings soos hulle inrol.",
        "rcfilters-preference-label": "Versteek die verbeter weergawe van 'Onlangse wysigings'",
        "rcnotefrom": "{{PLURAL:$5|Wysiging|Wysigings}} sedert <strong>$3 om $4</strong> (maksimum van <strong>$1</strong> word gewys).",
        "rclistfrom": "Vertoon wysigings vanaf $3 $2",
index 55fb338..3ba0b96 100644 (file)
        "timezoneregion-indian": "المحيط الهندي",
        "timezoneregion-pacific": "المحيط الهادي",
        "allowemail": "اسمح للمستخدمين الآخرين بإرسال بريد إلكتروني إلي",
+       "email-allow-new-users-label": "اسمح بالبريد الإلكتروني من المستخدمين الجدد تمامًا",
        "email-blacklist-label": "امنع هؤلاء المستخدمين من إرسال بريد إلكتروني لي:",
        "prefs-searchoptions": "البحث",
        "prefs-namespaces": "أسماء النطاقات",
        "right-siteadmin": "غلق ورفع غلق قاعدة البيانات",
        "right-override-export-depth": "تصدير الصفحات متضمنة الصفحات الموصولة حتى عمق 5",
        "right-sendemail": "إرسال رسائل بريد إلكتروني إلى مستخدمين آخرين",
+       "right-sendemail-new-users": "إرسال رسالة بريد إلكتروني للمستخدمين الذين ليس لديهم أفعال في السجلات",
        "right-managechangetags": "إنشاء وتعطيل [[Special:Tags|الوسوم]]",
        "right-applychangetags": "تطبيق [[Special:Tags|الوسوم]]  مع التغييرات التي أجريتها.",
        "right-changetags": "إضافة وإزالة [[Special:Tags|وسوم]] في مراجعات ومدخلات سجل فردية",
        "rcfilters-preference-label": "أخف النسخة المحسنة من أحدث التغييرات",
        "rcfilters-preference-help": "يسترجع عملية إعادة تصميم الواجهة لعام 2017 وكل الأدوات التي أضيفت منذ ذلك الوقت.",
        "rcfilters-filter-showlinkedfrom-label": "عرض التغييرات في الصفحات الموصولة من",
-       "rcfilters-filter-showlinkedfrom-option-label": "اظÙ\87ر Ø§Ù\84تغÙ\8aÙ\8aرات Ù\81Ù\8a Ø§Ù\84صÙ\81حات Ø§Ù\84Ù\85رتبطة <strong>من</strong> صفحة",
+       "rcfilters-filter-showlinkedfrom-option-label": "عرض Ø§Ù\84تغÙ\8aÙ\8aرات Ù\81Ù\8a Ø§Ù\84صÙ\81حات Ø§Ù\84Ù\85Ù\88صÙ\88Ù\84ة <strong>من</strong> صفحة",
        "rcfilters-filter-showlinkedto-label": "أظهر التغييرات في الصفحات الموصولة بصفحة",
-       "rcfilters-filter-showlinkedto-option-label": "اظÙ\87ر Ø§Ù\84تغÙ\8aÙ\8aرات Ù\81Ù\8a Ø§Ù\84صÙ\81حات Ø§Ù\84Ù\85رتبطة <strong>Ø¥Ù\84Ù\89</strong> Ø§Ù\84صفحة",
+       "rcfilters-filter-showlinkedto-option-label": "عرض Ø§Ù\84تغÙ\8aÙ\8aرات Ù\81Ù\8a Ø§Ù\84صÙ\81حات Ø§Ù\84Ù\85Ù\88صÙ\88Ù\84Ø© <strong>Ø¥Ù\84Ù\89</strong> صفحة",
        "rcfilters-target-page-placeholder": "أدخل اسم صفحة",
        "rcnotefrom": "بالأسفل {{PLURAL:$5|التغيير|التغييرات}} منذ <strong>$2</strong> (إلى <strong>$1</strong> معروضة).",
        "rclistfromreset": "إعادة ضبط خيار التاريخ",
index 9caecd4..b8c3ea9 100644 (file)
        "timezoneregion-indian": "Індыйскі акіян",
        "timezoneregion-pacific": "Ціхі акіян",
        "allowemail": "Дазволіць іншым удзельнікам і ўдзельніцам дасылаць мне лісты электроннай поштай",
+       "email-allow-new-users-label": "Дазволіць лісты электроннай пошты ад зусім новых удзельнікаў",
        "email-blacklist-label": "Забараніць гэтым удзельнікам дасылаць мне лісты электроннай поштай:",
        "prefs-searchoptions": "Пошук",
        "prefs-namespaces": "Прасторы назваў",
        "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Магчма, ён працуе праз CGI і не падтрымлівае img_auth.\nГлядзіце https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization.",
        "import-mapping-namespace": "Імпарт у прастору назваў:",
        "import-mapping-subpage": "Імпарт у якасьці падстаронак наступнай старонкі:",
        "import-upload-filename": "Назва файла:",
+       "import-upload-username-prefix": "Прэфікс інтэрвікі:",
        "import-comment": "Камэнтар:",
        "importtext": "Калі ласка, экспартуйце файл з крынічнай вікі з дапамогай [[Special:Export|прылады экспарту]].\nЗахавайце яго на свой кампутар, а потым загрузіце сюды.",
        "importstart": "Імпартаваньне старонак…",
index e3d1c4b..5a6cb01 100644 (file)
@@ -71,7 +71,7 @@
        "tog-shownumberswatching": "Показване на броя на потребителите, наблюдаващи дадена страница",
        "tog-oldsig": "Вашият текущ подпис:",
        "tog-fancysig": "Без превръщане на подписа в препратка към потребителската страница",
-       "tog-uselivepreview": "Ð\98зползване Ð½Ð° Ð±Ñ\8aÑ\80з Ð¿Ñ\80едваÑ\80иÑ\82елен Ð¿Ñ\80еглед",
+       "tog-uselivepreview": "Ð\9fоказване Ð½Ð° Ð¿Ñ\80едваÑ\80иÑ\82елен Ð¿Ñ\80еглед Ð±ÐµÐ· Ð¿Ñ\80езаÑ\80еждане Ð½Ð° Ñ\81Ñ\82Ñ\80аниÑ\86аÑ\82а",
        "tog-forceeditsummary": "Предупреждаване при празно поле за резюме на редакцията",
        "tog-watchlisthideown": "Скриване на моите редакции в списъка ми за наблюдение",
        "tog-watchlisthidebots": "Скриване на редакциите на ботове в списъка ми за наблюдение",
        "anoneditwarning": "<strong>Внимание:</strong> Не сте влезли в системата. Ако направите редакция IP-адресът Ви ще бъде публично видим. Ако <strong>[$1 влезете]</strong> или си <strong>[$2 създадете акаунт]</strong>, редакциите Ви ще бъдат свързани с потребителското Ви име, заедно с други преимущества.",
        "anonpreviewwarning": "<em>Не сте влезли в системата. Ако съхраните редакцията си, тя ще бъде записана в историята на страницата с вашия IP-адрес.</em>",
        "missingsummary": "<strong>Напомняне:</strong> Не е въведено кратко описание на промените.\nПри повторно натискане на бутона „$1“, редакцията ще бъде съхранена без резюме.",
-       "missingcommenttext": "Ð\9fо-долÑ\83 Ð²Ñ\8aведеÑ\82е Ð²Ð°Ñ\88еÑ\82о Ñ\81Ñ\8aобÑ\89ение.",
+       "missingcommenttext": "Ð\9cолÑ\8f, Ð²Ñ\8aведеÑ\82е ÐºÐ¾Ð¼ÐµÐ½Ñ\82аÑ\80.",
        "missingcommentheader": "<strong>Напомняне:</strong> Не е въведено заглавие на коментара.\nПри повторно натискане на „$1“, редакцията ще бъде записана без коментар.",
        "summary-preview": "Предварителен преглед на резюмето:",
        "subject-preview": "Предварителен преглед на заглавието:",
        "prefs-editwatchlist-clear": "Изчистване на списъка за наблюдение",
        "prefs-watchlist-days": "Брой дни, които да се показват в списъка за наблюдение:",
        "prefs-watchlist-days-max": "Най-много $1 {{PLURAL:$1|ден|дни}}",
-       "prefs-watchlist-edits": "Ð\91Ñ\80ой Ñ\80едакÑ\86ии, ÐºÐ¾Ð¸Ñ\82о Ñ\81е Ð¿Ð¾ÐºÐ°Ð·Ð²Ð°Ñ\82 Ð² Ñ\80азÑ\88иÑ\80ениÑ\8f Ñ\81пиÑ\81Ñ\8aк за наблюдение:",
+       "prefs-watchlist-edits": "Ð\9cакÑ\81имален Ð±Ñ\80ой Ñ\80едакÑ\86ии Ð² Ñ\81пиÑ\81Ñ\8aка за наблюдение:",
        "prefs-watchlist-edits-max": "Максимален брой: 1000",
        "prefs-watchlist-token": "Уникален идентификатор на списъка за наблюдение:",
        "prefs-misc": "Други",
        "recentchangeslinked-feed": "Свързани промени",
        "recentchangeslinked-toolbox": "Свързани промени",
        "recentchangeslinked-title": "Промени, свързани с „$1“",
-       "recentchangeslinked-summary": "Тук се показват последните промени на страниците, към които се препраща от дадена страница. При избиране на категория, се показват промените по страниците, влизащи в нея. ''Пример:'' Ако изберете страницата '''А''', която съдържа препратки към '''Б''' и '''В''', тогава ще можете да прегледате промените по '''Б''' и '''В'''.\n\nАко пък сложите отметка пред '''Обръщане на релацията''', ще можете да прегледате промените в обратна посока: ще се включат тези страници, които съдържат препратки към посочената страница.\n\nСтраниците от списъка ви за наблюдение се показват в '''получер'''.",
+       "recentchangeslinked-summary": "Тук се показват последните промени на страниците, към които се препраща от дадена страница. При избиране на категория, се показват промените по страниците, влизащи в нея. ''Пример:'' Ако изберете страницата '''А''', която съдържа препратки към '''Б''' и '''В''', тогава ще можете да прегледате промените по '''Б''' и '''В'''.\n\nАко пък сложите отметка пред '''Обръщане на релацията''', ще можете да прегледате промените в обратна посока: ще се включат тези страници, които съдържат препратки към посочената страница.\n\nСтраниците от [[Special:Watchlist|списъка ви за наблюдение]] се показват в <strong>получер</strong>.",
        "recentchangeslinked-page": "Име на страницата:",
        "recentchangeslinked-to": "Обръщане на релацията, така че да се показват промените на страниците, сочещи към избраната страница",
        "recentchanges-page-added-to-category": "[[:$1]] е добавена към категория",
        "upload-file-error": "Вътрешна грешка",
        "upload-file-error-text": "Вътрешна грешка при опит за създаване на временен файл на сървъра.\nОбърнете се към [[Special:ListUsers/sysop|администратор]].",
        "upload-misc-error": "Неизвестна грешка при качване",
-       "upload-misc-error-text": "Неизвестна грешка при качване. Убедете се, че адресът е верен и опитайте отново. Ако отново имате проблем, обърнете се към [[Special:ListUsers/sysop|администратор]].",
+       "upload-misc-error-text": "Неизвестна грешка при качване.\nУбедете се, че адресът е верен и опитайте отново.\nАко отново имате проблем, обърнете се към [[Special:ListUsers/sysop|администратор]].",
        "upload-too-many-redirects": "Адресът съдържа твърде много пренасочвания",
        "upload-http-error": "Възникна HTTP грешка: $1",
        "upload-dialog-title": "Качване на файл",
index f0bc3ad..21f66a7 100644 (file)
        "timezoneregion-indian": "ভারত মহাসাগর",
        "timezoneregion-pacific": "প্রশান্ত মহাসাগর",
        "allowemail": "অন্য ব্যবহারকারীদেরকে আমাকে ইমেল করতে অনুমতি দিন",
+       "email-allow-new-users-label": "নতুন ব্যবহারকারীদেরকে ইমেলের অনুমতি দিন",
        "email-blacklist-label": "আমাকে ইমেইল পাঠানো থেকে এই ব্যবহারকারীদের বিরত রাখুন:",
        "prefs-searchoptions": "অনুসন্ধান",
        "prefs-namespaces": "নামস্থানসমূহ",
index 98ce04f..8e9cc41 100644 (file)
        "uploadstash-thumbnail": "mostra una miniatura",
        "uploadstash-bad-path": "El camí no existeix.",
        "uploadstash-bad-path-invalid": "El camí no és vàlid.",
+       "uploadstash-bad-path-unknown-type": "El tipus «$1» és desconegut.",
        "invalid-chunk-offset": "El desplaçament del fragment no és vàlid",
        "img-auth-accessdenied": "Accés denegat",
        "img-auth-nopathinfo": "Hi manca PATH_INFO.\nEl servidor no està configurat per passar aquesta informació.\nPot estar basat en CGI i no ser compatible amb img_auth.\nConsulteu https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization",
index 2577a30..21c5df1 100644 (file)
        "rcfilters-advancedfilters": "Шуьйра литтарш",
        "rcfilters-limit-title": "Гойту хийцамаш",
        "rcfilters-limit-and-date-label": "$1 {{PLURAL:$1|хийцам}}, $2",
-       "rcfilters-date-popup-title": "Ð\9bаÑ\85аÑ\80на Ñ\85ен",
+       "rcfilters-date-popup-title": "Ð\9bаÑ\85аÑ\80на Ñ\85ан",
        "rcfilters-days-title": "ТӀеххьара денош",
        "rcfilters-hours-title": "ТӀеххьара сахьташ",
        "rcfilters-days-show-days": "$1 {{PLURAL:$1|де}}",
        "feedback-submit": "Дахьийта",
        "feedback-thanks-title": "Баркалла!",
        "feedback-useragent": "Браузер:",
-       "searchsuggest-search": "Лаха {{grammar:prepositional|{{SITENAME}}}}",
+       "searchsuggest-search": "Лахар",
        "searchsuggest-containing": "чуьраниг…",
        "api-error-publishfailed": "Чоьхьара гӀалат: серверна хана йолу файл Ӏалашъян цаелира.",
        "api-error-stashfailed": "Чоьхьара гӀалат: серверна хана йолу файл Ӏалашъян цаелира.",
index ab589f0..9d62dbb 100644 (file)
        "timezoneregion-indian": "Indický oceán",
        "timezoneregion-pacific": "Tichý oceán",
        "allowemail": "Dovolit ostatním uživatelům posílat mi e-maily",
+       "email-allow-new-users-label": "Povolit e-maily od zcela nových uživatelů",
        "email-blacklist-label": "Znemožnit těmto uživatelům posílat mi e-maily:",
        "prefs-searchoptions": "Vyhledávání",
        "prefs-namespaces": "Jmenné prostory",
        "right-siteadmin": "Zamykání a odemykání databáze",
        "right-override-export-depth": "Exportovat stránky včetně odkazovaných stránek až do hloubky 5",
        "right-sendemail": "Odesílání e-mailů ostatním uživatelům",
+       "right-sendemail-new-users": "Posílání e-mailů uživatelům bez zaznamenaných činností",
        "right-managechangetags": "Vytváření a (de)aktivace [[Special:Tags|značek]]",
        "right-applychangetags": "Přidávání [[Special:Tags|značek]] k vlastním změnám",
        "right-changetags": "Přidávání libovolných [[Special:Tags|značek]] na jednotlivé revize a protokolovací záznamy a jejich odebírání",
        "recentchangeslinked-feed": "Související změny",
        "recentchangeslinked-toolbox": "Související změny",
        "recentchangeslinked-title": "Související změny pro stránku „$1“",
-       "recentchangeslinked-summary": "Níže je seznam nedávných změn stránek odkazovaných ze zadané stránky (nebo patřících do dané kategorie). Vaše [[Special:Watchlist|sledované stránky]] jsou '''zvýrazněny'''.",
+       "recentchangeslinked-summary": "Vložením názvu stránky uvidíte změny stránek, které na stránku odkazují nebo na které stránka odkazuje. (Pro stránky zařazené do kategorie vložte Kategorie:Název kategorie.) Vámi [[Special:Watchlist|sledované stránky]] jsou <strong>zvýrazněny</strong>.",
        "recentchangeslinked-page": "Název stránky:",
        "recentchangeslinked-to": "Zobrazit změny na stránkách odkazujících na zadanou stránku",
        "recentchanges-page-added-to-category": "Stránka [[:$1]] zařazena do kategorie",
        "tag-mw-replace": "Nahrazeno",
        "tag-mw-replace-description": "Editace, které odstraňují více než 90 % obsahu stránky",
        "tag-mw-rollback": "Rychlý revert",
+       "tag-mw-rollback-description": "Editace, jimiž byly předchozí editace vráceny zpět pomocí rychlého revertu",
        "tags-title": "Značky",
        "tags-intro": "Tato stránka obsahuje seznam značek, kterými může software označovat jednotlivé editace, a jejich významy.",
        "tags-tag": "Název značky",
index 744059b..75b4e0c 100644 (file)
        "recentchanges-label-plusminus": "Zjinaczonô wiôlgòsc starnë (lëczba bajtów)",
        "recentchanges-legend-heading": "<strong>Légenda:</strong>",
        "recentchanges-legend-newpage": "{{int:recentchanges-label-newpage}} (òbaczë téż [[Special:NewPages|lëstã nowëch strón]])",
+       "rcfilters-legend-heading": "<strong>Wëkôz skrodzënów:</strong>",
+       "rcfilters-other-review-tools": "Jiné nôrzãdza przezéru zjinaków",
+       "rcfilters-activefilters": "Aktiwné filtrë",
+       "rcfilters-search-placeholder": "Fitruj nowé zjinaczi (ùżij do te menu abò wëszukôj pòdle pòzwë filtra)",
+       "rcfilters-filterlist-title": "Filtrë",
+       "rcfilters-highlightbutton-title": "Pòdsztrichnąc wëniczi",
+       "rcfilters-filtergroup-authorship": "Aùtorstwò wkładu",
+       "rcfilters-filter-editsbyself-label": "Zjinaczi, chtërne zrobił jem jô.",
+       "rcfilters-filter-editsbyself-description": "Twòje gwôsné dzejania.",
+       "rcfilters-filter-editsbyother-label": "Zjinaczi, chtërne zrobilë jinszi brëkòwnicë.",
+       "rcfilters-filter-editsbyother-description": "Wszëtczé zjinaczi, òkróm twòjich.",
+       "rcfilters-filtergroup-userExpLevel": "Registracjô brëkòwnika i jegò doswiôdczenié",
+       "rcfilters-filter-user-experience-level-registered-label": "Zaregistrowóni",
+       "rcfilters-filter-user-experience-level-registered-description": "Zalogòwóni brëkòwnicë",
+       "rcfilters-filter-user-experience-level-unregistered-label": "Niezaregistrowóni",
+       "rcfilters-filter-user-experience-level-unregistered-description": "Niezalogòwóni brëkòwnicë",
+       "rcfilters-filter-user-experience-level-newcomer-label": "Pòczãtniczi",
+       "rcfilters-filter-user-experience-level-newcomer-description": "Zalogòwóni brëkòwnicë, jaczi mają mni jak 10 edicjów abò mni jak 4 dni aktiwnoscë.",
+       "rcfilters-filter-user-experience-level-learner-label": "Karno ùczącëch sã",
+       "rcfilters-filter-user-experience-level-learner-description": "Zaregistrowóni brëkòwnicë z doswiôdczenim wikszim niż „Pòczãtniczi”, ale miészim niż „Doswiôdczony brëkòwnicë”.",
+       "rcfilters-filter-user-experience-level-experienced-label": "Doswiôdczony brëkòwnicë.",
+       "rcfilters-filter-user-experience-level-experienced-description": "Zaregistrowóni brëkòwnicë, chtërny mają wicy jak 500 edicjów i 30 dni aktiwnoscë.",
+       "rcfilters-filter-bots-description": "Zjinaczi wëkònóné przë pòmòcë aùtomaticznëch nôrzãdzów.",
        "rcfilters-filter-humans-label": "Człowiek (nie bòt)",
+       "rcfilters-filter-humans-description": "Zjinaczi dokònany przez lëdzy",
+       "rcfilters-filter-minor-label": "Drobné zjinaczi",
+       "rcfilters-filter-minor-description": "Zjinaczi, chtërne aùtor nacéchòwôł jakò „drobné”.",
+       "rcfilters-filter-major-description": "Zjinaczi nie nacéchòwóné jakò „drobné”.",
+       "rcfilters-filtergroup-changetype": "Ôrt zjinaków",
+       "rcfilters-filter-pageedits-label": "Edicje starnë",
+       "rcfilters-filter-pageedits-description": "Edicje zamkłoscë, starnów diskùsje, òpisënków kategòrii...",
+       "rcfilters-filter-newpages-label": "Ùsôdzanié starnów",
+       "rcfilters-filter-newpages-description": "Zjinaczi, chtërne ùsôdzają nowé starnë.",
+       "rcfilters-filter-logactions-label": "Dzejania notérowóny w registru",
+       "rcfilters-filter-logactions-description": "Dzejania sprôwników, ùsôdzanié kònt, rëmanié starnów, sélanié lopków...",
+       "rcfilters-filtergroup-lastRevision": "Òstatné wersje.",
+       "rcfilters-filter-lastrevision-label": "Nônowszô wersjô",
+       "rcfilters-filter-lastrevision-description": "Leno nônowszi zjinaczi dlô kòżdi starnë.",
+       "rcfilters-filter-previousrevision-label": "Wersje jiné niż nônowszô.",
+       "rcfilters-filter-previousrevision-description": "Wszëtczé edicje, jaczé nie są nônowszą wersją starnë.",
+       "rcfilters-liveupdates-button": "Òdnôwianié na żëwò",
        "rcnotefrom": "Niżi {{PLURAL:$5|je zjinaka|są zjinaczi}} {{PLURAL:$5|zrobionô|zrobioné}} pò <strong>$3, $4</strong> (nie wicy jak '''$1''' pozycëji).",
        "rclistfrom": "Pòkażë nowé zmianë òd $3 $2",
        "rcshowhideminor": "$1 môłé zmianë",
index 348672e..37f7e83 100644 (file)
        "rcfilters-filter-categorization-description": "Optegnelser af at sider bliver tilføjet til eller fjernet fra kategorier.",
        "rcfilters-filter-logactions-label": "Loggede handlinger",
        "rcfilters-filter-logactions-description": "Administrative handlinger, kontooprettelser, sidesletninger, uploads...",
-       "rcfilters-filtergroup-lastRevision": "Sidste revision",
+       "rcfilters-filtergroup-lastRevision": "Seneste revisioner",
        "rcfilters-filter-lastrevision-label": "Seneste revision",
-       "rcfilters-filter-lastrevision-description": "Den nyeste ændring af en side.",
-       "rcfilters-filter-previousrevision-label": "Tidligere revisioner",
+       "rcfilters-filter-lastrevision-description": "Kun den seneste ændring af en side.",
+       "rcfilters-filter-previousrevision-label": "Ikke den seneste revision",
        "rcfilters-filter-previousrevision-description": "Alle ændringer som ikke er »seneste revision«.",
        "rcfilters-filter-excluded": "Ekskluderet",
        "rcfilters-view-tags": "Mærkede redigeringer",
        "rcfilters-watchlist-markseen-button": "Marker alle ændringer som set",
        "rcfilters-watchlist-edit-watchlist-button": "Rediger din liste med overvågede sider",
        "rcfilters-preference-label": "Skjul den forbedrede verson af Seneste ændringer",
+       "rcfilters-target-page-placeholder": "Indtast et sidenavn",
        "rcnotefrom": "Nedenfor er op til '''$1''' {{PLURAL:$5|ændring|ændringer}} siden '''$2''' vist.",
        "rclistfromreset": "Nulstil datovalg",
        "rclistfrom": "Vis nye ændringer startende fra den $3 kl. $2",
        "uploaddisabledtext": "Oplægning af filer er deaktiveret.",
        "php-uploaddisabledtext": "Oplægning af filer er forhindret i PHP. Tjek indstillingen for file_uploads.",
        "uploadscripted": "Denne fil indeholder HTML eller script-kode, der i visse tilfælde can fejlfortolkes af en browser.",
+       "uploaded-href-unsafe-target-svg": "Fandt href til usikre data: URI-mål <code>&lt;$1 $2=\"$3\"&gt;</code> i den overførte SVG-fil.",
        "uploadscriptednamespace": "Denne SVG-fil indeholder et ulovligt navnerum \"<nowiki>$1</nowiki>\"",
        "uploadinvalidxml": "XML i den uploadede fil kunne ikke tolkes.",
        "uploadvirus": "Denne fil indeholder en virus! Virusnavn: $1",
index 2904a9a..dc25eb0 100644 (file)
        "upload": "फाइल अपलोड गरऽ",
        "uploadbtn": "फाइल अपलोड गर्न्या",
        "upload-recreate-warning": "'''चेतावनी: त्यस नाममी रह्याका फाइलहरू सारियाको या हटायाको छ।'''\n\nयै पानाको सारियाको र हटायाको लग तमरो सहजताको लागि दियाको छ।",
+       "uploadlogpage": "अपलोड लग",
        "filedesc": "सारांश:",
        "large-file": "यो सिफारिस गर्याछकि फाइलहरूको आकार $1 भन्दा ठूला हुनु हुँदैन;\nयै फाइलको आकार $2 छ ।",
        "emptyfile": "तमीले अपलोड गर्याको फाइल रित्तो छ ।\nयो फाइल नाम गलत राख्याका कारणले भयाको हुनसकन्छ\nयो फाइल साँच्चै अपलोड गद्दे कुरडीमी निश्चित होइजाओ ।",
        "nolinkstoimage": "यो चित्रसित लिंकभयाकि कोइ पाना नाइथी",
        "morelinkstoimage": "यै फाइलको [[Special:WhatLinksHere/$1|थप लिंकहरू]] हेर ।",
        "sharedupload-desc-here": "यो फाइल $1 बठे हो र और  परियोजनाहरू बठे पन प्रयोग गद्द सकिन्याछ । \nताखाइ यैको [$2 फ़ाइल विवरण पानो]मि रयाका विवरण तल्तिर दियाको छ।",
+       "filepage-nofile": "येइ नाउँ को कोइ लै फाइल नाइथिन।",
        "upload-disallowed-here": "तमलाई यो फाइल अधिलेखन गद्द नाइसक्का ।",
        "filedelete-intro-old": "तमी <strong>[[Media:$1|$1]]</strong> को संस्करणलाई [$4 $3, $2] हुन्या गरि मेट्ट लाग्याछौ ।",
        "filedelete-maintenance": "रखरखाव चलिरह्याको हुनाले अस्थायी रुपमी फाइलहरू मेट्ट्या र मेट्याकोलाई पुनर्बहाली गर्न निष्क्रिय गरियाकोछ।",
        "activeusers-count": "विगत {{PLURAL:$3|दिनमी|$3 दिनहरूमी}}  $1 {{PLURAL:$1|सम्पादन गरियो|सम्पादनहरू गरिया}}",
        "activeusers-from": "यहाँबठे सुरु हुन्या प्रयोगकर्ताहरू धेकाओ:",
        "activeusers-noresult": "प्रयोगकर्ताहरू भेटियानन्",
+       "listgrouprights-members": "(सदस्यअनैः सूची)",
        "mailnologintext": "तमीले अरु प्रयोगकर्तानलाई ईमेल पठाउनको लागि आफु पहिली [[Special:UserLogin|प्रवेश(लगइन)गर्याको]] हुनुपडन्छ र [[Special:Preferences|आफ्नो रोजाइहरूमी]] एउटा वैध ईमेल ठेगाना भयाको हुनुपडन्छ ।",
        "emailuser": "येइ प्रयोगकर्ता लाई इमेल पठाऽ",
        "emailpagetext": "तल दियाको फार्मले तमी यै {{GENDER:$1|प्रयोगकर्ता}}लाई इमेल पठाउन सक्द्या हौ । तमीले जो ठेगाना [[Special:Preferences|आफ्नो प्रयोगकर्ता रोजाईहरू]]मी दियाका छियौ त्यो यै इमेललाई \"पठाउने\" को रूपमी आउन्याछ, अतः प्राप्तकर्ता तमीलाई सिधै जवाफ दिनसक्द्याछ ।",
        "usermaildisabledtext": "यै विकिमी तम और प्रयोगकर्तानलाई ई-मेल पठाउन नाइसक्दा",
+       "watchlist": "अवलोकनसूची",
        "mywatchlist": "मेरो ध्यान सूची",
        "nowatchlist": "तमरो ध्यान सूचीमी कोइ लै सामाग्री नाइथिन् ।",
        "watchlistanontext": "कृपया तमरो ध्यान सूची हेद्द या सम्पादन गद्द कीलाइ लगइन गर ।",
        "restriction-type": "अनुमति:",
        "pagesize": "(अक्षरहरू)",
        "restriction-edit": "सम्पादन",
+       "restriction-move": "सारऽ",
        "undeletepage": "मेट्याका पानाहरू हेद्या र पूर्वरुपमी फर्काउन्या",
        "undeleterevisions": "$1 {{PLURAL:$1|संशोधन|संशोधनहरू}} संग्रहित",
        "undeletehistory": "यदि कुनै पानालाई पुन: स्थापन गरायौ भण्या सम्पूर्ण संस्करणहरू इतिहासमी पुन:स्थापन हुन्याछन् ।\nयदि यै नामबठे  नयाँ पानो निर्माण भैसक्याको छ भण्या पुन: स्थापित संस्करणहरू पूर्व इतिहासको रुपमी स्थापित हुन्याछन् ।",
        "tooltip-namespace_association": "कुरडिकानी या विषय नेमस्पेसहरुलाई सम्वन्धित नेमस्पेसको रुपमि लिनकि लेखा सन्दुकमि चिनो लगाइदिय ।",
        "blanknamespace": "(मुख्य)",
        "contributions": "{{GENDER:$1|प्रयोगकर्ता}}को योगदान",
+       "contributions-title": "प्रयोगकर्ता $1 का योगदानअन",
        "mycontris": "मेरो योगदानहरू",
        "anoncontribs": "योगदान",
        "uctop": "(अइलोऽ)",
        "month": "महिना बठे (लै पैल्ली):",
        "year": "वर्ष बठे( लौ पैल्ली):",
+       "sp-contributions-newbies": "नौला खाताअनाः योगदानअन लाई मात्तरी धेकाऽ",
+       "sp-contributions-uploads": "अपलोडअन",
+       "sp-contributions-logs": "लगअन",
+       "sp-contributions-talk": "कुरड़िकाआनी",
+       "sp-contributions-search": "योगदानअन खिलाइ खोजी अरऽ",
+       "sp-contributions-username": "आइपी(IP) ठेगान या प्रयोगकर्ता नाउँ:",
        "sp-contributions-toponly": "नवीनतम संशोधनका सम्पादनहरू मात्र धेकाओ",
+       "sp-contributions-newonly": "तन सम्पादनअन लाई धेकाऽ जो कि पन्ना सिर्जनाअन हुन",
+       "sp-contributions-submit": "खोजऽ",
        "whatlinkshere": "याँखाइ कि जोणीन्छ",
        "whatlinkshere-title": "$1 सित जोडियाऽ पन्नाअन",
        "whatlinkshere-page": "पानो",
        "blocklist": "ब्लक गर्याका प्रयोगकर्ताहरू",
        "ipblocklist": "ब्लक गर्याका प्रयोगकर्ताहरू",
        "ipblocklist-legend": "ब्लक गर्याका प्रयोगकर्ताहरू खोज",
+       "infiniteblock": "अनन्त",
        "blocklink": "रोक्न्या",
        "contribslink": "योगदानअन",
        "block-log-flags-anononly": "नाम नभयाका प्रयोकर्ताहरू मात्र",
+       "proxyblocker": "प्रोक्सी निषेधक",
        "proxyblockreason": "तमरो IP ठेगानामी रोक लगायाको छ किनकी यो खुला प्रोक्सी हो ।\nकृपया तमरो इन्टरनेट सेवा प्रदायक या प्राविधिक सहायतासँग सम्पर्क गरीबर यै सुरक्षा समस्याका बारेमी जानकारी गराओ ।",
        "sorbsreason": "तमरो IP ठेगाना खुल्ला प्रोक्सीको रुपमी  DNSBL मा सूचीकरण गरिएको छ यैलाई{{SITENAME}}ले प्रयोगमी ल्यायाको छ।",
        "sorbs_create_account_reason": "तमरो IP ठेगाना खुल्ला प्रोक्सीको रुपमी  DNSBL मी सूचीकरण गरियाको छ यैलाई{{SITENAME}}ले प्रयोगमी ल्यायाको छ ।\nतम खाता खोल्न नाइसक्दा ।",
        "import-noarticle": "आयात गद्दाकी लाई पानाहरू नाइथिन्",
        "import-error-edit": "तमलाई सम्पादन गद्या अनुमति नभयाको पानो \"$1\" आयात गरिएन ।",
        "import-error-create": "तमलाई नयाँ बनाउने अनुमति नभयाको पानो \"$1\" आयात गरिएन ।",
+       "importlogpage": "आयात लग",
        "import-logentry-upload-detail": "$1 {{PLURAL:$1|संशोधन|संशोधनहरू}} आयात भयो",
        "tooltip-pt-userpage": "{{GENDER:|तमरो प्रयोगकर्ता}} पान्नो",
        "tooltip-pt-anonuserpage": "तमी जो IP ठेगानाको रुपमी सम्पादन गद्दै छौ , त्यैको प्रयोगकर्ता पानो निम्न छ :",
        "tooltip-ca-undelete": "मेट्याको भया पनि यै पानाको सम्पादनहरू पुन:प्राप्त गर",
        "tooltip-ca-move": "यो पानालाई अर्खिठौर सार",
        "tooltip-ca-watch": "यै पानालाई तमरा ध्यानसूचीमि थपिदिय",
+       "tooltip-ca-unwatch": "यै पानालाई तमरि अवलोकनसूची बठेइ हटाऽ",
        "tooltip-search": "{{SITENAME}}मी खोजऽ",
        "tooltip-search-go": "यदी ठ्याक्कै येइ नाउँ भया: पन्ना रैछ भँण्या तै मी जा:।",
        "tooltip-search-fulltext": "यै पाठका लागि पन्नाअनमी खोज",
        "tooltip-ca-nstab-special": "यो खास पानो हो ,तमी यैलाई आफै सम्पादन गद्द सक्दाइन",
        "tooltip-ca-nstab-project": "आयोजना पानो हेरिदिय",
        "tooltip-ca-nstab-image": "चित्र पानो हेर",
+       "tooltip-ca-nstab-mediawiki": "प्रणाली सन्देश हेरऽ",
        "tooltip-ca-nstab-template": "टेम्प्लेट(नमूना) हेरिदिय",
        "tooltip-ca-nstab-category": "श्रेणी पानो हेर",
        "tooltip-minoredit": "येइ लाई सामान्य सम्पादन भँणिबर चिनो लाऽ",
        "anonusers": "{{SITENAME}} का नाम नभयाका {{PLURAL:$2| प्रयोगकर्ता|प्रयोगकर्ताहरू}} $1",
        "simpleantispam-label": "ऐन्टी-स्प्याम जाँच।\nयैलाई <strong>नाइँ</strong> भद्य्या!",
        "pageinfo-title": "\"$1\" खिलाइ जानकारी",
+       "pageinfo-header-basic": "नानबड़ि जानकारी",
        "pageinfo-header-edits": "इतिहास सम्पादन",
+       "pageinfo-header-restrictions": "पन्ना सुरक्षा",
+       "pageinfo-display-title": "धेकिन्या शीर्षक",
+       "pageinfo-default-sort": "पूर्वनिर्धारित अनुक्रमण साँचो",
+       "pageinfo-length": "पन्ना लम्बाइ (बाइटअन मी)",
+       "pageinfo-article-id": "पन्ना आइडी",
+       "pageinfo-language": "पन्ना सामग्री भाषा",
+       "pageinfo-content-model": "पन्ना सामग्री ढङ्ङ",
        "pageinfo-robot-policy": "रोबटअन हताँ अनुक्रमण",
+       "pageinfo-robot-index": "अनुमति भयाऽ",
+       "pageinfo-robot-noindex": "अनुमति नभयाः",
        "pageinfo-watchers": "पन्ना निगरानी अद्द्याऽ सङ्ख्या",
+       "pageinfo-subpages-name": "येइ पन्नाः उपपन्नाअनोः सङ्ख्या",
        "pageinfo-firstuser": "पन्ना सर्जक",
        "pageinfo-firsttime": "पन्ना सिर्जना मिति",
        "pageinfo-edits": "कूल सम्पादन सङ्ख्या",
+       "pageinfo-magic-words": "जादुयी {{PLURAL:$1|आँखर|आँखरअन}} ($1)",
        "pageinfo-toolboxlink": "पन्नाइ जानकारी",
+       "pageinfo-contentpage": "सामग्री पन्नाः रूप मी गणियाऽ",
+       "pageinfo-contentpage-yes": "हाँ",
        "rcpatroldisabled": "अहिलका परिवर्तनहरू गस्ती निष्क्रिय पार्याको छ ।",
        "rcpatroldisabledtext": "अहिलका परिवर्तनहरू गस्ती गुण अहिलको लागि निष्कृय पारियाको छ ।",
        "markedaspatrollederror-noautopatrol": "तमी आफ्नै सम्पादनलाई गस्ती गरियाको भनि चिनो लगाउन नाइसक्दा ।",
        "watchlistedit-clear-done": "तमरो ध्यान सूची खाली गरीयाको छ।",
        "watchlisttools-view": "आधारित फेरबदलीहरू हेर",
        "signature": "[[{{ns:user}}:$1|$2]] ([[{{ns:user_talk}}:$1|कुरडी]])",
+       "redirect-submit": "जाऽ",
+       "redirect-user": "प्रयोगकर्ता आइडी",
+       "redirect-page": "पन्ना आइडी",
+       "redirect-revision": "पन्ना संशोधन",
+       "redirect-file": "फाइलनाउँ",
        "specialpages": "खास पन्नाअन",
        "specialpages-group-changes": "अल्लैका परिवर्तन लगहरू",
        "tags": "मान्य परिवर्तन ट्यागहरू",
        "tag-filter": "[[Special:Tags|पुछड]] छानिन्या",
        "tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1|ट्याग|ट्यागहरू}}]]: $2)",
+       "tags-active-no": "नाइँ",
        "tags-hitcount": "$1 {{PLURAL:$1|परिवर्तन|परिवर्तनहरू}}",
        "tags-create-no-name": "तमीले ट्याग नाम निर्दिष्ट गद्दु पड्ड्या हुन्छ ।",
        "tags-create-warnings-below": "क्या तमी यो ट्याग बनाउन्या काम जारी राख्न चाहन्छौ ?",
        "logentry-upload-upload": "$1 ले $3 {{GENDER:$2|अपलोड अरेका छन्}}",
        "feedback-bugornote": "यदि तमी कुनै प्राविधिक समस्यालाई विस्तारले सम्झाउन तयार छौ भण्या कृपया [$1 बग राख]।\nयदि हैन, भण्या तमी तल दियाको सरल फारमको प्रयोग गद्दसक्द्याहौ । तमरो टिप्पणी, तमरो प्रयोगकर्ता नाम र तमरो ब्राउजरको नाम सहित \"[$3 $2]\" पानामी जोडिन्याछ ।",
        "searchsuggest-search": "{{SITENAME}} खोजऽ",
+       "duration-days": "$1 {{PLURAL:$1|दिन|दिनअन}}",
        "expand_templates_preview_fail_html": "<em>किनकि {{SITENAME}} सिधै एचटिएमयल सक्षम छ र तमीले लग इन गर्या छैनौ, पूर्वावलोकन लुकाइयाको छ ताकि सम्भावित जाभास्क्रिप्ट आक्रमणलाई रोक्द सकियोस् ।</em>\n\n<strong>यदि यो मान्य पूर्ववावलोकन प्रयास हो भण्या पुन प्रयास गर ।</strong>\nयदि यसले कार्य पूर्ण भएन भण्या [[Special:UserLogout|लग आउट गरिबर]] फेरी लग इन गर्या ।",
        "expand_templates_preview_fail_html_anon": "<em>किनकि {{SITENAME}} सिधै एचटिएमयल सक्षम छ र तमीले लग इन गर्या छैनौ, पूर्वावलोकन लुकाइयाको छ ताकि सम्भावित जाभास्क्रिप्ट आक्रमणलाई रोक्द सकियोस् ।</em>\n\n<strong>यदि यो मान्य पूर्वावलोकन प्रयास हो भण्या कृपया [[Special:UserLogin|लग इन गरिबर]] पुनः प्रयास गर्या ।</strong>",
        "default-skin-not-found": "ओह! तमरो विकिको पूर्व निर्धारित खोल जस्तो कि <code dir=\"ltr\">$wgDefaultSkin</code> मी बताइयाको<code>$1</code>, उपलब्ध नाईथिन् ।\n\nतमरो इन्स्टलेसन यी खोलहरूलाई सम्मिलित गर्दछ {{PLURAL:$4|खोल|खोलहरू}}। हेर [https://www.mediawiki.org/wiki/Manual:Skin_configuration Manual: खोललाई सम्मिलित गर्नु] ताकि तमीलाई जानकारी होस् कि कसरि {{PLURAL:$4|उसलाई|उसलाई सम्मिलित गर्न सकियोस् र निर्धारितलाई तय गद्दे}}।\n\n$2\n\n; यदि तमीले अहिले मीडियाविकि इन्स्टाल गर्याका छौ:\n: तमीले सम्भवत गिटबठे इन्स्टाल गर्याका छौ, वा सिधै स्रोत कोडबठे गर्याका छौ जैको लागि कुनै अर्कै तारिका प्रयोग गरियाको छ । यो आशा अनुरूप छ । कोशिश गर केहि खोलहरू\n[https://www.mediawiki.org/wiki/Category:All_skins mediawiki.org's मीडियाविकिको खोल डाइरेक्ट्रीबाट डाउनलोड गद्या], जैको लागि तमी:\n:* डाउनलोड गर [https://www.mediawiki.org/wiki/Download टरबल इन्स्टालर], जुन कयौं खोलहरू र विस्तारमी उपलब्ध छन्। तमी खोलहरूको कोड <code>skins/</code> त्यसको डाइरेक्ट्रीबाट कपी-पेस्ट गद्द सक्द्या हौ। \n:* व्यक्तिगत खोलहरू टरबलबठे डाउनलोड गर\n[https://www.mediawiki.org/wiki/Special:SkinDistributor मीडिया विकि] बठे।\n:* [https://www.mediawiki.org/wiki/Download_from_Git#Using_Git_to_download_MediaWiki_skins गिटको प्रयोग गरेर डाउनलोड गद्द सकन्छौ]।\n: यदि तमी विकासकर्ता हौ भण्या यसो गद्दा तमरो गिट-रिपजिटरीमी केहि हुनुहुँदैन । \n; यदि तमीले अहिले मीडियाविकिलाई अपग्रेड गर्याका छौ:\n: मीडियाविकि १.२४ र यैको नवीन रूप स्वतः रूपले खोलहरूलाई सक्षम गद्दैनन् (हेर [https://www.mediawiki.org/wiki/Manual:Skin_autodiscovery Manual:खोलहरूको स्वतः खोज])। तमी निम्नलिखितलाई पेस्ट गद्द सकन्छौ: {{PLURAL:$5|लाइन|लाइनहरू}}  <code>LocalSettings.php</code> मी ताकि {{PLURAL:$5|उसले|सबै}} सक्षम होस् जस्तो कि तमीले इन्स्टाल गर्याको {{PLURAL:$5|खोल|खोलहरू}}को मामिलामी:\n\n<pre dir=\"ltr\">$3</pre>\n\n; यदि तमीले अहिले परिवर्तन गर्याका छौ<code>LocalSettings.php</code>:\n: खोल नामहरूको अगाडी डबल-क्लिक गर जसले तमलाई विभिन्न प्रकारहरूको विकल्प दिन्छ।",
index 5e7c8cb..3a67982 100644 (file)
        "rcfilters-preference-label": "Hide the improved version of Recent Changes",
        "rcfilters-preference-help": "Rolls back the 2017 interface redesign and all tools added then and since.",
        "rcfilters-filter-showlinkedfrom-label": "Show changes on pages linked from",
-       "rcfilters-filter-showlinkedfrom-option-label": "Show changes on pages linked <strong>FROM</strong> a page",
-       "rcfilters-filter-showlinkedto-label": "Show changes on pages linked to",
-       "rcfilters-filter-showlinkedto-option-label": "Show changes on pages linked <strong>TO</strong> a page",
+       "rcfilters-filter-showlinkedfrom-option-label": "<strong>Pages linked from</strong> the selected page",
+       "rcfilters-filter-showlinkedto-label": "Show changes on pages linking to",
+       "rcfilters-filter-showlinkedto-option-label": "<strong>Pages linking to</strong> the selected page",
        "rcfilters-target-page-placeholder": "Enter a page name",
        "rcnotefrom": "Below {{PLURAL:$5|is the change|are the changes}} since <strong>$3, $4</strong> (up to <strong>$1</strong> shown).",
        "rclistfromreset": "Reset date selection",
index d5bda60..42974b7 100644 (file)
        "nosuchusershort": "Ne ekzistas uzanto kun la nomo \"$1\". Bonvolu kontroli vian ortografion.",
        "nouserspecified": "Vi devas entajpi salutnomon.",
        "login-userblocked": "Ĉi tiu uzanto estas forbarita. Ensalutado ne estas permesita.",
-       "wrongpassword": "Vi tajpis malĝustan pasvorton. Bonvolu provi denove.",
+       "wrongpassword": "Vi tajpis malĝustan uzantnomon aŭ pasvorton.\nBonvolu provi denove.",
        "wrongpasswordempty": "Vi tajpis malplenan pasvorton. Bonvolu provi denove.",
        "passwordtooshort": "Pasvortoj devas esti longaj almenaŭ  $1 {{PLURAL:$1|1 signon|$1 signojn}}.",
        "passwordtoolong": "Pasvorto ne povas esti pli longa ol {{PLURAL:$1|1 signo|$1 signoj}}.",
        "recentchangeslinked-feed": "Rilataj paĝoj",
        "recentchangeslinked-toolbox": "Rilataj ŝanĝoj",
        "recentchangeslinked-title": "Ŝanĝoj rilataj al \"$1\"",
-       "recentchangeslinked-summary": "Jen listo de ŝanĝoj faritaj lastatempe al paĝoj ligitaj el specifa paĝo (aŭ al membroj de specifa kategorio).\nPaĝoj en [[Special:Watchlist|via atentaro]] estas '''grasaj'''.",
+       "recentchangeslinked-summary": "Entajpu nomon de paĝo por vidi ŝanĝojn sur paĝoj ligitaj el aŭ al tiu ĉi paĝo. (Por vidi anojn de kategorio, entajpu Category:nomo de kategorio). Ŝanĝoj sur paĝoj en [[Special:Watchlist|via atentaro]] markiĝas <strong>grase</strong>.",
        "recentchangeslinked-page": "Nomo de paĝo:",
        "recentchangeslinked-to": "Montru ŝanĝojn al paĝoj ligitaj al la specifa paĝo anstataŭe.",
        "recentchanges-page-added-to-category": "[[:$1]] aldonita al la kategorio",
index 969f08a..a3a9cad 100644 (file)
        "botpasswords-insert-failed": "No se pudo agregar el nombre del bot \"$1\". ¿Ya ha sido añadido?",
        "botpasswords-update-failed": "No se pudo actualizar el nombre del bot \"$1\". ¿Ha sido borrado?",
        "botpasswords-created-title": "Se creó la contraseña de bot",
-       "botpasswords-created-body": "Se creó la contraseña del bot llamado \"$1\" del usuario \"$2\".",
+       "botpasswords-created-body": "Se creó la contraseña del robot «$1» perteneciente {{GENDER:$2|al usuario|a la usuaria}} «$2».",
        "botpasswords-updated-title": "Se actualizó la contraseña de bot",
-       "botpasswords-updated-body": "Se actualizó la contraseña del bot llamado \"$1\" del usuario \"$2\".",
+       "botpasswords-updated-body": "Se actualizó la contraseña del robot «$1» perteneciente {{GENDER:$2|al usuario|a la usuaria}} «$2».",
        "botpasswords-deleted-title": "Se eliminó la contraseña de bot",
-       "botpasswords-deleted-body": "Se eliminó la contraseña del bot llamado \"$1\" del usuario \"$2\".",
+       "botpasswords-deleted-body": "Se eliminó la contraseña del robot «$1» perteneciente {{GENDER:$2|al usuario|a la usuaria}} «$2».",
        "botpasswords-newpassword": "La contraseña nueva para acceder con <strong>$1</strong> es <strong>$2</strong>. <em>Guarda esta información para su consulta futura.</em> <br> (En caso de robots antiguos que requieren que el nombre de acceso coincida con el de usuario, también puedes utilizar <strong>$3</strong> como nombre de usuario y <strong>$4</strong> como contraseña.)",
        "botpasswords-no-provider": "BotPasswordsSessionProvider no está disponible.",
        "botpasswords-restriction-failed": "Las restricciones de la contraseña de bot impiden este inicio de sesión.",
        "timezoneregion-indian": "Océano Índico",
        "timezoneregion-pacific": "Océano Pacífico",
        "allowemail": "Permitir que otros usuarios me envíen mensajes de correo",
+       "email-allow-new-users-label": "Permitir mensajes de correo de usuarios nuevos",
        "email-blacklist-label": "Prohibir a estos usuarios enviarme mensajes de correo:",
        "prefs-searchoptions": "Buscar",
        "prefs-namespaces": "Espacios de nombres",
        "rcfilters-restore-default-filters": "Restaurar filtros predeterminados",
        "rcfilters-clear-all-filters": "Borrar todos los filtros",
        "rcfilters-show-new-changes": "Ver cambios más recientes",
-       "rcfilters-search-placeholder": "Filtrar cambios (usa el menú o buscar para aplicar filtro)",
+       "rcfilters-search-placeholder": "Filtrar cambios (utiliza el menú o busca el nombre de un filtro)",
        "rcfilters-invalid-filter": "Filtro no válido",
        "rcfilters-empty-filter": "No hay filtros activos. Se muestran todas las contribuciones.",
        "rcfilters-filterlist-title": "Filtros",
        "tooltip-ca-undelete": "Restaurar las ediciones hechas a esta página antes de que fuese borrada",
        "tooltip-ca-move": "Trasladar esta página",
        "tooltip-ca-watch": "Añadir esta página a tu lista de seguimiento",
-       "tooltip-ca-unwatch": "Borrar esta página de su lista de seguimiento",
+       "tooltip-ca-unwatch": "Quitar esta página de tu lista de seguimiento",
        "tooltip-search": "Buscar en {{SITENAME}}",
        "tooltip-search-go": "Ir a la página con este nombre exacto si existe",
        "tooltip-search-fulltext": "Buscar este texto en las páginas",
        "tooltip-ca-nstab-main": "Ver la página de contenido",
        "tooltip-ca-nstab-user": "Ver la página del usuario",
        "tooltip-ca-nstab-media": "Ver la página de multimedia",
-       "tooltip-ca-nstab-special": "Esta es una página especial, y no puede editarse",
+       "tooltip-ca-nstab-special": "Esta es una página especial y no puede editarse",
        "tooltip-ca-nstab-project": "Ver la página del proyecto",
        "tooltip-ca-nstab-image": "Ver la página del archivo",
        "tooltip-ca-nstab-mediawiki": "Ver el mensaje de sistema",
index 43b246b..004c740 100644 (file)
        "autosumm-blank": "صفحه را خالی کرد",
        "autosumm-replace": "جایگزینی صفحه با '$1'",
        "autoredircomment": "تغییرمسیر به [[$1]]",
+       "autosumm-removed-redirect": "تغییرمسیر به [[$1]] حذف شد",
        "autosumm-new": "صفحه‌ای تازه حاوی «$1» ایجاد کرد",
        "autosumm-newblank": "ایجاد صفحه خالی",
        "size-bytes": "$1 بایت",
        "tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1|برچسب|برچسب‌ها}}]]: $2)",
        "tag-mw-contentmodelchange": "تغییر مدل محتوا",
        "tag-mw-contentmodelchange-description": "ویرایش‌هایی که [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:ChangeContentModel مدل محتوای صفحه را تغییر می‌دهند]",
+       "tag-mw-removed-redirect": "تغییرمسیر حذف شد",
+       "tag-mw-rollback": "واگردانی",
        "tags-title": "برچسب‌ها",
        "tags-intro": "این صفحه فهرستی‌است از برچسب‌هایی که نرم‌افزار با آن‌ها ویرایش‌ها را علامت‌گذری می‌کند، به همراه معانی آن‌ها.",
        "tags-tag": "نام برچسب",
index 7625d13..eb6f531 100644 (file)
        "timezoneregion-indian": "Océan indien",
        "timezoneregion-pacific": "Océan pacifique",
        "allowemail": "Autoriser les autres utilisateurs à m'envoyer des courriels",
+       "email-allow-new-users-label": "Autoriser les courriels émis par les nouveaux utilisateurs",
        "email-blacklist-label": "Empêcher ces utilisateurs de m'envoyer des courriels :",
        "prefs-searchoptions": "Recherche",
        "prefs-namespaces": "Espaces de noms",
        "logentry-delete-delete": "$1 a supprimé la page $3",
        "logentry-delete-delete_redir": "$1 a {{GENDER:$2|supprimé}} la redirection vers $3 par écrasement",
        "logentry-delete-restore": "$1 a restauré la page $3 ($4)",
-       "logentry-delete-restore-nocount": "$1 {{GENDER:$2|a restauré}} la page $3",
+       "logentry-delete-restore-nocount": "$1 {{GENDER:$2||}}a restauré la page $3",
        "restore-count-revisions": "{{PLURAL:$1|1 révision|$1 révisions}}",
        "restore-count-files": "{{PLURAL:$1|1 fichier|$1 fichiers}}",
        "logentry-delete-event": "$1 {{GENDER:$2|a modifié}} la visibilité {{PLURAL:$5|d'un événement du journal|de $5 événements du journal}} sur $3: $4",
index 4782947..e8ae7e6 100644 (file)
        "timezoneregion-indian": "Océano Índico",
        "timezoneregion-pacific": "Océano Pacífico",
        "allowemail": "Admitir mensaxes de correo electrónico doutros usuarios",
+       "email-allow-new-users-label": "Permite correos electrónicos de usuarios novos",
        "email-blacklist-label": "Prohibir a eses usuarios enviarme correos electrónicosː",
        "prefs-searchoptions": "Procura",
        "prefs-namespaces": "Espazos de nomes",
        "recentchangeslinked-feed": "Cambios relacionados",
        "recentchangeslinked-toolbox": "Cambios relacionados",
        "recentchangeslinked-title": "Cambios relacionados con \"$1\"",
-       "recentchangeslinked-summary": "Esta é unha lista dos cambios que se realizaron recentemente nas páxinas vinculadas a esta (ou nos membros da categoría especificada).\nAs páxinas da súa [[Special:Watchlist|lista de vixilancia]] aparecen en '''negra'''.",
+       "recentchangeslinked-summary": "Introduce un nome de páxina para ver os cambios en páxinas ligadas dende ou ata esa páxina. (Para ver os membros dunha categoría, introduce Categoría:Nome da categoría). Os cambios na túa [[Special:Watchlist|lista de vixiancia]] están en <strong>negra</strong>.",
        "recentchangeslinked-page": "Nome da páxina:",
        "recentchangeslinked-to": "Mostrar os cambios relacionados das páxinas que ligan coa dada",
        "recentchanges-page-added-to-category": "\"[[:$1]]\" engadiuse á categoría",
index 43dff0f..25a09cb 100644 (file)
@@ -84,7 +84,8 @@
                        "चक्रपाणी",
                        "Anamdas",
                        "Sachinkatiyar",
-                       "Rishi.Singh"
+                       "Rishi.Singh",
+                       "Clockery"
                ]
        },
        "tog-underline": "कड़ियाँ अधोरेखन:",
        "watcherrortext": "\"$1\" के लिये आपकी ध्यानसूची सेटिंग बदलते समय त्रुटि हुई।",
        "enotif_reset": "सभी पृष्ठ देखे हुए दर्शाएँ",
        "enotif_impersonal_salutation": "{{SITENAME}} सदस्य",
-       "enotif_subject_deleted": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने हटा दिया है",
-       "enotif_subject_created": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने बना दिया है",
-       "enotif_subject_moved": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने स्थानांतरित कर दिया है",
-       "enotif_subject_restored": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने पुनर्स्थापित कर दिया है",
-       "enotif_subject_changed": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने परिवर्तित किया है",
-       "enotif_body_intro_deleted": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने $PAGEEDITDATE को हटा दिया है, देखें <$3>।",
-       "enotif_body_intro_created": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने $PAGEEDITDATE को बनाया है, वर्तमान अवतरण के लिए $3 देखें।",
-       "enotif_body_intro_moved": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने $PAGEEDITDATE को स्थानांतरित किया है, वर्तमान अवतरण के लिए $3 देखें।",
-       "enotif_body_intro_restored": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने $PAGEEDITDATE को पुनर्स्थापित किया है, वर्तमान अवतरण के लिए $3 देखें।",
-       "enotif_body_intro_changed": "{{SITENAME}} पृष्ठ $1 को {{gender:$2|$2}} ने $PAGEEDITDATE को परिवर्तित किया है, वर्तमान अवतरण के लिए $3 देखें।",
+       "enotif_subject_deleted": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने हटा दिया है",
+       "enotif_subject_created": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने बना दिया है",
+       "enotif_subject_moved": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने स्थानांतरित कर दिया है",
+       "enotif_subject_restored": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने पुनर्स्थापित कर दिया है",
+       "enotif_subject_changed": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने परिवर्तित किया है",
+       "enotif_body_intro_deleted": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने $PAGEEDITDATE को हटा दिया है, देखें $3।",
+       "enotif_body_intro_created": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने $PAGEEDITDATE को बनाया है, वर्तमान अवतरण के लिए $3 देखें।",
+       "enotif_body_intro_moved": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने $PAGEEDITDATE को स्थानांतरित किया है, वर्तमान अवतरण के लिए $3 देखें।",
+       "enotif_body_intro_restored": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने $PAGEEDITDATE को पुनर्स्थापित किया है, वर्तमान अवतरण के लिए $3 देखें।",
+       "enotif_body_intro_changed": "{{SITENAME}} पृष्ठ $1 को {{GENDER:$2|$2}} ने $PAGEEDITDATE को परिवर्तित किया है, वर्तमान अवतरण के लिए $3 देखें।",
        "enotif_lastvisited": "आपकी आखिरी भेंट के बाद हुए बदलाव देखने के लिये $1 देखें।",
        "enotif_lastdiff": "इस बदलाव को देखने के लिये $1 देखें।",
        "enotif_anon_editor": "अनामक सदस्य $1",
index a5722ad..a29aa2c 100644 (file)
        "nosuchusershort": "Ne postoji suradnik s imenom \"$1\". Provjerite Vaš unos.",
        "nouserspecified": "Molimo navedite suradničko ime.",
        "login-userblocked": "Ovaj je suradnik blokiran. Prijava nije dopuštena.",
-       "wrongpassword": "Zaporka koju ste unijeli nije ispravna. Molimo Vas, pokušajte ponovo.",
+       "wrongpassword": "Suradničko ime ili zaporka koju ste unijeli nije ispravno. Molimo Vas, pokušajte ponovo.",
        "wrongpasswordempty": "Niste unijeli zaporku. Pokušajte ponovno.",
        "passwordtooshort": "Zaporka mora sadržavati najmanje {{PLURAL:$1|1 znak|$1 znaka|$1 znakova}}.",
        "passwordtoolong": "Zaporke ne mogu biti duže od {{PLURAL:$1|jednoga znaka|$1 znaka|$1 znakova}}.",
        "defemailsubject": "{{SITENAME}} e-mail od suradnika \"$1\"",
        "usermaildisabled": "Suradnička e-pošta je onemogućena",
        "usermaildisabledtext": "Ne možete slati e-poštu drugim suradnicima na ovom wikiju",
-       "noemailtitle": "Nema adrese primaoca",
+       "noemailtitle": "Nema adrese e-pošte",
        "noemailtext": "Ovaj suradnik nije odredio valjanu adresu e-pošte.",
        "nowikiemailtext": "Ovaj suradnik je odlučio ne primati e-mail od drugih suradnika.",
        "emailnotarget": "Nepostojeće ili nevažeće suradničko ime za primatelja.",
        "autosumm-blank": "uklonjen cjelokupni sadržaj stranice",
        "autosumm-replace": "Zamijenjen sadržaj stranice s »$1«",
        "autoredircomment": "Preusmjeravanje stranice na [[$1]]",
+       "autosumm-removed-redirect": "Uklonjeno preusmjeravanje na [[$1]]",
+       "autosumm-changed-redirect-target": "Promijenjeno je odredište preusmjeravanja sa stranice [[$1]] na [[$2]]",
        "autosumm-new": "Stvorena nova stranica sa sadržajem: »$1«.",
        "autosumm-newblank": "Stvorena prazna stranica.",
        "size-bytes": "$1 {{PLURAL:$1|bajt|bajta|bajtova}}",
        "watchlistedit-raw-done": "Vaš popis praćenja je snimljen.",
        "watchlistedit-raw-added": "{{PLURAL:$1|1 stranica je dodana|$1 stranice su dodane}}:",
        "watchlistedit-raw-removed": "{{PLURAL:$1|1 stranica je uklonjena|$1 stranice su ukonjene}}:",
-       "watchlistedit-clear-title": "Očišćen popis praćenja",
+       "watchlistedit-clear-title": "Očisti popis praćenja",
        "watchlistedit-clear-legend": "Obriši popis praćenja",
        "watchlistedit-clear-explain": "Sve stavke s popisa praćenja će biti izbrisane",
        "watchlistedit-clear-titles": "Imena stranica:",
index e32e56e..500e25e 100644 (file)
        "tag-filter-submit": "Penyaring",
        "tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1|Tenger|Tenger}}]]: $2)",
        "tag-mw-contentmodelchange": "owahan modhèl isi",
+       "tag-mw-blank": "Ngosongaké",
        "tags-title": "Tag",
        "tags-intro": "Kaca iki isi pratélan tenger sing dienggo nandhani besutan déning piranti alus, sinartan tegesé.",
        "tags-tag": "Jeneng tag",
index 1915f47..5fb17ba 100644 (file)
        "action-changetags": "თავისუფალი ტეგების დამატება და წაშლა ცალკეულ ცვლილებებსა და ჟურნალების ჩანაწერებში",
        "action-deletechangetags": "მონაცემთა ბაზიდან ტეგების წაშლა",
        "action-purge": "ამ გვერდის წაშლა",
-       "nchanges": "$1 ცვლილება",
+       "nchanges": "$1 {{PLURAL:$1|ცვლილება|ცვლილება}}",
        "enhancedrc-since-last-visit": "$1 {{PLURAL:$1|ბოლო ვიზიტის შემდეგ}}",
        "enhancedrc-history": "ისტორია",
        "recentchanges": "ბოლო ცვლილებები",
        "rcfilters-activefilters": "აქტიური ფილტრები",
        "rcfilters-advancedfilters": "გაფართოებული ფილტრები",
        "rcfilters-limit-title": "ცვლილელების ნახვა",
-       "rcfilters-limit-and-date-label": "$1 {{PLURAL:$1|ცვლილება|ცვლილება|ცვლილება}}, $2",
+       "rcfilters-limit-and-date-label": "{{PLURAL:$1|ცვლილება|$1 ცვლილება}}, $2",
        "rcfilters-date-popup-title": "საძიებო დროის მონაკვეთი",
        "rcfilters-days-title": "უკანასკნელი დღეები",
        "rcfilters-hours-title": "ბოლო საათები",
        "autosumm-blank": "გვერდის შიგთავსი დაცარიელდა",
        "autosumm-replace": "შინაარსი შეიცვალა „$1“-ით",
        "autoredircomment": "გადამისამართება [[$1]]-ზე",
+       "autosumm-removed-redirect": "წაშლილი გადამისამართება [[$1]]",
        "autosumm-new": "ახალი გვერდი: $1",
        "autosumm-newblank": "ცარიელი გვერდი შეიქმნა",
        "size-bytes": "$1 ბ",
        "tags-delete": "წაშლა",
        "tags-activate": "გააქტიურება",
        "tags-deactivate": "დეაქტივაცია",
-       "tags-hitcount": "$1 ცვლილება",
+       "tags-hitcount": "$1 {{PLURAL:$1|ცვლილება|ცვლილება}}",
        "tags-manage-no-permission": "თქვენ არ გაქვთ შეცვლილი დასათაურების მართვის უფლება",
        "tags-manage-blocked": "თქვენ ვერ შეძლებთ ცვლილებების ტეგების მართვას სანამ {{GENDER:$1|თქვენ}} დაბლოკილი ხართ.",
        "tags-create-heading": "ახალი ტეგის შექმნა",
index 6b76645..04e37e8 100644 (file)
        "timezoneregion-indian": "인도양",
        "timezoneregion-pacific": "태평양",
        "allowemail": "다른 사용자가 내게 이메일을 보낼 수 있게 허용",
+       "email-allow-new-users-label": "처음 온 사용자들로부터 오는 이메일 허용",
        "email-blacklist-label": "이 사용자들이 내게 이메일을 보내는 것을 금지합니다:",
        "prefs-searchoptions": "검색",
        "prefs-namespaces": "이름공간",
index 1865252..2e93cba 100644 (file)
        "recentchangesdays-max": "(Maximal $1 {{PLURAL:$1|Dag|Deeg}})",
        "recentchangescount": "Zuel vun den Ännerungen déi als Standard gewise ginn:",
        "prefs-help-recentchangescount": "Inklusiv Rezent Ännerungen, Versiounshistoriquen a Logbicher.",
-       "prefs-help-watchlist-token2": "Dëst ass de geheime Schlëssel fir de Webfeed vun Ärer Iwwerwaachungslëscht. Jiddwereen deen e kennt kann Är Iwwerwaachungslëscht liesen, dofir sollt Dir en net weider ginn. [[Special:ResetTokens|Klickt hei wann Dir en zrécksetze musst]].",
+       "prefs-help-watchlist-token2": "Dëst ass de geheime Schlëssel fir de Webfeed vun Ärer Iwwerwaachungslëscht. Jiddwereen deen e kennt kann Är Iwwerwaachungslëscht liesen, dofir sollt Dir en net weider ginn. Wann Dir wëllt [[Special:ResetTokens|kënnt Dir en hei zrécksetze kënnt]].",
        "savedprefs": "Är Astellunge goufe gespäichert.",
        "savedrights": "D'Benotzergruppe vum {{GENDER:$1|$1}} goufe gespäichert.",
        "timezonelegend": "Zäitzon:",
        "timezoneregion-indian": "Indeschen Ozean",
        "timezoneregion-pacific": "Pazifeschen Ozean",
        "allowemail": "E-Maile vun anere Benotzer kréien.",
+       "email-allow-new-users-label": "E-Maile vu ganz neie Benotzer erlaben",
        "prefs-searchoptions": "Sichen",
        "prefs-namespaces": "Nummraim",
        "default": "Standard",
        "recentchangeslinked-feed": "Ännerungen op verlinkt Säiten",
        "recentchangeslinked-toolbox": "Ännerungen op verlinkt Säiten",
        "recentchangeslinked-title": "Ännerungen a Verbindung mat \"$1\"",
-       "recentchangeslinked-summary": "Dëst ass eng Lëscht mat Ännerunge vu verlinkte Säiten op eng bestëmmte Säit (oder vu Membersäite vun der spezifizéierter Kategorie).\nSäite vun [[Special:Watchlist|Ärer Iwwerwaachungslëscht]] si '''fett''' geschriwwen.",
+       "recentchangeslinked-summary": "Gitt den Numm vun enger Säit a fir Ännerungen Säiten ze gesinn op déi oder vun deene gelinkt gëtt. Ännerungen op Säite vun [[Special:Watchlist|Ärer Iwwerwaachungslëscht]] si <strong>fett</strong> geschriwwen.",
        "recentchangeslinked-page": "Säitennumm:",
        "recentchangeslinked-to": "Weis Ännerungen zu de verlinkte Säiten aplaz vun der gefroter Säit",
        "recentchanges-page-added-to-category": "[[:$1]] an d'Kategorie derbäigesat",
index a29f1ad..8ec2530 100644 (file)
@@ -36,7 +36,8 @@
                        "Zygimantus",
                        "Matma Rex",
                        "Nemo bis",
-                       "Nersip"
+                       "Nersip",
+                       "Manvydasz"
                ]
        },
        "tog-underline": "Nuorodos pabraukimas:",
        "nosuchusershort": "Nėra jokio naudotojo, pavadinto „$1“. Patikrinkite rašybą.",
        "nouserspecified": "Jums reikia nurodyti naudotojo vardą.",
        "login-userblocked": "Šis naudotojas yra užblokuotas. Prisijungti neleidžiama.",
-       "wrongpassword": "Įvestas neteisingas slaptažodis. Pamėginkite dar kartą.",
+       "wrongpassword": "Įvestas neteisingas vartotojo vardas ar slaptažodis. Pamėginkite dar kartą.",
        "wrongpasswordempty": "Įvestas slaptažodis yra tuščias. Pamėginkite vėl.",
        "passwordtooshort": "Slaptažodžiai turi būti bent $1 {{PLURAL:$1|simbolio|simbolių|simbolių}} ilgio.",
        "passwordtoolong": "Slaptažodžiai negali būti ilgesni nei {{PLURAL:$1|1 simbolis|$1 simboliai}}.",
        "prefs-help-recentchangescount": "Į tai įeina naujausi keitimai, puslapių istorijos ir specialiųjų veiksmų sąrašai.",
        "prefs-help-watchlist-token2": "Tai yra slaptas jūsų stebimųjų sąrašo raktas, skirtas žiniatinkliui.\nKiekvienas, kurį jį žino, gali skaityti jūsų stebimųjų puslapių sąrašą, taigi, juo nesidalinkite.\nJei reikia jį anuliuoti, [[Special:ResetTokens|spauskite čia]].",
        "savedprefs": "Nustatymai sėkmingai išsaugoti.",
-       "savedrights": "Naudotojo teisės {{GENDER:$1|$1}} buvo išsaugotos.",
+       "savedrights": "Naudotojo {{GENDER:$1|$1}} grupės buvo išsaugotos.",
        "timezonelegend": "Laiko juosta:",
        "localtime": "Vietinis laikas:",
        "timezoneuseserverdefault": "Naudoti wiki pradinį ($1)",
        "timezoneregion-indian": "Indijos vandenynas",
        "timezoneregion-pacific": "Ramusis vandenynas",
        "allowemail": "Leisti kitiems naudotojams siųsti man el. laiškus",
+       "email-allow-new-users-label": "Leidžia el. laiškus iš naujų vartotojų",
        "email-blacklist-label": "Neleisti šiems vartotojams siųsti man el. laiškų:",
        "prefs-searchoptions": "Paieška",
        "prefs-namespaces": "Vardų sritys",
        "action-deletedhistory": "žiūrėti puslapio ištrintą istoriją",
        "action-browsearchive": "ieškoti ištrintų puslapių",
        "action-undelete": "atkurti puslapius",
-       "action-suppressrevision": "peržiūrėti ir atkurti šią paslėptą versiją",
+       "action-suppressrevision": "peržiūrėti ir atkurti paslėptas versijas",
        "action-suppressionlog": "peržiūrėti šį privatų registrą",
        "action-block": "neleisti šiam naudotojui redaguoti",
        "action-protect": "pakeisti apsaugos lygius šiam puslapiui",
        "rcfilters-activefilters": "Aktyvūs filtrai",
        "rcfilters-advancedfilters": "Detalūs filtrai",
        "rcfilters-quickfilters": "Išsaugoti filtrai",
-       "rcfilters-quickfilters-placeholder-title": "Nėra išsaugotų nuorodų",
+       "rcfilters-quickfilters-placeholder-title": "Nėra išsaugotų filtrų",
        "rcfilters-savedqueries-defaultlabel": "Išsaugoti filtrai",
        "rcfilters-savedqueries-rename": "Pervadinti",
        "rcfilters-savedqueries-setdefault": "Nustatyti kaip numatytą",
        "rcfilters-savedqueries-remove": "Pašalinti",
        "rcfilters-savedqueries-new-name-label": "Pavadinimas",
        "rcfilters-savedqueries-new-name-placeholder": "Apibūdinkite šio filtro tikslą.",
-       "rcfilters-savedqueries-apply-label": "Išsaugoti nustatymus",
+       "rcfilters-savedqueries-apply-label": "Sukurti filtrą",
        "rcfilters-savedqueries-cancel-label": "Atšaukti",
        "rcfilters-savedqueries-add-new-title": "Išsaugoti dabartinius filtro nustatymus",
        "rcfilters-restore-default-filters": "Atstatyti numatytuosius filtrus",
        "rcfilters-invalid-filter": "Negalimas filtras",
        "rcfilters-empty-filter": "Nėra aktyvių filtrų. Rodomi visi indeliai.",
        "rcfilters-filterlist-title": "Filtrai",
-       "rcfilters-filterlist-whatsthis": "Kas tai?",
-       "rcfilters-filterlist-feedbacklink": "Pateikite atsiliepimą apie naujus (beta) filtrus",
+       "rcfilters-filterlist-whatsthis": "Kaip tai veikia?",
+       "rcfilters-filterlist-feedbacklink": "Pateikite atsiliepimą apie šiuos (naujus) filtravimo įrankius",
        "rcfilters-highlightbutton-title": "Paryškinti rezultatus",
        "rcfilters-highlightmenu-title": "Pasirinkite spalvą",
        "rcfilters-highlightmenu-help": "Pasirinkite spalvą šio elemento paryškinimui",
        "rcfilters-filter-editsbyother-description": "Visi keitimai, išskyrus jūsų.",
        "rcfilters-filtergroup-userExpLevel": "Patirties lygis (tik registruotiems vartotojams)",
        "rcfilters-filter-user-experience-level-registered-label": "Registruoti",
-       "rcfilters-filter-user-experience-level-registered-description": "Prisijungę redaktoriai.",
+       "rcfilters-filter-user-experience-level-registered-description": "Prisijungę naudotojai.",
        "rcfilters-filter-user-experience-level-unregistered-label": "Neregistruoti",
-       "rcfilters-filter-user-experience-level-unregistered-description": "Redaktoriai, kurie nėra prisijungę.",
+       "rcfilters-filter-user-experience-level-unregistered-description": "Naudotojai, kurie nėra prisijungę.",
        "rcfilters-filter-user-experience-level-newcomer-label": "Naujokai",
        "rcfilters-filter-user-experience-level-newcomer-description": "Mažiau nei 10 keitimų ir 4 dienų aktyvumo.",
        "rcfilters-filter-user-experience-level-learner-label": "Mokiniai",
        "rcfilters-filter-humans-label": "Žmogaus (ne roboto)",
        "rcfilters-filter-humans-description": "Keitimai atlikti žmonių.",
        "rcfilters-filtergroup-reviewstatus": "Peržiūrėti statusą",
+       "rcfilters-filter-patrolled-label": "Stebimas",
+       "rcfilters-filter-patrolled-description": "Pakeitimai pažymėti kaip stebimi.",
+       "rcfilters-filter-unpatrolled-label": "Nestebimas",
+       "rcfilters-filter-unpatrolled-description": "Pakeitimai pažymėti kaip nestebimi.",
        "rcfilters-filtergroup-significance": "Reikšmė",
        "rcfilters-filter-minor-label": "Smulkūs pakeitimai",
        "rcfilters-filter-minor-description": "Keitimai, kuriuos autorius pažymėjo kaip mažus.",
        "rcfilters-filter-watchlist-watched-description": "Pakeitimai puslapiuose, jūsų Stebimųjų sąraše.",
        "rcfilters-filter-watchlist-watchednew-label": "Nauji Stebimųjų sąrašo pakeitimai",
        "rcfilters-filter-watchlist-notwatched-label": "Nėra Stebimųjų sąraše",
+       "rcfilters-filter-watchlistactivity-unseen-label": "Neperžiūrėti pakeitimai",
+       "rcfilters-filter-watchlistactivity-seen-label": "Peržiūrėti pakeitimai",
        "rcfilters-filtergroup-changetype": "Pakeitimo tipas",
        "rcfilters-filter-pageedits-label": "Puslapių keitimai",
        "rcfilters-filter-newpages-label": "Puslapių sukūrimai",
        "rcfilters-filter-previousrevision-description": "Visi keitimai, kurie nėra naujausi puslapio keitimai.",
        "rcfilters-view-tags": "Pažymėti keitimai",
        "rcfilters-view-tags-help-icon-tooltip": "Sužinoti daugiau apie Pažymėtus pakeitimus",
+       "rcfilters-liveupdates-button": "Gyvi atnaujinimai",
+       "rcfilters-liveupdates-button-title-on": "Išjungti gyvus atnaujinimus",
+       "rcfilters-watchlist-markseen-button": "Pažymėti visus pakeitimus kaip peržiūrėtus",
+       "rcfilters-watchlist-edit-watchlist-button": "Redaguoti stebimųjų sąrašą",
+       "rcfilters-watchlist-showupdated": "Puslapiai pakeisti nuo tada, kai paskutinį kartą apsilankėte juose, yra <strong>paryškinti</strong>.",
+       "rcfilters-preference-label": "Slėpti patobulintą naujausių pakeitimų versiją",
+       "rcfilters-filter-showlinkedfrom-label": "Rodyti pakeitimus puslapiuose, iš kurių esate nukreipti",
+       "rcfilters-target-page-placeholder": "Įveskite puslapio pavadinimą",
        "rcnotefrom": "Žemiau yra {{PLURAL:$5|pakeitimas|pakeitimai}} pradedant <strong>$3, $4</strong> (rodoma iki <strong>$1</strong> pakeitimų).",
        "rclistfromreset": "Nustatyti duomenų pasirinkimą iš naujo",
        "rclistfrom": "Rodyti naujus pakeitimus pradedant $3 $2",
        "listfiles_size": "Dydis",
        "listfiles_description": "Aprašymas",
        "listfiles_count": "Versijos",
-       "listfiles-show-all": "Įtraukti senesnes paveikslėlių versijas",
+       "listfiles-show-all": "Įtraukti senesnes rinkmenų versijas",
        "listfiles-latestversion": "Dabartinė versija",
        "listfiles-latestversion-yes": "Taip",
        "listfiles-latestversion-no": "Ne",
        "enotif_lastdiff": "Užeikite į $1, jei norite pamatyti šį pakeitimą.",
        "enotif_anon_editor": "anoniminis naudotojas $1",
        "enotif_body": "$WATCHINGUSERNAME,\n\n\n$PAGEEDITDATE {{SITENAME}} projekte $PAGEEDITOR $CHANGEDORCREATED puslapį „$PAGETITLE“, dabartinę versiją rasite adresu $PAGETITLE_URL.\n\n$NEWPAGE\n\nRedaguotojo komentaras: $PAGESUMMARY $PAGEMINOREDIT\n\nSusisiekti su redaguotoju:\nel. paštu: $PAGEEDITOR_EMAIL\nwiki: $PAGEEDITOR_WIKI\n\nDaugiau pranešimų apie vėlesnius pakeitimus nebus siunčiama, jei neapsilankysite puslapyje.\nJūs taip pat galite išjungti pranešimo žymę visiems jūsų stebimiems puslapiams savo stebimųjų sąraše.\n\n Jūsų draugiškoji projekto {{SITENAME}} pranešimų sistema\n\n--\nNorėdami pakeisti e-paštu siunčiamų pranešimų nustatymus, užeikite į\n{{canonicalurl:{{#special:Preferences}}}}\n\nNorėdami pakeisti stebimųjų puslapių nustatymus, užeikite į\n{{canonicalurl:{{#special:EditWatchlist}}}}\n\nNorėdami puslapį iš stebimųjų puslapių sąrašo, užeikite į\n$UNWATCHURL\n\nAtsiliepimai ir pagalba:\n$HELPPAGE",
+       "enotif_minoredit": "Tai smulkus pakeitimas",
        "created": "sukurė",
        "changed": "pakeitė",
        "deletepage": "Trinti puslapį",
        "anonymous": "{{SITENAME}} {{PLURAL:$1|anoniminis naudotojas|anoniminiai naudotojai}}",
        "siteuser": "{{SITENAME}} {{GENDER:$2|naudotojas|naudotoja}} $1",
        "anonuser": "{{SITENAME}} anoniminis naudotojas $1",
-       "lastmodifiedatby": "Šį puslapį paskutinį kartą redagavo $3 $2, $1.",
+       "lastmodifiedatby": "Šį puslapį paskutinį kartą redagavo $2, $1, $3.",
        "othercontribs": "Paremta $1 darbu.",
        "others": "kiti",
        "siteusers": "{{SITENAME}} {{PLURAL:$2|naudotojas|naudotojai}} $1",
        "compare-invalid-title": "Jūsų nurodytas pavadinimas neleistinas.",
        "compare-title-not-exists": "Pavadinimas, kurį nurodėte, neegzistuoja.",
        "compare-revision-not-exists": "Keitimas, kurį nurodėte, neegzistuoja.",
-       "diff-form": "'''forma'''",
+       "diff-form": "Skirtumai",
        "dberr-problems": "Atsiprašome! Svetainei iškilo techninių problemų.",
        "dberr-again": "Palaukite kelias minutes ir perkraukite puslapį.",
        "dberr-info": "(Nepavyksta pasiekti duomenų bazės: $1)",
index e106cb0..bda6a87 100644 (file)
        "rcfilters-group-results-by-page": "Grupēt rezultātus pēc lapas",
        "rcfilters-activefilters": "Aktīvie filtri",
        "rcfilters-advancedfilters": "Paplašinātie filtri",
-       "rcfilters-limit-title": "Rādāmās izmaiņas",
+       "rcfilters-limit-title": "Rādāmie rezultāti",
        "rcfilters-limit-and-date-label": "{{PLURAL:$1|$1 izmaiņas|$1 izmaiņa|$1 izmaiņas}}, $2",
        "rcfilters-days-title": "Pēdējās dienas",
        "rcfilters-hours-title": "Pēdējās stundas",
        "enotif_reset": "Atzīmēt visas lapas kā apskatītas",
        "enotif_impersonal_salutation": "{{SITENAME}} lietotājs",
        "enotif_lastvisited": "$1 lai apskatītos visas izmaiņas kopš tava pēdējā apmeklējuma.",
-       "enotif_lastdiff": "$1 lai apskatītos šo izmaiņu.",
+       "enotif_lastdiff": "Lai apskatītu šo izmaiņu, skatīt $1",
        "enotif_anon_editor": "anonīms dalībnieks $1",
        "enotif_body": "$WATCHINGUSERNAME,\n\n\n{{grammar:ģenitīvs|{{SITENAME}}}} lapu $PAGETITLE $CHANGEDORCREATED $PAGEEDITOR, $PAGEEDITDATE, pašreizējā versja ir $PAGETITLE_URL.\n\n$NEWPAGE\n\nIzmaiņu kopsavilkums bija: $PAGESUMMARY $PAGEMINOREDIT\n\nSazināties ar attiecīgo lietotāju:\ne-pasts: $PAGEEDITOR_EMAIL\nwiki: $PAGEEDITOR_WIKI\n\nJa šo uzraugāmo lapu izmainīs vēl, turpmāku paziņojumu par to nebūs, kamēr tu to neatvērsi.\nTu arī vari atstatīt visu uzraugāmo lapu paziņojumu statusus uzraugāmo lapu sarakstā.\n\n             {{grammar:ģenitīvs|{{SITENAME}}}} paziņojumu sistēma\n\n--\nLai izmainītu uzraugāmo lapu saraksta uzstādījumus:\n{{canonicalurl:{{#special:EditWatchlist}}}}\n\nLai dzēstu lapu no uzraugāmo lapu saraksta:\n$UNWATCHURL\n\nPapildinformācija:\n$HELPPAGE",
        "enotif_minoredit": "Šis ir maznozīmīgs labojums",
        "year": "No gada (un senāki):",
        "sp-contributions-newbies": "Rādīt jauno lietotāju devumu",
        "sp-contributions-newbies-sub": "Jaunie lietotāji",
+       "sp-contributions-newbies-title": "Jauno dalībnieku devums",
        "sp-contributions-blocklog": "bloķēšanas reģistrs",
        "sp-contributions-suppresslog": "cenzēja {{GENDER:$1|dalībnieka|dalībnieces}} devumu",
        "sp-contributions-deleted": "dzēstais {{GENDER:$1|dalībnieka|dalībnieces}} devums",
        "ipb_blocked_as_range": "Kļūda: IP $1 nav bloķēta tieši, tāpēc to nevar atbloķēt.\nTā ir bloķēta kā daļa no IP adrešu diapazona $2, kuru var atbloķēt.",
        "ip_range_invalid": "Nederīgs IP diapazons",
        "proxyblocker": "Starpniekservera bloķētājs",
+       "softblockrangesreason": "No tavas IP adreses ($1) nav atļauts anonīms devums. Lūdzu, pieslēdzies.",
        "ipbblocked": "Tu nevar bloķēt vai atbloķēt lietotājus, jo Tu pats esi bloķēts",
        "ipbnounblockself": "Tev nav atļauts sevi atbloķēt",
        "lockdb": "Bloķēt datubāzi",
        "newimages-legend": "Filtrs",
        "newimages-label": "Faila nosaukums (vai tā daļa):",
        "newimages-user": "IP adrese vai lietotājvārds",
+       "newimages-newbies": "Rādīt tikai jaunu dalībnieku devumu",
        "newimages-showbots": "Parādīt botu augšupielādētos failus",
        "newimages-hidepatrolled": "Paslēpt pārbaudītās augšupielādes",
        "noimages": "Nav nekā ko redzēt.",
        "feedback-useragent": "Lietotāja aģents:",
        "searchsuggest-search": "Meklēt {{SITENAME}}",
        "searchsuggest-containing": "Meklējamā frāze:",
-       "api-error-unknown-warning": "Nezināms brīdinājums: $1",
+       "api-error-unknown-warning": "Nezināms brīdinājums: \"$1\".",
        "api-error-unknownerror": "Nezināma kļūda: \"$1\"",
        "duration-seconds": "$1 {{PLURAL:$1|sekundes|sekunde|sekundes}}",
        "duration-minutes": "$1 {{PLURAL:$1|minūtes|minūte|minūtes}}",
index ae28e8d..d835015 100644 (file)
        "timezoneregion-indian": "Индиски Океан",
        "timezoneregion-pacific": "Тихи Океан",
        "allowemail": "Дозволи е-пошта од други корисници",
+       "email-allow-new-users-label": "Дозволи е-пошта од сосем нови корисници",
        "email-blacklist-label": "Забрани е-пошта од следниве корисници:",
        "prefs-searchoptions": "Пребарување",
        "prefs-namespaces": "Именски простори",
index e944f1b..32788be 100644 (file)
        "nosuchusershort": "\"$1\" या नावाचा सदस्य नाही. लिहीताना आपली चूक तर नाही ना झाली?",
        "nouserspecified": "तुम्हाला सदस्यनाव नमूद करावे लागेल.",
        "login-userblocked": "हा सदस्य ’प्रतिबंधित’ आहे. त्यास सनोंद-प्रवेशाची परवानगी नाही.",
-       "wrongpassword": "à¤\86पण à¤ªà¤°à¤µà¤²à¥\80à¤\9aा à¤¶à¤¬à¥\8dद à¤\9aà¥\81à¤\95à¥\80à¤\9aा à¤\9fाà¤\95ला à¤\86हà¥\87, पुन्हा एकदा प्रयत्न करा.",
+       "wrongpassword": "सदसà¥\8dयनाव à¤\85थवा à¤ªà¤°à¤µà¤²à¥\80à¤\9aा à¤¶à¤¬à¥\8dद à¤\9aà¥\81à¤\95à¥\80à¤\9aा à¤\9fाà¤\95णà¥\8dयात à¤\86ला à¤\86हà¥\87. पुन्हा एकदा प्रयत्न करा.",
        "wrongpasswordempty": "परवलीचा शब्द कोरा आहे; पुन्हा प्रयत्न करा.",
        "passwordtooshort": "तुमच्या परवलीच्या शब्दात किमान {{PLURAL:$1|१ अक्षर |$1 अक्षरे}} हवीत.",
        "passwordtoolong": "परवलीचा शब्द हा {{PLURAL:$1|१ वर्ण पेक्षा|$1 वर्णांपेक्षा}} लांबीचा नको.",
        "anonpreviewwarning": "\"'''सावधान:''' तुम्ही विकिपीडियाचे सदस्य म्हणून सनोंद-प्रवेश (लॉग-इन) केलेला नाही. या पानाच्या संपादन इतिहासात तुमचा अंकपत्ता (आय.पी. अॅड्रेस) नोंदला जाईल.\"",
        "missingsummary": "'''आठवण:''' आपण संपादन सारांश पुरवलेला नाही.आपण 'जतन करा' वर पुन्हा टिचकी मारली तर, ते त्याशिवायच जतन होईल.",
        "selfredirect": "<strong>ईशारा:</strong>आपण या पानास, त्याच पानावर पुनर्निर्देशित करीता आहात.\nआपण पुनर्निर्देशनासाठी चूकिचे लक्ष्य नमूद केले आहे किंवा आपण चूकिच्या पानाचे संपादन करीत आहात.\nजर आपण पुन्हा \"$1\" टिचकले तर, कसेहीकरुन ते पुनर्निर्देशन तयार होईल.",
-       "missingcommenttext": "à¤\95à¥\83पया à¤\96ालà¥\80 à¤ªà¥\8dरतिà¤\95à¥\8dरिया à¤­à¤°ा.",
+       "missingcommenttext": "à¤\95à¥\83पया à¤ªà¥\8dरतिà¤\95à¥\8dरिया à¤\9fाà¤\95ा.",
        "missingcommentheader": "<strong>आठवण:<strong> आपण या लेखनाकरिता विषय दिलेला नाही. आपण पुन्हा \"$1\" वर टिचकले तर, तुमचे संपादन त्याशिवायच जतन होईल.",
-       "summary-preview": "à¤\86ढावà¥\8dयाची झलक:",
-       "subject-preview": "विषय झलक:",
+       "summary-preview": "सà¤\82पादन à¤¸à¤¾à¤°à¤¾à¤\82शाची झलक:",
+       "subject-preview": "विषयाची झलक:",
        "previewerrortext": "आपल्या बदलांची झलक बघण्याचे प्रयत्नादरम्यान त्रुटी उद्भवली.",
        "blockedtitle": "हा सदस्य प्रतिबंधित आहे",
        "blockedtext": "'''तुमचे सदस्यनाव अथवा IP पत्ता ब्लॉक केलेला आहे.'''\n\nहा ब्लॉक $1 यांनी केलेला आहे.\nयासाठी ''$2'' हे कारण दिलेले आहे.\n\n* ब्लॉकची सुरूवात: $8\n* ब्लॉकचा शेवट: $6\n* कुणाला ब्लॉक करायचे आहे: $7\n\nतुम्ही ह्या ब्लॉक संदर्भातील चर्चेसाठी $1 अथवा [[{{MediaWiki:Grouppage-sysop}}|प्रबंधकांशी]] संपर्क करू शकता.\nतुम्ही जोवर वैध ई-मेल पत्ता आपल्या [[Special:Preferences|'माझ्या पसंती']] पानावर देत नाही तोवर तुम्ही ’सदस्याला ई-मेल पाठवा’ हा दुवा वापरू शकत नाही. तसेच असे करण्यापासून आपल्याला ब्लॉक केलेले नाही.\nतुमचा सध्याचा IP पत्ता $3 हा आहे, व तुमचा ब्लॉक क्रमांक #$5 हा आहे.\nकृपया या संदर्भातील चर्चेमध्ये वरील सर्व तपशिल उद्घृत करा.",
        "page_first": "प्रथम",
        "page_last": "अंतिम",
        "histlegend": "फरक निवडणे: जुन्या आवृत्तींमधील फरक पाहण्यासाठी रेडियो बॉक्स मध्ये खूण करा व एन्टर कळ दाबा अथवा खाली दिलेल्या कळीवर टिचकी द्या.<br />\nविवरण: '''({{int:cur}})''' = चालू आवृत्तीशी फरक,\n(मागील) = पूर्वीच्या आवृत्तीशी फरक, छो = किरकोळ संपादन",
-       "history-fieldset-title": "à¤\87तिहास à¤µà¤¿à¤\82à¤\9aरण à¤\95रा",
-       "history-show-deleted": "फà¤\95à¥\8dत à¤\95ाढà¥\82न à¤\9fाà¤\95लà¥\87लà¥\87",
+       "history-fieldset-title": "à¤\86वà¥\83तà¥\8dतà¥\8dयाà¤\82साठà¥\80 à¤¶à¥\8bधा",
+       "history-show-deleted": "फà¤\95à¥\8dत à¤µà¤\97ळलà¥\87लà¥\8dया à¤\86वà¥\83तà¥\8dतà¥\8dया",
        "histfirst": "सर्वात प्राचिन",
        "histlast": "नविनतम",
        "historysize": "({{PLURAL:$1|1 बाइट|$1 बाइट्स}})",
        "revdelete-unsuppress": "पुर्नस्थापीत आवृत्त्यांवरील बंधने ऊठवा",
        "revdelete-log": "कारण:",
        "revdelete-submit": "निवडलेल्या {{PLURAL:$1|आवृत्तीला|आवृत्त्यांना}} लागू करा",
-       "revdelete-success": "'''आवृत्त्यांची  दृश्यता यशस्वीपणे अद्ययावत केली.'''",
+       "revdelete-success": "आवृत्त्यांची दृश्यता अद्ययावत केली.",
        "revdelete-failure": "'''आवर्तन दृश्यता अद्ययावत करता येत नाही:'''\n$1",
-       "logdelete-success": "'''नोंदींची दृश्यता यशस्वी पणे स्थापिली.'''",
+       "logdelete-success": "नोंदींची दृश्यता स्थापिली.",
        "logdelete-failure": "'''नोंदींची दृश्यता स्थापिल्या गेली नाही.'''\n$1",
        "revdel-restore": "दृश्यता बदला",
        "pagehist": "पानाचा इतिहास",
        "mergehistory-empty": "कोणतेही आवर्तन एकत्रित करता येत नाही.",
        "mergehistory-done": "$1 {{PLURAL:$3|चे|ची}} $3 {{PLURAL:$3|आवर्तन|आवर्तने}} [[:$2]] मध्ये यशस्वीरीत्या एकत्रित केली.",
        "mergehistory-fail": "इतिहासाचे एकत्रीकरण कार्य करू शकत नाही आहे, कृपया पान आणि वेळ प्राचलांची पुनर्तपासणी करा.",
+       "mergehistory-fail-bad-timestamp": "वेळठसा अवैध आहे.",
+       "mergehistory-fail-invalid-source": "स्रोत पान अवैध आहे.",
+       "mergehistory-fail-invalid-dest": "लक्ष्य पान अवैध आहे.",
        "mergehistory-fail-toobig": "इतिहास एकत्रिकरण करणे शक्य झाले नाही कारण $1 मर्यादेपेक्षा अधिक {{PLURAL:$1|आवृत्ती|आवृत्त्या}} स्थानांतरीत केल्या जातील.",
        "mergehistory-no-source": "स्रोत पान $1 अस्तित्वात नाही.",
        "mergehistory-no-destination": "लक्ष्य पान $1  अस्तित्वात नाही.",
        "search-file-match": "(संचिका आशयाशी अनुरुपते)",
        "search-suggest": "तुम्हाला हेच म्हणायचे का: $1",
        "search-rewritten": "$1 साठीचे निकाल दाखवित आहे.त्याऐवजी $2 चा शोध घ्या.",
-       "search-interwiki-caption": "सह प्रकल्प",
+       "search-interwiki-caption": "सह-प्रकल्पांपासून प्राप्त निकाल",
        "search-interwiki-default": "$1चे निकाल:",
        "search-interwiki-more": "(आणखी)",
+       "search-interwiki-more-results": "अधिक निकाल",
        "search-relatedarticle": "जवळील",
        "searchrelated": "संबंधित",
        "searchall": "सर्व",
        "prefs-help-prefershttps": "हा पसंतीक्रम आपल्या पुढील सनोंद प्रवेशानंतर कार्यान्वित होईल.",
        "prefswarning-warning": "आपण आपल्या पसंतीक्रमात केलेला बदल अद्याप जतन झाला नाही.जर आपण \"$1\" न टिचकता, या पानावरुन दुसरीकडे गेलात तर आपला पसंतीक्रम अद्यतन होणार नाही.",
        "prefs-tabs-navigation-hint": "उपयुक्त सूचना:आपण कळींच्या यादीत, कळींदरम्यानच्या सुचालनास डावी व उजवी बाण-कळ वापरु शकता.",
-       "userrights": "सदस्य अधिकार व्यवस्थापन",
-       "userrights-lookup-user": "सदस्य गटांचे(ग्रूप्स) व्यवस्थापन करा.",
+       "userrights": "सदस्य अधिकार",
+       "userrights-lookup-user": "सदस्याची निवड करा",
        "userrights-user-editname": "सदस्य नाव टाका:",
-       "editusergroup": "सदस्याचे गट संपादित करा",
+       "editusergroup": "सदस्य गटांचे भारण करा",
        "editinguser": "या {{GENDER:$1|सदस्या}}चे सदस्य-अधिकारात बदल केला जात आहे<strong>[[User:$1|$1]]</strong> $2",
        "userrights-editusergroup": "{{GENDER:$1|सदस्य}} गट संपादित करा",
-       "saveusergroups": "सदस्य गट जतन करा",
+       "saveusergroups": "{{GENDER:$1|सदस्य}} गट जतन करा",
        "userrights-groupsmember": "याचा सभासद:",
        "userrights-groupsmember-auto": "याचा अव्यक्त सदस्य:",
        "userrights-groups-help": "तुम्ही एखाद्या सदस्याचे गट सदस्यत्व बदलू शकता:\n* निवडलेला चौकोन म्हणजे सदस्य त्या गटात आहे.\n* न निवडलेला चौकोन म्हणजे सदस्य त्या गटात नाही.\n* एक * चा अर्थ तुम्ही एकदा समावेश केल्यानंतर तो गट बदलू शकत नाही, किंवा काढल्यानंतर समावेश करू शकत नाही.",
        "rcfilters-group-results-by-page": "पानानुसार गट निकाल",
        "rcfilters-activefilters": "सक्रिय गाळण्या",
        "rcfilters-advancedfilters": "प्रगत गाळण्या",
-       "rcfilters-limit-title": "दाखविण्यासाठीचे बदल",
+       "rcfilters-limit-title": "दाखविण्यासाठीचे निकाल",
+       "rcfilters-limit-and-date-label": "{{PLURAL:$1|बदल}}, $2",
+       "rcfilters-date-popup-title": "शोधावयाचा कालावधी",
        "rcfilters-days-title": "अलीकडील दिवस",
        "rcfilters-hours-title": "अलीकडील तास",
        "rcfilters-days-show-days": "$1 {{PLURAL:$1|दिवस}}",
        "rcfilters-savedqueries-apply-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": "à¤\85लà¥\80à¤\95डà¥\80ल à¤¬à¤¦à¤² à¤\97ाळा (नà¥\8dयाहाळा à¤\95िà¤\82वा à¤\9fà¤\82à¤\95न à¤¸à¥\81रà¥\82 à¤\95रा)",
+       "rcfilters-search-placeholder": "बदल à¤\97ाळा (à¤\97ाळणà¥\8dयाà¤\82à¤\9aà¥\8dया à¤¨à¤¾à¤µà¤¾à¤¸à¤¾à¤ à¥\80 à¤®à¥\87नà¥\8dयà¥\82 à¤\85थवा à¤¶à¥\8bध à¤µà¤¾à¤ªरा)",
        "rcfilters-invalid-filter": "अवैध गाळणी",
        "rcfilters-empty-filter": "कोणत्याच गाळण्या सक्रिय नाहीत. सर्व योगदाने दाखविण्यात येत आहेत.",
        "rcfilters-filterlist-title": "गाळण्या",
+       "rcfilters-filterlist-whatsthis": "हे कसे काम करते?",
        "rcfilters-filterlist-feedbacklink": "या (नवीन) गाळणी साधनांबद्दल आपले काय म्हणणे/विचार आहेत ते आम्हास सांगा",
        "rcfilters-highlightbutton-title": "निकालांवर झोत टाका",
        "rcfilters-highlightmenu-help": "या गुणधर्मासाठी झोताचा रंग निवडा",
        "rcfilters-filterlist-noresults": "कोणतीच गाळणी सापडली नाही",
        "rcfilters-filtergroup-authorship": "योगदानांचे लेखक",
-       "rcfilters-filter-editsbyself-label": "à¤\86पलà¥\80 à¤¸à¥\8dवत:à¤\9aà¥\80 à¤¸à¤\82पादनà¥\87",
+       "rcfilters-filter-editsbyself-label": "à¤\86पलà¥\87 à¤¸à¥\8dवतà¤\83à¤\9aà¥\87 à¤¬à¤¦à¤²",
        "rcfilters-filter-editsbyself-description": "आपली संपादने",
-       "rcfilters-filter-editsbyother-label": "à¤\87तराà¤\82à¤\9aà¥\80 à¤¸à¤\82पादनà¥\87",
+       "rcfilters-filter-editsbyother-label": "à¤\87तराà¤\82à¤\9aà¥\87 à¤¬à¤¦à¤²",
        "rcfilters-filter-editsbyother-description": "इतर सदस्यांनी तयार केलेली संपादने (आपण नाही).",
        "rcfilters-filtergroup-userExpLevel": "अनुभवाचा स्तर (फक्त नोंदणीकृत सदस्यांसाठीच)",
        "rcfilters-filter-user-experience-level-registered-label": "नोंदणीकृत",
-       "rcfilters-filter-user-experience-level-registered-description": "पà¥\8dरवà¥\87शलà¥\87लà¥\87 à¤¸à¤¦à¤¸à¥\8dय",
+       "rcfilters-filter-user-experience-level-registered-description": "पà¥\8dरवà¥\87शलà¥\87लà¥\87 à¤¸à¤\82पादà¤\95.",
        "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": "१० संपादनांपेक्षा कमी व ४ दिवसांची सक्रियता असणारे नोंदणीकृत सदस्य.",
+       "rcfilters-filter-user-experience-level-newcomer-description": "१० à¤¸à¤\82पादनाà¤\82पà¥\87à¤\95à¥\8dषा à¤\95मà¥\80 à¤¸à¤\82पादनà¥\87 à¤\95à¥\87लà¥\87लà¥\87 à¤µ à¥ª à¤¦à¤¿à¤µà¤¸à¤¾à¤\82à¤\9aà¥\80 à¤¸à¤\95à¥\8dरियता à¤\85सणारà¥\87 à¤¨à¥\8bà¤\82दणà¥\80à¤\95à¥\83त à¤¸à¤¦à¤¸à¥\8dय.",
        "rcfilters-filter-user-experience-level-learner-label": "शिकाऊ",
        "rcfilters-filter-user-experience-level-learner-description": "\"शिकाऊ\" व \"नोंदणीकृत संपादक\" या दरम्यानचा अनुभव असणारे संपादक",
        "rcfilters-filter-user-experience-level-experienced-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-notwatched-label": "निरीक्षणसूचीत नसलेली",
        "rcfilters-filter-watchlist-notwatched-description": "आपल्या निरीक्षणसूचीतील बदलांशिवाय इतर सर्वकाही.",
+       "rcfilters-filter-watchlistactivity-unseen-label": "न-बघितलेले बदल",
+       "rcfilters-filter-watchlistactivity-seen-label": "बघितलेले बदल",
        "rcfilters-filtergroup-changetype": "बदलाचा प्रकार",
        "rcfilters-filter-pageedits-label": "पृष्ठ संपादने",
        "rcfilters-filter-newpages-label": "नवीन पान-निर्माण",
        "rcfilters-view-namespaces-tooltip": "नामविश्वांनुसार गाळण्यांचे निकाल",
        "rcfilters-view-tags-tooltip": "संपादन खूण वापरुन गाळण्यांचे निकाल",
        "rcfilters-view-tags-help-icon-tooltip": "खूण केलेल्या संपादनांबाबत अधिक जाणून घ्या",
+       "rcfilters-liveupdates-button": "सजीव अद्यतने",
+       "rcfilters-liveupdates-button-title-on": "सजीव अद्यतने बंद करा",
        "rcnotefrom": "खाली {{PLURAL:$5|हा बदल आहे|हे बदल आहेत}} <strong>$3, $4</strong>पासून ते(<strong>$1</strong>पर्यंतचे  बदल दाखविले आहेत).",
        "rclistfrom": "$2,$3 पासून सुरुवात करुन, नविन केल्या गेलेले बदल दाखवा.",
        "rcshowhideminor": "छोटे बदल $1",
        "changecontentmodel-title-label": "लेखपान शीर्ष",
        "changecontentmodel-reason-label": "कारण:",
        "changecontentmodel-submit": "बदला",
+       "changecontentmodel-success-title": "आशय नमूना बदलल्या गेला",
        "log-name-contentmodel": "आशय नमूना बदल नोंदी",
        "logentry-contentmodel-change-revertlink": "उलटवा",
        "logentry-contentmodel-change-revert": "उलटवा",
        "pageinfo-length": "पानाचा आकार (बाइट्समध्ये)",
        "pageinfo-article-id": "पृष्ठ-ओळखण",
        "pageinfo-language": "पान-आशय भाषा",
+       "pageinfo-language-change": "बदल",
        "pageinfo-content-model": "पान-आशय नमूना",
        "pageinfo-content-model-change": "बदला",
        "pageinfo-robot-policy": "यंत्रमानवांद्वारे अनुक्रमण",
        "confirmemail_body_set": "{{SITENAME}} वर कुणीतरी, बहुतेक आपणच, $1 या अंकपत्त्यावरून, \"$2\" या  खात्याकरिताचा विपत्रपत्ता (ई-मेल), या पत्त्यास स्थापिलेला आहे.\n\nहे खाते खरोखर आपलेच आहे याची खात्री करण्यासाठी आणि {{SITENAME}} वर विपत्रपत्ता प्रारुप सक्रिय(उपलब्ध) करण्यासाठी, हा दुवा आपल्या न्याहाळकात(ब्राउजर) उघडा:\n\n$3\n\nजर हे खाते आपले *नसेल* तर, ही विपत्रपत्याचे निश्चितीकरण वगळण्यासाठी,खालील दुव्यास अनुसरा:\n\n$5\n\nहा निश्चितीकरण संकेत(कन्फर्मेशन कोड) $4 ला कालबाह्य होईल.",
        "confirmemail_invalidated": "इ-मेल पत्ता तपासणी रद्द करण्यात आलेली आहे",
        "invalidateemail": "इ-मेल तपासणी रद्द करा",
+       "notificationemail_subject_changed": "{{SITENAME}} वर नोंदविलेला विपत्रपत्ता बदलवल्या गेला",
        "scarytranscludedisabled": "[आंतरविकि आंतरन्यास अनुपलब्ध केले आहे]",
        "scarytranscludefailed": "[क्षमस्व;$1करिताची साचा ओढी फसली]",
        "scarytranscludetoolong": "[आंतरजालपत्ता खूप लांब आहे]",
        "tags-apply-blocked": "आपण प्रतिबंधित असतांना आपल्या बदलांसह, बदल खूणपताकांना  लागू करु शकत नाही.",
        "tags-update-blocked": "आपण प्रतिबंधित असतांना बदल खूणपताकांना जोडू अथवा हटवू शकत नाही.",
        "tags-edit-reason": "कारण:",
+       "tags-edit-success": "बदल लागू केल्या गेलेत.",
        "tags-edit-none-selected": "जोडण्यास किंवा हटविण्यास किमान एक खूणपताका निवडा.",
        "comparepages": "पानांची तुलना करा",
        "compare-page1": "पान १",
        "sessionprovider-nocookies": "कुकिज अक्षम असू शकतात. याची खात्री करा कि कुकिज सक्षम केल्या आहेत व पुन्हा सुरुवात करा.",
        "randomrootpage": "अविशिष्ट मूळ पान",
        "log-action-filter-contentmodel": "आशय नमूना बदलाचा प्रकार",
+       "log-action-filter-rights-rights": "मानवी बदल",
        "log-action-filter-suppress-block": "रोधामार्फत सदस्य दाबणे",
        "changecredentials": "अधिकारपत्रे (क्रेडेंटियल्स)बदला",
        "removecredentials": "अधिकारपत्रे (क्रेडेंटियल्स) हटवा"
index 35e35ee..5202c2e 100644 (file)
        "minoredit": "Din hija modifika minuri",
        "watchthis": "Segwi din il-paġna",
        "savearticle": "Salva l-paġna",
+       "publishpage": "Ippubblika l-paġna",
        "publishchanges": "Ippubblika l-modifiki",
        "preview": "Dehra proviżorja",
        "showpreview": "Dehra proviżorja",
index 5aa5b97..aa9636f 100644 (file)
        "timezoneregion-indian": "Indiahavet",
        "timezoneregion-pacific": "Stillehavet",
        "allowemail": "Tillat andre å sende meg e-post",
+       "email-allow-new-users-label": "Tillat e-poster fra helt nyregistrerte brukere",
        "email-blacklist-label": "Forhindre disse brukerne fra å sende meg e-post:",
        "prefs-searchoptions": "Søk",
        "prefs-namespaces": "Navnerom",
index cf9db33..b8d8b37 100644 (file)
        "tog-hidepatrolled": "Gemarkeerde wijzigingen verbergen in recente wijzigingen",
        "tog-newpageshidepatrolled": "Gemarkeerde pagina's verbergen in de lijst met nieuwe pagina's",
        "tog-hidecategorization": "Categorisatie van pagina's verbergen",
-       "tog-extendwatchlist": "Uitgebreide volglijst gebruiken om alle wijzigingen te bekijken, en niet alleen de laatste",
+       "tog-extendwatchlist": "Volglijst uitbreiden om alle wijzigingen te tonen, en niet alleen de recentste",
        "tog-usenewrc": "Wijzigingen per pagina weergeven in recente wijzigingen en volglijst",
        "tog-numberheadings": "Koppen automatisch nummeren",
        "tog-showtoolbar": "Bewerkingswerkbalk weergeven",
        "tog-editondblclick": "Dubbelklikken voor bewerken",
        "tog-editsectiononrightclick": "Bewerken van deelpagina’s mogelijk maken met een rechtermuisklik op een tussenkop",
-       "tog-watchcreations": "Pagina's die ik aanmaak en bestanden die ik upload automatisch volgen",
-       "tog-watchdefault": "Pagina’s en bestanden die ik bewerk automatisch volgen",
+       "tog-watchcreations": "Pagina's die ik aanmaak en bestanden die ik upload aan mijn volglijst toevoegen",
+       "tog-watchdefault": "Pagina’s en bestanden die ik bewerk aan mijn volglijst toevoegen",
        "tog-watchmoves": "Pagina’s en bestanden die ik hernoem automatisch volgen",
        "tog-watchdeletion": "Pagina’s en bestanden die ik verwijder automatisch volgen",
-       "tog-watchuploads": "Nieuwe bestanden die ik upload toevoegen aan mijn volglijst",
+       "tog-watchuploads": "Nieuwe bestanden die ik upload aan mijn volglijst toevoegen",
        "tog-watchrollback": "Pagina's waarop ik heb teruggedraaid automatisch volgen",
        "tog-minordefault": "Mijn bewerkingen standaard als kleine bewerking markeren",
        "tog-previewontop": "Voorvertoning boven bewerkingsveld weergeven",
        "tog-watchlisthidebots": "Botbewerkingen op mijn volglijst verbergen",
        "tog-watchlisthideminor": "Kleine bewerkingen op mijn volglijst verbergen",
        "tog-watchlisthideliu": "Bewerkingen van aangemelde gebruikers op mijn volglijst verbergen",
-       "tog-watchlistreloadautomatically": "Herlaad de volglijst automatisch wanneer er een filter is veranderd (JavaScript vereist)",
-       "tog-watchlistunwatchlinks": "Voeg volgen/niet volgen-links toe aan regels in de volglijst (JavaScript vereist voor deze functionaliteit)",
+       "tog-watchlistreloadautomatically": "De volglijst automatisch herladen wanneer er een filter wordt veranderd (JavaScript vereist)",
+       "tog-watchlistunwatchlinks": "Volgen/niet volgen-links toevoegen aan regels in de volglijst (JavaScript vereist voor schakelfunctionaliteit)",
        "tog-watchlisthideanons": "Bewerkingen van anonieme gebruikers op mijn volglijst verbergen",
        "tog-watchlisthidepatrolled": "Gemarkeerde wijzigingen op mijn volglijst verbergen",
        "tog-watchlisthidecategorization": "Categorisatie van pagina's verbergen",
        "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 account 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 vernemen.",
        "createacct-realname": "Echte naam (optioneel)",
        "createacct-reason": "Reden",
        "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-submit": "Uw account aanmaken",
        "createacct-another-submit": "Account aanmaken",
-       "createacct-continue-submit": "Doorgaan met het maken van een account",
-       "createacct-another-continue-submit": "Doorgaan met het maken van een account",
+       "createacct-continue-submit": "Doorgaan met het aanmaken van een account",
+       "createacct-another-continue-submit": "Doorgaan met het aanmaken van een account",
        "createacct-benefit-heading": "{{SITENAME}} wordt gemaakt door mensen zoals u.",
        "createacct-benefit-body1": "bewerking{{PLURAL:$1||en}}",
        "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 account met die naam is al bezig.\nEven geduld alstublieft.",
+       "usernameinprogress": "Het aanmaken van een account met die naam is al in behandeling.\nEven geduld alstublieft.",
        "userexists": "De gekozen gebruikersnaam is al in gebruik.\nKies een andere naam.",
        "loginerror": "Aanmeldfout",
        "createacct-error": "Fout tijdens aanmaken account",
        "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 hebben vanaf uw IP-adres de afgelopen $2 al {{PLURAL:$1|1 account|$1 accounts}} aangemaakt, wat het maximale toegestane aantal is voor deze periode.\nDaarom kunt u momenteel vanaf dit IP-adres geen nieuwe accounts aanmaken.",
+       "acct_creation_throttle_hit": "Bezoekers van deze wiki hebben vanaf uw IP-adres de afgelopen $2 al {{PLURAL:$1|een account|$1 accounts}} aangemaakt, wat het maximaal toegestane aantal is voor deze periode.\nDaarom kunt u momenteel vanaf dit IP-adres geen nieuwe accounts aanmaken.",
        "emailauthenticated": "Uw e-mailadres is bevestigd op $2 om $3.",
        "emailnotauthenticated": "Uw e-mailadres is niet bevestigd.\nDe volgende functies verzenden nog geen e-mail.",
        "noemailprefs": "Geef een e-mailadres op in uw voorkeuren om deze functies te gebruiken.",
        "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 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.",
+       "login-migrated-generic": "Uw account is hernoemd, en uw gebruikersnaam bestaat niet langer op deze wiki.",
        "loginlanguagelabel": "Taal: $1",
        "suspicious-userlogout": "Uw verzoek om af te melden is genegeerd, omdat het lijkt alsof het verzoek is verzonden door een browser of cacheproxy die stuk is.",
        "createacct-another-realname-tip": "Een echte naam is optioneel.\nAls u een naam opgeeft, wordt deze gebruikt ter erkenning voor diens werk.",
        "changepassword-success": "Uw wachtwoord is gewijzigd!",
        "changepassword-throttled": "U heeft recentelijk te veel mislukte aanmeldpogingen gedaan.\nWacht alstublieft $1 voordat u het opnieuw probeert.",
        "botpasswords": "Botwachtwoorden",
-       "botpasswords-summary": "<em>Botwachtwoorden</em> zorgen voor toegang tot de API via een gebruikersaccount zonder gebruik te maken van de aanmeldgegevens van dat account. De gebruikersrechten die beschikbaar zijn kunnen afwijken indien er aangemeld is met een botwachtwoord.\n\nAls u niet weet wat de gevolgen hiervan zijn, is het handiger om dit ook dan niet te doen. Niemand hoort u te vragen om een botwachtwoord aan te maken en deze vervolgens aan hem of haar te geven.",
+       "botpasswords-summary": "<em>Botwachtwoorden</em> zorgen voor toegang tot een gebruikersaccount via de API, zonder gebruik te maken van de aanmeldgegevens van dat account. De beschikbare gebruikersrechten zijn mogelijk beperkt wanneer er met een botwachtwoord is aangemeld.\n\nAls u niet weet waarom u een botwachtwoord zou willen aanmaken, is het raadzaam het niet te doen. Niemand hoort u te vragen om een botwachtwoord aan te maken en dit aan hem of haar te geven.",
        "botpasswords-disabled": "Botwachtwoorden zijn uitgeschakeld.",
-       "botpasswords-no-central-id": "Om botwachtwoorden te gebruiken, moet u ingelogd zijn met een gecentraliseerd account",
+       "botpasswords-no-central-id": "Om botwachtwoorden te gebruiken, moet u ingelogd zijn met een gecentraliseerd account.",
        "botpasswords-existing": "Bestaande botwachtwoorden",
        "botpasswords-createnew": "Een nieuw botwachtwoord aanmaken",
        "botpasswords-editexisting": "Een bestaand botwachtwoord bewerken",
        "botpasswords-label-delete": "Verwijderen",
        "botpasswords-label-resetpassword": "Het wachtwoord opnieuw instellen",
        "botpasswords-label-grants": "Van toepassing zijnde rechten:",
-       "botpasswords-help-grants": "Toestemmingen geven toegang tot gebruikersrechten die u al heeft. Het geven van een toestemming op deze plek geeft u geen toegang tot gebruikersrechten die u anders niet zou hebben. Zie het [[Special:ListGrants|overzicht van toestemmingen]] voor meer informatie.",
+       "botpasswords-help-grants": "Toestemmingen geven toegang tot rechten die uw gebruikersaccount al heeft. Het geven van een toestemming op deze plek geeft geen toegang tot rechten die uw gebruikersaccount anders niet zou hebben. Zie het [[Special:ListGrants|overzicht van toestemmingen]] voor meer informatie.",
        "botpasswords-label-grants-column": "Toegewezen",
        "botpasswords-bad-appid": "De botnaam \"$1\" is niet geldig.",
        "botpasswords-insert-failed": "Toevoegen van botnaam \"$1\" mislukt. Is deze misschien al toegevoegd?",
        "passwordreset-domain": "Domein:",
        "passwordreset-email": "E-mailadres:",
        "passwordreset-emailtitle": "Accountgegevens op {{SITENAME}}",
-       "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-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 herinnert 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-invalidemail": "Ongeldig e-mailadres",
        "passwordreset-nodata": "Er is geen gebruikersnaam of e-mailadres opgegeven",
        "changeemail": "E-mailadres wijzigen of verwijderen",
-       "changeemail-header": "Vul dit formulier in om uw e-mailadres te wijzigen. Als u het e-mailadres wilt ontkoppelen van uw account, laat het e-mailadres dan leeg als u het formulier opslaat.",
+       "changeemail-header": "Vul dit formulier in om uw e-mailadres te wijzigen. Als u geen enkel e-mailadres aan uw account gekoppeld wilt hebben, laat het veld voor het nieuwe e-mailadres dan leeg.",
        "changeemail-no-info": "U moet aangemeld zijn om rechtstreeks toegang te hebben tot deze pagina.",
        "changeemail-oldemail": "Huidig e-mailadres:",
        "changeemail-newemail": "Nieuw e-mailadres:",
-       "changeemail-newemail-help": "Laat dit veld leeg als u uw e-mailadres wilt verwijderen. Na het verwijderen kunt u niet langer een vergeten wachtwoord opnieuw instellen en u ontvangt geen e-mails van deze wiki meer.",
+       "changeemail-newemail-help": "Laat dit veld leeg als u uw e-mailadres wilt verwijderen. Zonder gekoppeld e-mailadres kunt u een vergeten wachtwoord niet opnieuw instellen en ontvangt u geen e-mails van deze wiki meer.",
        "changeemail-none": "(geen)",
        "changeemail-password": "Uw wachtwoord voor {{SITENAME}}:",
        "changeemail-submit": "E-mailadres wijzigen",
        "changeemail-throttled": "U heeft recentelijk te veel mislukte aanmeldpogingen gedaan.\nWacht alstublieft $1 voordat u het opnieuw probeert.",
        "changeemail-nochange": "Geef een ander e-mailadres op.",
        "resettokens": "Tokens opnieuw instellen",
-       "resettokens-text": "U kunt tokens opnieuw instellen die toegang geven tot bepaalde persoonlijke gegevens die aan uw account zijn verbonden.\n\nU zou dit moeten doen als u ze per ongeluk gedeeld heeft met anderen of als onbevoegden toegang tot uw account hebben gehad.",
+       "resettokens-text": "U kunt hier tokens die toegang geven tot bepaalde aan uw account gekoppelde privégegevens opnieuw instellen.\n\nU zou dit moeten doen als u ze per ongeluk met anderen hebt gedeeld of als onbevoegden toegang tot uw account hebben gehad.",
        "resettokens-no-tokens": "Er zijn geen tokens om opnieuw in te stellen.",
        "resettokens-tokens": "Tokens:",
        "resettokens-token-label": "$1 (huidige waarde: $2)",
        "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 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.",
+       "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>, worden uw bewerkingen aan uw gebruikersnaam toegeschreven, naast andere voordelen.",
        "anonpreviewwarning": "<em>U bent niet aangemeld. Door uw bewerking op te slaan wordt uw IP-adres in de paginageschiedenis opgenomen.</em>",
        "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.",
        "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": "Gebruikersaccount \"$1\" bestaat niet.\nControleer of u deze pagina wel wilt aanmaken/bewerken.",
-       "userpage-userdoesnotexist-view": "Gebruikersaccount \"$1\" is niet geregistreerd.",
+       "userpage-userdoesnotexist-view": "Gebruikersaccount \"$1\" bestaat niet.",
        "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.",
        "prefs-watchlist-days-max": "Maximaal $1 {{PLURAL:$1|dag|dagen}}",
        "prefs-watchlist-edits": "Maximaal aantal bewerkingen in de volglijst:",
        "prefs-watchlist-edits-max": "Maximale aantal: 1000",
-       "prefs-watchlist-token": "Volglijstsleutel:",
+       "prefs-watchlist-token": "Volglijsttoken:",
        "prefs-misc": "Diversen",
        "prefs-resetpass": "Wachtwoord wijzigen",
        "prefs-changeemail": "E-mailadres wijzigen of verwijderen",
        "recentchangesdays-max": "(maximaal $1 {{PLURAL:$1|dag|dagen}})",
        "recentchangescount": "Standaard aantal weer te geven bewerkingen:",
        "prefs-help-recentchangescount": "Dit geldt voor recente wijzigingen, paginageschiedenis en logboekpagina's.",
-       "prefs-help-watchlist-token2": "Dit is de geheime sleutel voor de webfeed van uw volglijst.\nIedereen die het token kent, kan uw volglijst bekijken, dus deel dit token niet.\nU kunt de [[Special:ResetTokens|tokens opnieuw instellen]] als u dat wilt.",
+       "prefs-help-watchlist-token2": "Dit is de geheime sleutel voor de webfeed van uw volglijst.\nIedereen die het token kent, kan uw volglijst bekijken, dus deel dit token niet.\nIndien nodig kunt u [[Special:ResetTokens|tokens opnieuw instellen]].",
        "savedprefs": "Uw voorkeuren zijn opgeslagen.",
        "savedrights": "De gebruikergroepen van {{GENDER:$1|$1}} zijn opgeslagen.",
        "timezonelegend": "Tijdzone:",
        "timezoneregion-indian": "Indische Oceaan",
        "timezoneregion-pacific": "Stille Oceaan",
        "allowemail": "Andere gebruikers toestaan mij e-mails te sturen",
+       "email-allow-new-users-label": "E-mails van gloednieuwe gebruikers toestaan",
        "email-blacklist-label": "Voorkom dat deze gebruikers e-mails naar mij kunnen sturen:",
        "prefs-searchoptions": "Zoeken",
        "prefs-namespaces": "Naamruimten",
        "recentchangeslinked-feed": "Verwante wijzigingen",
        "recentchangeslinked-toolbox": "Verwante wijzigingen",
        "recentchangeslinked-title": "Wijzigingen verwant aan \"$1\"",
-       "recentchangeslinked-summary": "Deze speciale pagina geeft de laatste bewerkingen weer op pagina's waarheen verwezen wordt vanaf een opgegeven pagina of op pagina's in een opgegeven categorie.\nPagina's die op [[Special:Watchlist|uw volglijst]] staan worden '''vet''' weergegeven.",
+       "recentchangeslinked-summary": "Voer een paginanaam in om bewerkingen te zien van pagina's waarheen vanaf die pagina verwezen wordt of die ernaar verwijzen. (Om leden van een categorie te zien, voert u <kbd>Categorie:''Naam van categorie''</kbd> in.) Bewerkingen van pagina's op [[Special:Watchlist|uw volglijst]] worden <strong>vet</strong> weergegeven.",
        "recentchangeslinked-page": "Paginanaam:",
        "recentchangeslinked-to": "Wijzigingen aan pagina's met koppelingen naar deze pagina bekijken",
        "recentchanges-page-added-to-category": "[[:$1]] aan categorie toegevoegd",
        "uploadstash-bad-path-invalid": "Pad is ongeldig.",
        "uploadstash-bad-path-unknown-type": "Onbekend type \"$1\".",
        "uploadstash-bad-path-unrecognized-thumb-name": "Miniatuurnaam onbekend.",
+       "uploadstash-bad-path-no-handler": "Geen handler gevonden voor mime $1 van bestand $2.",
        "uploadstash-bad-path-bad-format": "Sleutel \"$1\" is niet in het juiste formaat.",
        "uploadstash-file-not-found": "Sleutel \"$1\" niet gevonden in de opslag.",
        "uploadstash-file-not-found-no-thumb": "Kon geen miniatuur verkrijgen.",
+       "uploadstash-file-not-found-no-local-path": "Geen lokaal pad voor geschaalde afbeelding.",
        "uploadstash-file-not-found-no-object": "Kan geen lokaal bestandsobject voor het miniatuur aanmaken.",
        "uploadstash-file-not-found-no-remote-thumb": "Ophalen van het miniatuur mislukt: $1\nurl = $2",
        "uploadstash-file-not-found-missing-content-type": "content-type koptekst ontbreekt.",
        "listfiles-delete": "verwijderen",
        "listfiles-summary": "Op deze speciale pagina zijn alle toegevoegde bestanden te bekijken.",
        "listfiles_search_for": "Zoeken naar bestand:",
-       "listfiles-userdoesnotexist": "Het gebruikersaccount \"$1\" bestaat niet.",
+       "listfiles-userdoesnotexist": "Gebruikersaccount \"$1\" bestaat niet.",
        "imgfile": "bestand",
        "listfiles": "Bestandslijst",
        "listfiles_thumb": "Miniatuur",
        "listgrouprights-removegroup": "Gebruikers uit de volgende {{PLURAL:$2|groep|groepen}} verwijderen: $1",
        "listgrouprights-addgroup-all": "Gebruikers aan alle groepen toevoegen",
        "listgrouprights-removegroup-all": "Gebruikers uit alle groepen verwijderen",
-       "listgrouprights-addgroup-self": "De volgende {{PLURAL:$2|groep|groepen}} toevoegen aan eigen gebruiker: $1",
+       "listgrouprights-addgroup-self": "De volgende {{PLURAL:$2|groep|groepen}} toevoegen aan eigen account: $1",
        "listgrouprights-removegroup-self": "De volgende {{PLURAL:$2|groep|groepen}} verwijderen van eigen gebruiker: $1",
        "listgrouprights-addgroup-self-all": "Alle groepen toevoegen aan eigen account",
        "listgrouprights-removegroup-self-all": "Alle groepen verwijderen van eigen account",
        "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 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-summary": "Hieronder staat een lijst met toestemmingen en de bijbehorende gebruikersrechten. Gebruikers kunnen toepassingen machtigen hun account te gebruiken, maar met beperkte rechten gebaseerd op de toestemmingen die de gebruiker aan de toepassing heeft gegeven. Een toepassing die namens een gebruiker handelt, kan echter geen rechten gebruiken die de gebruiker niet heeft.\nEr is mogelijk [[{{MediaWiki:Listgrouprights-helppage}}|aanvullende informatie]] over individuele rechten.",
        "listgrants-grant": "Toestemming",
        "listgrants-rights": "Rechten",
        "trackingcategories": "Volgcategorieën",
        "protect-text": "Hier kunt u het beveiligingsniveau voor de pagina '''$1''' bekijken en wijzigen.",
        "protect-locked-blocked": "U kunt het beveiligingsniveau niet wijzigen terwijl u geblokkeerd bent.\nDit zijn de huidige instellingen voor de pagina '''$1''':",
        "protect-locked-dblock": "Het beveiligingsniveau kan niet worden gewijzigd, omdat de database gesloten is.\nHier zijn de huidige instellingen voor de pagina '''$1''':",
-       "protect-locked-access": "U hebt geen rechten om het beveiligingsniveau te wijzigen.\nDit zijn de huidige instellingen voor de pagina '''$1''':",
+       "protect-locked-access": "Uw account heeft geen rechten om het beveiligingsniveau van pagina's te wijzigen.\nDit zijn de huidige instellingen voor de pagina <strong>$1</strong>:",
        "protect-cascadeon": "Deze pagina is beveiligd, omdat die in de volgende {{PLURAL:$1|pagina|pagina's}} is opgenomen, die beveiligd {{PLURAL:$1|is|zijn}} met de cascade-optie.\nWijzigingen aan beveiligingsniveau hebben geen invloed op de cascadebeveiliging.",
        "protect-default": "Toestaan voor alle gebruikers",
        "protect-fallback": "Alleen gebruikers met het recht \"$1\" toestaan",
        "mycontris": "Bijdragen",
        "anoncontribs": "Bijdragen",
        "contribsub2": "Voor {{GENDER:$3|$1}} ($2)",
-       "contributions-userdoesnotexist": "De account \"$1\" is niet geregistreerd.",
+       "contributions-userdoesnotexist": "Gebruikersaccount \"$1\" bestaat niet.",
        "nocontribs": "Geen wijzigingen gevonden die aan de gestelde criteria voldoen.",
        "uctop": "(laatste wijziging)",
        "month": "Van maand (en eerder):",
        "year": "Van jaar (en eerder):",
-       "sp-contributions-newbies": "Alleen de bijdragen van nieuwe gebruikers bekijken",
+       "sp-contributions-newbies": "Alleen bijdragen van nieuwe accounts bekijken",
        "sp-contributions-newbies-sub": "Voor nieuwelingen",
-       "sp-contributions-newbies-title": "Bijdragen van nieuwe gebruikers",
+       "sp-contributions-newbies-title": "Gebruikersbijdragen van nieuwe accounts",
        "sp-contributions-blocklog": "blokkeerlogboek",
        "sp-contributions-suppresslog": "onderdrukte {{GENDER:$1|gebruikersbijdragen}}",
        "sp-contributions-deleted": "verwijderde {{GENDER:$1|gebruiker}}sbijdragen",
        "ipaddressorusername": "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",
+       "ipbreason-dropdown": "*Veelvoorkomende redenen voor blokkades\n** Foutieve informatie invoeren\n** Informatie uit pagina's verwijderen\n** Veelvuldig koppelingen naar externe websites plaatsen\n** Nonsens/gebrabbel in pagina's opnemen\n** Intimiderend gedragen/anderen lastigvallen\n** Van meerdere accounts misbruik maken\n** Een onaanvaardbare gebruikersnaam kiezen",
        "ipb-hardblock": "Aangemelde gebruikers de mogelijkheid ontnemen om vanaf dit IP-adres te bewerken",
        "ipbcreateaccount": "Registreren accounts blokkeren",
        "ipbemailban": "Gebruiker de mogelijkheid ontnemen om e-mail te versturen",
        "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 dit account te verbergen; het heeft meer dan {{PLURAL:$1|een bewerking|$1 bewerkingen}}.",
+       "ipb_hide_invalid": "Het is niet mogelijk dit account te verbergen; het heeft meer dan {{PLURAL:$1|één 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}}",
        "newimages-legend": "Bestandsnaam",
        "newimages-label": "Bestandsnaam (of deel daarvan):",
        "newimages-user": "IP-adres of gebruikersnaam",
-       "newimages-newbies": "Alleen de bijdragen van nieuwe gebruikers bekijken",
+       "newimages-newbies": "Alleen bijdragen van nieuwe accounts bekijken",
        "newimages-showbots": "Uploads door bots weergeven",
        "newimages-hidepatrolled": "Gecontroleerde uploads verbergen",
        "newimages-mediatype": "Mediatype:",
        "logentry-move-move_redir-noredirect": "$1 {{GENDER:$2|heeft}} pagina $3 naar $4 hernoemd over een doorverwijzing zonder een doorverwijzing achter te laten",
        "logentry-patrol-patrol": "$1 {{GENDER:$2|heeft}} versie $4 van pagina $3 gemarkeerd als gecontroleerd",
        "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-newusers": "Gebruikersaccount $1 is {{GENDER:$2|aangemaakt}}",
        "logentry-newusers-create": "Gebruikersaccount $1 {{GENDER:$2|is}} aangemaakt",
        "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-newusers-autocreate": "Gebruikersaccount $1 is automatisch {{GENDER:$2|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",
        "logentry-protect-protect": "$1 heeft $3 {{GENDER:$2|beveiligd}} $4",
        "feedback-useragent": "Useragent:",
        "searchsuggest-search": "Doorzoek {{SITENAME}}",
        "searchsuggest-containing": "bevat...",
-       "api-error-badtoken": "Interne fout: het token klopt niet.",
+       "api-error-badtoken": "Interne fout: Foutief token.",
        "api-error-emptypage": "Het aanmaken van nieuwe, lege pagina's is niet toegestaan.",
        "api-error-publishfailed": "Interne fout: de server kon het tijdelijke bestand niet publiceren.",
        "api-error-stashfailed": "Interne fout: de server kon het tijdelijke bestand niet opslaan.",
        "authmanager-provider-password-domain": "Wachtwoord- en domeingebaseerde authentificatie",
        "authmanager-provider-temporarypassword": "Tijdelijk wachtwoord",
        "authprovider-confirmlink-message": "Op basis van uw recente aanmeldpogingen kunnen de volgende accounts aan uw wiki-account worden gekoppeld. Het koppelen stelt u in staat in te loggen via deze accounts. Selecteer welke accounts gekoppeld moeten worden.",
-       "authprovider-confirmlink-request-label": "Accounts die aan elkaar moeten worden gekoppeld.",
+       "authprovider-confirmlink-request-label": "Accounts die aan elkaar gekoppeld moeten worden.",
        "authprovider-confirmlink-success-line": "$1: Succesvol gekoppeld.",
-       "authprovider-confirmlink-failed": "Account koppelen is niet volledig gelukt: $1",
+       "authprovider-confirmlink-failed": "Het koppelen van accounts is niet volledig gelukt: $1",
        "authprovider-confirmlink-ok-help": "Doorgaan na het weergeven van de storingsmeldingen over het koppelen.",
        "authprovider-resetpass-skip-label": "Overslaan",
        "authprovider-resetpass-skip-help": "Sla het resetten van het wachtwoord over.",
        "specialpage-securitylevel-not-allowed": "Sorry, het is u niet toegestaan gebruik te maken van deze pagina omdat uw identiteit niet kon worden geverifieerd.",
        "authpage-cannot-login": "Niet in staat om aan te melden.",
        "authpage-cannot-login-continue": "Niet in staat om in te loggen. Uw sessie is waarschijnlijk verlopen.",
-       "authpage-cannot-create": "Kon het account aanmaken niet starten.",
-       "authpage-cannot-create-continue": "Niet in staat het account aan te maken. Uw sessie is waarschijnlijk verlopen.",
-       "authpage-cannot-link": "Niet in staat om het account te koppelen.",
-       "authpage-cannot-link-continue": "Niet in staat het account te koppelen. Uw sessie is waarschijnlijk verlopen.",
+       "authpage-cannot-create": "Niet in staat het aanmaken van het account te starten.",
+       "authpage-cannot-create-continue": "Niet in staat het aanmaken van het account voort te zetten. Uw sessie is waarschijnlijk verlopen.",
+       "authpage-cannot-link": "Niet in staat het koppelen van de accounts te starten.",
+       "authpage-cannot-link-continue": "Niet in staat het koppelen van de accounts voort te zetten. Uw sessie is waarschijnlijk verlopen.",
        "cannotauth-not-allowed-title": "Geen toegang",
        "cannotauth-not-allowed": "U hebt geen toestemming om deze pagina te gebruiken",
        "changecredentials": "Authenticatiegegevens wijzigen",
        "removecredentials-invalidsubpage": "$1 is geen geldig identificatietype.",
        "removecredentials-success": "Uw authenticatiegegevens zijn verwijderd.",
        "credentialsform-provider": "Soort authenticatiegegevens:",
-       "credentialsform-account": "Gebruikersnaam:",
+       "credentialsform-account": "Accountnaam:",
        "cannotlink-no-provider-title": "Er zijn geen accounts om te koppelen",
        "cannotlink-no-provider": "Er zijn geen accounts om te koppelen.",
        "linkaccounts": "Accounts koppelen",
index fd101a9..9ffc4f9 100644 (file)
        "listusers": "Brukarliste",
        "listusers-editsonly": "Vis berre brukarar med endringar",
        "listusers-creationsort": "Sorter etter opprettingsdato",
+       "listusers-desc": "Sorter i minkande rekkjefylgd",
        "usereditcount": "{{PLURAL:$1|éi endring|$1 endringar}}",
        "usercreated": "{{GENDER:$3|Oppretta}} den $1 $2",
        "newpages": "Nye sider",
        "tag-filter": "[[Special:Tags|Merke]]filter:",
        "tag-filter-submit": "Filtrer",
        "tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1|Merke}}]]: $2)",
+       "tag-mw-contentmodelchange": "endring av innhaldsmodell",
+       "tag-mw-removed-redirect": "Fjerna omdirigering",
+       "tag-mw-changed-redirect-target": "Omdirigeringsmål endra",
        "tag-mw-changed-redirect-target-description": "Endringar som endrar målet til ei omdirigering",
        "tag-mw-blank-description": "Endringar som tømmer ei side",
+       "tag-mw-replace": "Bytte ut",
        "tag-mw-replace-description": "Endringar som fjernar meir enn 90&nbsp;% av innhaldet på ei side",
        "tag-mw-rollback": "Attenderulling",
        "tags-title": "Merke",
index ecc4824..9c13b73 100644 (file)
        "blankarticle": "<strong>خبرتیا:</strong> تاسو د یو خالي مخ جوړلو په حال کي ياست.\nکه «$1» دوهم ځلي کښي کاږي، نو مخ به د معلوماتو بغير جوړ سي.",
        "anoneditwarning": "<strong>گواښنه:</strong>  تاسې غونډال کې نه ياست ننوتي. که تاسې کوم سمونونه ترسره کوۍ نو ستاسې IP پته به ټولو ته د دې مخ د سمونونو په پېښليک کې ښکاري. که تاسې په خپل نوم <strong>[$1 کې ننوځئ]</strong> يا <strong>[$2 يو گڼون جوړ کړئ]</strong>، نو ستاسې سمونونه به ستاسې کارن-نوم اړونده ثبت شي چې ډېرې نورې گټې هم لري.",
        "anonpreviewwarning": "''تاسې غونډال ته نه ياست ننوتي. خوندي کولو سره به ستاسې IP پته به د دې مخ د سمونونو په پېښليک کې ثبت شي.''",
-       "missingsummary": "<strong>یادونه:</strong> تاسو د سمون لنډیز ندی چمتو کړی.\nکه تاسو \"$1\" ټک وکړئبیا به ستاسو بدلون پرته له دې چې يو وي خوندي شي.",
+       "missingsummary": "<strong>یادونه:</strong> تاسو د سمون لنډیز ندی چمتو کړی.\nکه تاسو \"$1\" کليک کړي نو بیا به ستاسو بدلون پرته له کوم انتظاره خوندي شي.",
        "selfredirect": "<strong>خبرداری:</strong> تاسو دا پاڼه دپاڼي خپل مخ ته استوي.ښایي تاسو د ګرځولو لپاره ناسم هدف مشخص کړی وي، یا تاسو ممکن په غلطه پاڼه سمونه کوي.\nکه تاسو \"$1\" بيا کلیک کړي، د مخ ورګرځونه به په هر دليل جوړه شي.",
        "missingcommenttext": "لطفاً کمينټ لاندې وليکۍ.",
-       "missingcommentheader": "<strong>یادونه:</strong> تاسو د سمون لنډیز ندی چمتو کړی.\nکه تاسو \"$1\" ټک وکړئبیا به ستاسو بدلون پرته له دې چې يو وي خوندي شي.",
+       "missingcommentheader": "<strong>یادونه:</strong> تاسو د سمون لنډیز ندی چمتو کړی.\nکه تاسو \"$1\" کليک کړي نو بیا به ستاسو بدلون پرته له کوم انتظاره خوندي شي.",
        "summary-preview": "د لنډيز مخليدنه:",
        "subject-preview": "د پروژې بيا ليدنه:",
        "previewerrortext": "د بدلونونو د مخليدنو په وخت کې مو يوه ستونزه رامېنځ ته شوه.",
        "defaultmessagetext": "تلواليزه پيغام متن",
        "invalid-content-data": "د ناباوره منځپانګې ډاټا",
        "content-not-allowed-here": "\"$1\" په پاڼه کې منځپانګې ته اجازه نشته [[$2]]",
+       "editpage-invalidcontentmodel-text": "د منځپانګې موډيول \"$1\" ملاتړ ندی شوی.",
+       "editpage-notsupportedcontentformat-title": "د منځپانګې بڼه نده ملاتړ شوې",
        "content-model-wikitext": "ويکي متن",
        "content-model-text": "ساده متن",
        "content-model-javascript": "جاواسکرېپټ",
        "post-expand-template-inclusion-category": "هغه مخونه چې په کې د کارېدلو کينډيو شمېر له ټاکلې کچې ډېر دی",
        "post-expand-template-argument-warning": "'''گواښنه:''' دا مخ لږ تر لږه د يوې کينډۍ عاملين لري چې بې حده لوی دی.\nدا عاملين ړنگ شول.",
        "post-expand-template-argument-category": "هغه مخونه چې د کينډۍ ړنگ شوي عاملين لري.",
+       "parser-template-loop-warning": "د کينډۍ پته ترلاسه شوه: [[$1]]",
+       "template-loop-category": "مخونه له کينډۍ پته ترلاسه شوو سره",
        "undo-failure": "د منازعې منځنۍ برخې د بدلونونو له امله دا سمون ندی رد شوی.",
        "undo-norev": "دا سمون ناکړل کېدای نه شي دا ځکه چې دا سمون نشته او يا هم ړنگ شوی.",
        "viewpagelogs": "د دې مخ يادښتونه کتل",
        "mergehistory-list": "د اخږلو وړ سمون پېښليک",
        "mergehistory-go": "اخږلو وړ سمونونه ښکاره کول",
        "mergehistory-submit": "بڼې سره يوځای کول",
+       "mergehistory-empty": "هیڅ بدلون نه شي کیدای.",
        "mergehistory-done": "د $1 $3 {{PLURAL:$3|بڼه|بڼې}} په برياليتوب سره و [[:$2]] کې {{PLURAL:$3|واخږل شو|واخږل شول}}.",
        "mergehistory-fail-bad-timestamp": "وخت ټاپه ناسمه ده.",
        "mergehistory-fail-invalid-source": "د مخ سرچينې ناباوره دي.",
        "prefs-editor": "سمونگر",
        "prefs-preview": "مخليدنه",
        "prefs-advancedrc": "پرمختللې خوښنې",
+       "prefs-opt-out": "د پرمختګونو څخه لرې کول",
        "prefs-advancedrendering": "پرمختللې خوښنې",
        "prefs-advancedsearchoptions": "پرمختللې خوښنې",
        "prefs-advancedwatchlist": "پرمختللې خوښنې",
        "recentchanges-label-plusminus": "د بايټونو د شمېر له مخې د مخ د بدلون کچه",
        "recentchanges-legend-heading": "<strong>لنډونونه:</strong>",
        "recentchanges-legend-newpage": "{{int:recentchanges-label-newpage}} ([[Special:NewPages|د نويو مخونو لړليک]] هم وگورئ)",
-       "recentchanges-legend-plusminus": "(<em>±123</em>)",
+       "recentchanges-legend-plusminus": "(<em>±۱۲۳</em>)",
        "recentchanges-submit": "ښکاره کول",
        "rcfilters-tag-remove": "لرې کړئ'$1'",
+       "rcfilters-legend-heading": "<strong>د لنډیزونو لړليک:</strong>",
+       "rcfilters-other-review-tools": "د بیاکتنې نور وسايل",
        "rcfilters-activefilters": "فعال فيلټرونه",
        "rcfilters-advancedfilters": "پرمختللي فلټرونه",
        "rcfilters-limit-title": "د ښودلو لپاره بدلونونه",
+       "rcfilters-limit-and-date-label": "{{PLURAL:$1|بدلونونه|$1 بدلونونه}}، $2",
        "rcfilters-days-title": "وروستي ورځي",
        "rcfilters-hours-title": "وروستي ساعتونه",
        "rcfilters-days-show-days": "$1 {{PLURAL:$1|day|ورځې}}",
        "rcfilters-highlighted-filters-list": "لوړ شوی: $1",
        "rcfilters-quickfilters": "خوندي شوی فلټرونه",
        "rcfilters-quickfilters-placeholder-title": "هيڅ فيلټر نه دي صفت سوي",
+       "rcfilters-quickfilters-placeholder-description": "ددي لپاره چي د خپل فلټر امستنې سم کړي، او بيايې په دوهم پړاو کې وکاروي، د فعال فلټر ساحې لاندې د بکمارک په نښه کېکاږئ.",
        "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-search-placeholder": "د فلټر بدلونونه (د مینو کارول یا د فلټر نوم لټونه)",
+       "rcfilters-invalid-filter": "غلط فلټر",
+       "rcfilters-empty-filter": "هيڅ فعال فلټر نشته. ټولي سمونې ښکاره شوي.",
        "rcfilters-filterlist-title": "چاڼگران",
+       "rcfilters-filterlist-whatsthis": "دوي سنګه کار کوي؟",
        "rcfilters-highlightmenu-title": "يو رنګ وټاکۍ",
        "rcfilters-filter-editsbyself-label": "بدلونونه ستاسو لخوا",
        "rcfilters-filter-editsbyself-description": "ستاسو خپل بدلونونه.",
        "rcfilters-filter-unpatrolled-description": "سمونې چي د ګزمې په توګه نه دي په نښه شوي.",
        "rcfilters-filtergroup-significance": "ارزښت",
        "rcfilters-filter-minor-label": "وړوکي سمونونه",
+       "rcfilters-filtergroup-watchlist": "د کتنلړ مخونه",
        "rcfilters-filter-watchlist-watched-label": "په کتنلړ کي",
        "rcfilters-filter-watchlist-notwatched-label": "په کتنلړ کې ندی",
        "rcfilters-filter-watchlist-notwatched-description": "هرڅه ستاسو په کتنلړ کې پرته ستاسو د بدلونونو مخونه.",
        "zip-wrong-format": "ځانگړې شوې دوتنه يوه ZIP دوتنه نه وه.",
        "uploadstash": "پورته کول سټش",
        "uploadstash-refresh": "د دوتنو لړليک بياتازه کول",
+       "uploadstash-bad-path-unknown-type": "ناڅرگنده ډول \"$1\".",
        "img-auth-accessdenied": "لاسرسی رد شو",
        "img-auth-nofile": "د $1 په نوم کومه دوتنه نشته.",
        "img-auth-streaming": "سټريمينګ \"$1\".",
        "apisandbox-results": "پايلې",
        "apisandbox-request-url-label": "د URL غوښتنه کول:",
        "apisandbox-request-time": "د غوښتنې وخت: {{PLURAL:$1|$1 م.ث}}",
+       "apisandbox-continue": "پرله پورې",
+       "apisandbox-continue-clear": "سپينول",
        "booksources": "د کتاب سرچينې",
        "booksources-search-legend": "د کتابي سرچينو پلټنه",
        "booksources-isbn": "ISBN:",
        "listgrouprights-namespaceprotection-header": "د نومتشيال محدوديتونه",
        "listgrouprights-namespaceprotection-namespace": "نوم-تشيال",
        "listgrouprights-namespaceprotection-restrictedto": "د کارن سمون ترسره کولو رښته(رښتې)",
+       "listgrants": "منلې",
        "listgrants-rights": "رښتې",
        "trackingcategories": "موندونکې وېشنيزې",
        "trackingcategories-summary": "په دې مخ کې هغه موندونکې وېشنيزې چې په اتوماتيک ډول د مېډياويکي ساوترې لخوا ډکېږي، د لړليک په توگه راغلي. د وېشنيزو نومونه د اړونده غونډال پيغامونو په بدلون سره چې د {{ns:8}} په نومتشيال کې دي، د بدلېدلو وړتيا لري.",
        "sp-contributions-uploads": "پورته کېدنې",
        "sp-contributions-logs": "يادښتونه",
        "sp-contributions-talk": "خبرې اترې",
-       "sp-contributions-userrights": "د کارن رښتو سمبالښت",
+       "sp-contributions-userrights": "د {{GENDER:$1|کارن}} رښتو سمبالښت",
        "sp-contributions-blocked-notice": "دم مهال په دې کارن بنديز لگېدلی.\nد بنديز يادښت تازه مالومات په لاندې توگه دي:",
        "sp-contributions-search": "د ونډو پلټنه",
        "sp-contributions-username": "IP پته يا کارن-نوم:",
        "block": "په کارن بنديز لگول",
        "unblock": "کارن له بنديزه وېستل",
        "blockip": "په {{GENDER:$1|کارن}} بنديز لگول",
-       "blockiptext": "د لاندينۍ فورمې په کارولو سره تاسې يو کارن او يا هم يوې ځانگړې IP پتې باندې د ليکلو بنديزونه لگولی شی.  \nدا بايد د پوهې سره دښمنۍ او ورانکارۍ د مخنيولو په تکل او د پښتو ويکيپېډيا د [[{{MediaWiki:Policy-url}}|تگلارې]] سره سم پلي شي.\nد بنديز لپاره مو يو ځانگړی دليل لاندې روښانه کړئ (د ساري په توگه، هغه مخونو ښکاره کول چې ورانکاري په کې ترسره شوې).",
+       "blockiptext": "د لاندينۍ فورمې په کارولو سره تاسې يو کارن او يا هم يوې ځانگړې IP پتې باندې د ليکلو بنديزونه لگولی شی.  \nدا بايد د پوهې سره دښمنۍ او ورانکارۍ د مخنيولو په تکل او د پښتو ويکيپېډيا د [[{{MediaWiki:Policy-url}}|تگلارې]] سره سم پلي شي.\nد بنديز لپاره مو يو ځانگړی دليل لاندې روښانه کړئ (د ساري په توگه، هغه مخونو ښکاره کول چې ورانکاري په کې ترسره شوې).\n[https://ps.wikipedia.org/wiki/Classless_Inter-Domain_Routing سي ډي اي ار] نخښه; the آر اجازه ورکول رینج دی /$1 لپاره د اي پي وي ۴ او /$2 لپاره د اي پي وي ۶.",
        "ipaddressorusername": "IP پته يا کارن نوم",
        "ipbexpiry": "د پای نېټه:",
        "ipbreason": "سبب:",
        "newimages-legend": "چاڼگر",
        "newimages-label": "د دوتنې نوم (يا د دې برخه):",
        "newimages-showbots": "د روباټونو لخوا پورته کېدنې ښکاره کول",
+       "newimages-mediatype": "د رسنۍ ډول:",
        "noimages": "د کتلو لپاره څه نشته.",
        "ilsubmit": "پلټل",
        "bydate": "د نېټې له مخې",
        "sp-newimages-showfrom": "هغه نوې دوتنې چې په $1 په $2 بجو پيلېږي ښکاره کول",
+       "minutes-abbrev": "$1 دقیقي",
        "hours-abbrev": "$1 گ",
        "seconds": "{{PLURAL:$1|$1 ثانيه|$1 ثانيې}}",
        "minutes": "{{PLURAL:$1|$1 دقيقه|$1 دقيقې}}",
        "authform-notoken": "نادرکه نښه",
        "authform-wrongtoken": "ناسمه نښه",
        "specialpage-securitylevel-not-allowed-title": "اجازه نسته",
+       "cannotauth-not-allowed-title": "د اجازې تفصيل",
        "changecredentials-submit": "بدلول",
        "removecredentials-submit": "غورځول",
+       "credentialsform-provider": "د اعتبار وړ ډول:",
        "credentialsform-account": "گڼون نوم:",
+       "cannotlink-no-provider-title": "دلته د منلو وړ حساب شتون نلري.",
+       "cannotlink-no-provider": "دلته د منلو وړ حساب شتون نلري.",
        "linkaccounts": "ورګډ سوي ګڼونونه",
        "linkaccounts-success-text": "ګڼون ورګډ سو.",
        "linkaccounts-submit": "لينک کڼوڼونه",
index 6808e60..4832e91 100644 (file)
        "timezoneregion-indian": "Oceano Índico",
        "timezoneregion-pacific": "Oceano Pacífico",
        "allowemail": "Permitir que outros utilizadores me enviem correio eletrónico",
+       "email-allow-new-users-label": "Permitir mensagens de correio de utilizadores novos",
        "email-blacklist-label": "Proibir estes utilizadores de me enviarem correio eletrónico:",
        "prefs-searchoptions": "Pesquisa",
        "prefs-namespaces": "Domínios",
        "rcfilters-filter-showlinkedfrom-option-label": "Mostrar mudanças de páginas <strong>PARA AS QUAIS</strong> uma página contém hiperligações",
        "rcfilters-filter-showlinkedto-label": "Mostrar mudanças de páginas que contêm hiperligações para a página",
        "rcfilters-filter-showlinkedto-option-label": "Mostrar mudanças de páginas <strong>QUE CONTÊM</strong> hiperligações para uma página",
-       "rcfilters-target-page-placeholder": "Selecionar uma página",
+       "rcfilters-target-page-placeholder": "Introduzir o nome de uma página",
        "rcnotefrom": "Abaixo {{PLURAL:$5|está a mudança|estão as mudanças}} desde <strong>$2</strong> (mostradas até <strong>$1</strong>).",
        "rclistfromreset": "Reiniciar a seleção da data",
        "rclistfrom": "Mostrar as novas mudanças a partir das $2 de $3",
        "recentchangeslinked-feed": "Alterações relacionadas",
        "recentchangeslinked-toolbox": "Alterações relacionadas",
        "recentchangeslinked-title": "Alterações relacionadas com \"$1\"",
-       "recentchangeslinked-summary": "Esta é uma lista de mudanças recentes a todas as páginas para as quais a página fornecida contém hiperligações (ou de todas as que pertencem à categoria fornecida).\nAs suas [[Special:Watchlist|páginas vigiadas]] aparecem a <strong>negrito</strong>.",
+       "recentchangeslinked-summary": "Introduza o nome de uma página para ver as mudanças a todas as páginas que contêm hiperligações para ela ou para as quais a página fornecida contém hiperligações (para ver as que pertencem a uma categoria, introduza Categoria:Nome da categoria). As mudanças às suas [[Special:Watchlist|páginas vigiadas]] aparecem a <strong>negrito</strong>.",
        "recentchangeslinked-page": "Nome da página:",
        "recentchangeslinked-to": "Inversamente, mostrar mudanças às páginas que contêm hiperligações para esta",
        "recentchanges-page-added-to-category": "[[:$1]] foi adicionada à categoria",
index f3f44c8..209838e 100644 (file)
        "mycontris": "In the personal urls page section - right upper corner.\n\nSee also:\n* {{msg-mw|Mycontris}}\n* {{msg-mw|Accesskey-pt-mycontris}}\n* {{msg-mw|Tooltip-pt-mycontris}}\n{{Identical|Contribution}}",
        "anoncontribs": "Same as {{msg-mw|mycontris}} but used for non-logged-in users.\n\nSee also:\n* {{msg-mw|Accesskey-pt-anoncontribs}}\n* {{msg-mw|Tooltip-pt-anoncontribs}}\n{{Identical|Contribution}}",
        "contribsub2": "Contributions for \"user\" (links). Parameters:\n* $1 is an IP address or a username, with a link which points to the user page (if registered user).\n* $2 is list of tool links. The list contains a link which has text {{msg-mw|Sp-contributions-talk}}.\n* $3 is a plain text username used for GENDER.\n{{Identical|For $1}}",
-       "contributions-userdoesnotexist": "This message is used in [[Special:Contributions]]. It is used to tell the user that the name he searched for doesn't exists.\n\nParameters:\n* $1 - a username\n{{Identical|Userdoesnotexist}}",
+       "contributions-userdoesnotexist": "This message is used in [[Special:Contributions]]. It is used to tell the user that the name he searched for doesn't exist.\n\nParameters:\n* $1 - a username\n{{Identical|Userdoesnotexist}}",
        "nocontribs": "Used in [[Special:Contributions]] and [[Special:DeletedContributions]].\n\nSee examples: [[Special:Contributions/x]] and [[Special:DeletedContributions/x]].\n\nParameters:\n* $1 - (Unused) the user name",
        "uctop": "This message is used in [[Special:Contributions]]. It is used to show that a particular edit was the last made to a page. Example: 09:57, 11 February 2008 (hist) (diff) Pagename‎ (edit summary) (current)\n{{Identical|Current}}",
        "month": "Used in [[Special:Contributions]] and history pages ([{{fullurl:Sandbox|action=history}} example]), as label for a dropdown box to select a specific month to view the edits made in that month, and the earlier months. See also {{msg-mw|year}}.",
index c898e13..03fddda 100644 (file)
        "rcfilters-watchlist-showupdated": "Изменения страниц, которые вы не посещали с того момента, как они изменились, выделены <strong>жирным</strong> и отмечены полным маркером.",
        "rcfilters-preference-label": "Скрыть улучшенную версию Последних изменений",
        "rcfilters-preference-help": "Откатывает редизайн интерфейса 2017 года и все инструменты, добавленные с тех пор.",
+       "rcfilters-target-page-placeholder": "Введите имя страницы",
        "rcnotefrom": "Ниже {{PLURAL:$5|указано изменение|перечислены изменения}} с <strong>$3, $4</strong> (показано не более <strong>$1</strong>).",
        "rclistfromreset": "Сбросить выбор даты",
        "rclistfrom": "Показать изменения с $3 $2.",
        "autosumm-blank": "Полностью удалено содержимое страницы",
        "autosumm-replace": "Содержимое страницы заменено на «$1»",
        "autoredircomment": "Перенаправление на [[$1]]",
+       "autosumm-removed-redirect": "Удалённое перенаправление на [[$1]]",
+       "autosumm-changed-redirect-target": "Перенаправление изменено с [[$1]] на [[$2]]",
        "autosumm-new": "Новая страница: «$1»",
        "autosumm-newblank": "Создана пустая страница",
        "size-bytes": "$1 {{PLURAL:$1|байт|байта|байт}}",
        "tag-mw-changed-redirect-target-description": "Правки, которые изменяют цель перенаправления",
        "tag-mw-blank": "Очистка",
        "tag-mw-blank-description": "Правки, которые очищают страницу",
-       "tag-mw-replace": "Ð\97аменено",
+       "tag-mw-replace": "заменено",
        "tag-mw-replace-description": "Правки, которые удаляют более 90 % содержимого страницы",
-       "tag-mw-rollback": "Ð\9eткат",
+       "tag-mw-rollback": "откат",
        "tag-mw-rollback-description": "Правки, которые откатывают предыдущие правки по нажатию ссылки отката",
        "tags-title": "Метки",
        "tags-intro": "На этой странице приведён список меток, которыми программное обеспечение отмечает правки, а также значения этих меток.",
index 6ccd851..978fcdd 100644 (file)
        "timezoneregion-indian": "Indijski ocean",
        "timezoneregion-pacific": "Tihi ocean",
        "allowemail": "Drugim uporabnikom omogoči pošiljanje e-pošte",
+       "email-allow-new-users-label": "Dovoli e-pošto od čisto novih uporabnikov",
        "email-blacklist-label": "Prepreči naslednjim uporabnikom, da mi pošiljajo e-pošto:",
        "prefs-searchoptions": "Iskanje",
        "prefs-namespaces": "Imenski prostori",
index 84ba0f3..46ba7d1 100644 (file)
        "timezoneregion-indian": "Indiska oceanen",
        "timezoneregion-pacific": "Stilla havet",
        "allowemail": "Låt andra användare skicka e-post till mig",
+       "email-allow-new-users-label": "Tillåt e-post från nyregistrerade användare",
        "email-blacklist-label": "Förhindra följande användare att skicka e-post till mig:",
        "prefs-searchoptions": "Sök",
        "prefs-namespaces": "Namnrymder",
index c7911a0..cfb1ef8 100644 (file)
        "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-learner-label": "ผู้เรียน",
+       "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 วัน",
        "fileexists-forbidden": "มีไฟล์ชื่อนี้แล้ว และไม่สามารถเขียนทับได้\nหากคุณยังต้องการอัปโหลดไฟล์ของคุณ กรุณาย้อนกลับและใช้ชื่อใหม่ \n[[File:$1|thumb|center|$1]]",
        "fileexists-shared-forbidden": "ไฟล์ที่ใช้ชื่อนี้มีอยู่แล้วในระบบเก็บไฟล์ในส่วนกลาง\nถ้าคุณยังคงต้องการอัปโหลดไฟล์ของคุณ กรุณาย้อนกลับไปตั้งชื่อใหม่\n[[File:$1|thumb|center|$1]]",
        "fileexists-no-change": "ไฟล์ที่อัปโหลดเป็นคู่พอดีของ <strong>[[:$1]]</strong> รุ่นปัจจุบัน",
-       "fileexists-duplicate-version": "à¹\84à¸\9fลà¹\8cà¸\97ีà¹\88อัà¸\9bà¹\82หลà¸\94à¹\80à¸\9bà¹\87à¸\99à¸\84ูà¹\88à¸\9eอà¸\94ีà¸\82อà¸\87 <strong>[[:$1]]</strong> à¸£à¸¸à¹\88à¸\99à¸\81à¹\88อà¸\99",
+       "fileexists-duplicate-version": "à¹\84à¸\9fลà¹\8cà¸\97ีà¹\88อัà¸\9bà¹\82หลà¸\94à¸\8bà¹\89ำà¸\81ัà¸\9a <strong>[[:$1]]</strong> {{PLURAL:$2|}}รุà¹\88à¸\99à¸\81à¹\88อà¸\99à¸\9eอà¸\94ี",
        "file-exists-duplicate": "ไฟล์นี้ซ้ำกับ{{PLURAL:$1|ไฟล์|ไฟล์}}ต่อไปนี้:",
        "file-deleted-duplicate": "ไฟล์ที่เหมือนไฟล์นี้ ([[:$1]]) เคยถูกลบไปก่อนหน้านี้แล้ว\nคุณควรตรวจสอบว่าประวัติการลบของไฟล์ก่อนดำเนินการอัปโหลดใหม่",
        "file-deleted-duplicate-notitle": "ไฟล์ที่เหมือนกับไฟล์นี้เคยถูกลบมาก่อน และชื่อดังกล่าวถูกห้ามใช้ คุณควรสอบถามผู้ที่สามารถดูข้อมูลไฟล์ที่ถูกระงับเพื่อทบทวนสถานการณ์ก่อนดำเนินการอัปโหลดไฟล์อีกครั้ง",
        "unprotectedarticle": "ยกเลิกการล็อกจาก \"[[$1]]\"",
        "movedarticleprotection": "ย้ายการตั้งค่าการล็อกจาก \"[[$2]]\" ไป \"[[$1]]\"",
        "protectedarticle-comment": "ล็อก \"[[$1]]\"",
-       "modifiedarticleprotection-comment": "เปลี่ยนระดับการล็อกสำหรับ \"[[$1]]\"",
-       "unprotectedarticle-comment": "ปลดล็อก \"[[$1]]\"",
+       "modifiedarticleprotection-comment": "{{GENDER:$2|}}เปลี่ยนระดับการล็อกสำหรับ \"[[$1]]\"",
+       "unprotectedarticle-comment": "{{GENDER:$2|}}ปลดล็อก \"[[$1]]\"",
        "protect-title": "เปลี่ยนระดับการล็อกสำหรับ \"$1\"",
        "protect-title-notallowed": "ดูระดับการล็อกของ \"$1\"",
        "prot_1movedto2": "เปลี่ยนชื่อ [[$1]] เป็น [[$2]]",
        "htmlform-user-not-exists": "ไม่มี <strong>$1</strong>",
        "htmlform-user-not-valid": "<strong>$1</strong> มิใช่ชื่อผู้ใช้ที่สมเหตุสมผล",
        "logentry-delete-delete": "$1 ลบหน้า $3",
-       "logentry-delete-delete_redir": "$1 ลบหน้าเปลี่ยนทาง $3 โดยการเขียนทับ",
+       "logentry-delete-delete_redir": "$1 {{GENDER:$2|}}ลบหน้าเปลี่ยนทาง $3 โดยการเขียนทับ",
        "logentry-delete-restore": "$1 กู้คืนหน้า $3 ($4)",
-       "logentry-delete-restore-nocount": "$1 กู้คืนหน้า $3",
+       "logentry-delete-restore-nocount": "$1 {{GENDER:$2|}}กู้คืนหน้า $3",
        "restore-count-revisions": "$1 รุ่น",
        "restore-count-files": "$1 ไฟล์",
        "logentry-delete-event": "$1 เปลี่ยนทัศนวิสัยของ $5 รายการปูมใน $3: $4",
index 403c30b..94708e5 100644 (file)
        "page_last": "son",
        "histlegend": "Fark seçimi: Karşılaştırmayı istediğiniz 2 sürümün önündeki daireleri işaretleyip, \"{{int:Compareselectedversions}}\" düğmesine basın.<br />\nTanımlar: '''({{int:cur}})''' = son revizyon ile arasındaki fark, '''({{int:last}})''' = bir önceki revizyon ile arasındaki fark, '''{{int:minoreditletter}}''' = küçük değişiklik.",
        "history-fieldset-title": "Geçmişe gözat",
-       "history-show-deleted": "Sadece silinenler",
+       "history-show-deleted": "Sadece silinen sürümler",
        "histfirst": "en eski",
        "histlast": "en yeni",
        "historysize": "({{PLURAL:$1|1 bayt|$1 bayt}})",
        "search-file-match": "(dosya içeriğiyle eşleşiyor)",
        "search-suggest": "Bunu mu demek istediniz: $1",
        "search-rewritten": "$1 için sonuçlar gösteriliyor. Bunun yerine $2 için arama yapılsın mı?",
-       "search-interwiki-caption": "Kardeş projeler",
+       "search-interwiki-caption": "Kardeş projelerden sonuçlar",
        "search-interwiki-default": "$1 sonuçları:",
        "search-interwiki-more": "(daha çok)",
        "search-interwiki-more-results": "daha fazla sonuç",
        "prefs-editwatchlist-clear": "İzleme listenizi temizleyin",
        "prefs-watchlist-days": "İzleme listesinde görüntülenecek gün sayısı:",
        "prefs-watchlist-days-max": "en fazla $1 {{PLURAL:$1|gün|gün}}",
-       "prefs-watchlist-edits": "Genişletilmiş izleme listesinde gösterilecek değişiklik sayısı:",
+       "prefs-watchlist-edits": "İzleme listesinde gösterilecek en fazla değişiklik sayısı:",
        "prefs-watchlist-edits-max": "En fazla sayı: 1000",
        "prefs-watchlist-token": "İzleme listesi anahtarı:",
        "prefs-misc": "Diğer ayarlar",
        "recentchanges-submit": "Göster",
        "rcfilters-group-results-by-page": "Sayfalandırılmış grup sonuçları",
        "rcfilters-activefilters": "Etkin süzgeçler",
+       "rcfilters-advancedfilters": "Gelişmiş süzgeçler",
+       "rcfilters-quickfilters": "Kaydedilmiş süzgeçler",
+       "rcfilters-quickfilters-placeholder-title": "Henüz hiçbir süzgeç kaydedilmedi",
+       "rcfilters-quickfilters-placeholder-description": "Süzgeç ayarlarınızı kaydetmek ve sonrasında bunları kullanmak için, aşağıda Aktif Süzgeçler alanındaki yer imi simgesine tıklayın.",
+       "rcfilters-savedqueries-defaultlabel": "Kaydedilmiş süzgeçler",
+       "rcfilters-savedqueries-rename": "Yeniden adlandır",
+       "rcfilters-savedqueries-setdefault": "Varsayılan olarak belirle",
+       "rcfilters-savedqueries-unsetdefault": "Varsayılan olmaktan çıkar",
+       "rcfilters-savedqueries-remove": "Kaldır",
+       "rcfilters-savedqueries-new-name-label": "Ad",
+       "rcfilters-savedqueries-new-name-placeholder": "Süzgecin amacını tanımlayın",
+       "rcfilters-savedqueries-apply-label": "Süzgeç oluştur",
+       "rcfilters-savedqueries-add-new-title": "Mevcut süzgeç ayarlarını kaydet",
        "rcfilters-restore-default-filters": "Varsayılan süzgeçleri geri getir",
        "rcfilters-clear-all-filters": "Tüm süzgeçleri temizle",
-       "rcfilters-search-placeholder": "Son değişiklikleri filtrele (gözatın veya yazmaya başlayın)",
+       "rcfilters-show-new-changes": "Yeni değişiklikleri görüntüle",
+       "rcfilters-search-placeholder": "Son değişiklikleri filtrele (menüyü kullanın veya süzgeç adını arayın)",
        "rcfilters-invalid-filter": "Geçersiz süzgeç",
        "rcfilters-empty-filter": "Etkin süzgeç bulunmuyor. Tüm katkıları gösteriliyor.",
        "rcfilters-filterlist-title": "Süzgeçler",
-       "rcfilters-filterlist-whatsthis": "Bu nedir?",
-       "rcfilters-filterlist-feedbacklink": "Yeni (beta) süzgeçler konusunda geribildirim verin",
+       "rcfilters-filterlist-whatsthis": "Bunlar nasıl çalışır?",
+       "rcfilters-filterlist-feedbacklink": "Bu (yeni) süzgeç araçları konusunda ne düşündüğünüzü bize aktarın",
        "rcfilters-highlightbutton-title": "Sonuçları vurgula",
        "rcfilters-highlightmenu-title": "Bir renk seçin",
        "rcfilters-highlightmenu-help": "Bu özelliği vurgulamak için bir renk seçin",
        "rcfilters-filterlist-noresults": "Süzgeç bulunamadı",
+       "rcfilters-noresults-conflict": "Hiçbir sonuç bulunamadı çünkü arama kriterleri çelişkili",
        "rcfilters-filtergroup-authorship": "Düzenleme sahipliği",
        "rcfilters-filter-editsbyself-label": "Senin değişiklikleriniz",
        "rcfilters-filter-editsbyself-description": "Kendi katkılarınız.",
        "rcfilters-filter-major-description": "Küçük olarak etiketlenmemiş düzenlemeler.",
        "rcfilters-filtergroup-changetype": "Değişiklik türü",
        "rcfilters-filter-pageedits-label": "Sayfa düzenlemeleri",
-       "rcfilters-filter-pageedits-description": "Viki içeriği, tartışmalar, kategori açıklamalarındaki düzenlemeler....",
+       "rcfilters-filter-pageedits-description": "Viki içeriği, tartışmalar, kategori açıklamalarındaki düzenlemeler...",
        "rcfilters-filter-newpages-label": "Sayfa oluşturmalar",
        "rcfilters-filter-newpages-description": "Yeni sayfa oluşturan düzenlemeler.",
        "rcfilters-filter-categorization-label": "Kategori değişiklikleri",
        "rcfilters-filter-categorization-description": "Kategorilere eklenen veya kaldırılan sayfaların kayıtları.",
        "rcfilters-filter-logactions-label": "Günlüğü tutulan işlemler",
-       "rcfilters-filter-logactions-description": "Hizmetli işlemleri, hesap oluşturmalar, sayfa silmeler, yüklemeler....",
+       "rcfilters-filter-logactions-description": "Hizmetli işlemleri, hesap oluşturmalar, sayfa silmeler, yüklemeler...",
+       "rcfilters-liveupdates-button": "Canlı güncelleme",
+       "rcfilters-liveupdates-button-title-on": "Canlı güncellemeyi kapat",
+       "rcfilters-liveupdates-button-title-off": "Yeni değişiklikleri yapıldıkları anda görüntüleyin",
+       "rcfilters-watchlist-markseen-button": "Tüm değişiklileri görüldü olarak işaretle",
        "rcnotefrom": "<strong>$3, $4</strong> tarihinden itibaren yapılan {{PLURAL:$5|değişiklik|değişiklik}} aşağıdadır (<strong>$1</strong> tarhine kadar olanlar gösterilmektedir).",
        "rclistfrom": "$3 $2 tarihinden itibaren yeni değişiklikleri göster",
        "rcshowhideminor": "Küçük değişiklikleri $1",
        "recentchangeslinked-page": "Sayfa adı:",
        "recentchangeslinked-to": "Belirtilen sayfadan verilenler yerine, sayfaya verilen bağlantıları göster.",
        "recentchanges-page-added-to-category": "[[:$1]] kategoriye eklendi",
+       "recentchanges-page-removed-from-category": "[[:$1]] kategoriden çıkarıldı",
        "upload": "Dosya yükle",
        "uploadbtn": "Dosya yükle",
        "reuploaddesc": "Yükleme formuna geri dön.",
        "listfiles_size": "Boyut (bayt)",
        "listfiles_description": "Tanım",
        "listfiles_count": "Sürümler",
-       "listfiles-show-all": "Görüntülerin eski sürümlerini içer",
+       "listfiles-show-all": "Dosyaların eski sürümlerini dahil et",
        "listfiles-latestversion": "Geçerli sürüm",
        "listfiles-latestversion-yes": "Evet",
        "listfiles-latestversion-no": "Hayır",
        "enotif_lastdiff": "Bu değişikliği görmek için, $1 sayfasına bakınız.",
        "enotif_anon_editor": "anonim kullanıcı $1",
        "enotif_body": "Sayın $WATCHINGUSERNAME,\n\n$PAGEINTRO $NEWPAGE\n\nEditörün girdiği özet: $PAGESUMMARY $PAGEMINOREDIT\n\nEditörün iletişim bilgileri:\ne-posta: $PAGEEDITOR_EMAIL\nviki: $PAGEEDITOR_WIKI\n\nBahsi geçen sayfayı oturum açarak ziyaret edinceye kadar sayfayla ilgili başka bildirim gönderilmeyecektir. Ayrıca izleme listenizdeki tüm sayfaların bildirim durumlarını sıfırlayabilirsiniz.\n\n{{SITENAME}} bildirim sistemi\n\n--\nE-posta bildirim ayarlarınızı değiştirmek için aşağıdaki sayfayı ziyaret ediniz:\n{{canonicalurl:{{#special:Preferences}}}}\n\nİzleme listesi ayarlarınızı değiştirmek için aşağıdaki sayfayı ziyaret ediniz:\n{{canonicalurl:{{#special:EditWatchlist}}}}\n\nSayfayı izleme listenizden silmek için aşağıdaki sayfayı ziyaret ediniz:\n$UNWATCHURL\n\nGeri bildirim ve daha fazla yardım için:\n$HELPPAGE",
+       "enotif_minoredit": "Bu küçük bir değişiklik",
        "created": "oluşturuldu",
        "changed": "değiştirildi",
        "deletepage": "Sayfayı sil",
index 24f73ab..14ac649 100644 (file)
        "timezoneregion-indian": "印度洋",
        "timezoneregion-pacific": "太平洋",
        "allowemail": "允许其他用户向我发送电子邮件",
+       "email-allow-new-users-label": "允许来自新用户的电子邮件",
        "email-blacklist-label": "禁止这些用户给我发送电子邮件:",
        "prefs-searchoptions": "搜索",
        "prefs-namespaces": "名字空间",
index 3146a36..42cc676 100644 (file)
@@ -82,8 +82,11 @@ $specialPageAliases = [
        'Blankpage'                 => [ '빈문서' ],
        'Block'                     => [ '차단', 'IP차단', '사용자차단' ],
        'Booksources'               => [ '책찾기' ],
+       'BotPasswords'              => [ '봇비밀번호' ],
        'BrokenRedirects'           => [ '끊긴넘겨주기' ],
        'Categories'                => [ '분류' ],
+       'ChangeContentModel'        => [ '콘텐츠모델바꾸기', '콘텐츠모델변경' ],
+       'ChangeCredentials'         => [ '자격증명바꾸기', '자격증명변경' ],
        'ChangeEmail'               => [ '이메일바꾸기', '이메일변경' ],
        'ChangePassword'            => [ '비밀번호바꾸기', '비밀번호변경' ],
        'ComparePages'              => [ '문서비교' ],
@@ -94,6 +97,7 @@ $specialPageAliases = [
        'DeletedContributions'      => [ '삭제된기여' ],
        'Diff'                      => [ '차이' ],
        'DoubleRedirects'           => [ '이중넘겨주기' ],
+       'EditTags'                  => [ '태그편집' ],
        'EditWatchlist'             => [ '주시문서목록편집' ],
        'Emailuser'                 => [ '이메일보내기', '이메일' ],
        'ExpandTemplates'           => [ '틀전개' ],
@@ -101,6 +105,7 @@ $specialPageAliases = [
        'Fewestrevisions'           => [ '역사짧은문서' ],
        'FileDuplicateSearch'       => [ '중복파일검색', '중복파일찾기' ],
        'Filepath'                  => [ '파일경로', '그림경로' ],
+       'GoToInterwiki'             => [ '인터위키가기' ],
        'Import'                    => [ '가져오기' ],
        'Invalidateemail'           => [ '이메일인증취소', '이메일인증해제' ],
        'JavaScriptTest'            => [ '자바스크립트시험', '자바스크립트테스트' ],
@@ -109,7 +114,8 @@ $specialPageAliases = [
        'Listadmins'                => [ '관리자', '관리자목록' ],
        'Listbots'                  => [ '봇', '봇목록' ],
        'Listfiles'                 => [ '파일', '그림', '파일목록', '그림목록' ],
-       'Listgrouprights'           => [ '사용자권한', '권한목록' ],
+       'Listgrouprights'           => [ '사용자권한목록', '사용자권한', '권한목록' ],
+       'Listgrants'                => [ '권한부여목록' ],
        'Listredirects'             => [ '넘겨주기목록' ],
        'ListDuplicatedFiles'       => [ '중복된파일목록' ],
        'Listusers'                 => [ '사용자', '사용자목록' ],
index 4071a06..6348e96 100644 (file)
@@ -208,7 +208,9 @@ class CheckStorage {
                                        $blobsTable = $this->dbStore->getTable( $extDb );
                                        $res = $extDb->select( $blobsTable,
                                                [ 'blob_id' ],
-                                               [ 'blob_id IN( ' . implode( ',', $blobIds ) . ')' ], __METHOD__ );
+                                               [ 'blob_id' => $blobIds ],
+                                               __METHOD__
+                                       );
                                        foreach ( $res as $row ) {
                                                unset( $xBlobIds[$row->blob_id] );
                                        }
@@ -410,7 +412,9 @@ class CheckStorage {
                        $headerLength = strlen( self::CONCAT_HEADER );
                        $res = $extDb->select( $blobsTable,
                                [ 'blob_id', "LEFT(blob_text, $headerLength) AS header" ],
-                               [ 'blob_id IN( ' . implode( ',', $blobIds ) . ')' ], __METHOD__ );
+                               [ 'blob_id' => $blobIds ],
+                               __METHOD__
+                       );
                        foreach ( $res as $row ) {
                                if ( strcasecmp( $row->header, self::CONCAT_HEADER ) ) {
                                        $this->addError(
index e0d165f..b3a9012 100644 (file)
@@ -4832,7 +4832,7 @@ OO.ui.mixin.ClippableElement.prototype.setIdealSize = function ( width, height )
  * @return {string} 'left' or 'right'
  */
 OO.ui.mixin.ClippableElement.prototype.getHorizontalAnchorEdge = function () {
-       if ( this.computePosition && this.computePosition().right !== '' ) {
+       if ( this.computePosition && this.positioning && this.computePosition().right !== '' ) {
                return 'right';
        }
        return 'left';
@@ -4854,7 +4854,7 @@ OO.ui.mixin.ClippableElement.prototype.getHorizontalAnchorEdge = function () {
  * @return {string} 'top' or 'bottom'
  */
 OO.ui.mixin.ClippableElement.prototype.getVerticalAnchorEdge = function () {
-       if ( this.computePosition && this.computePosition().bottom !== '' ) {
+       if ( this.computePosition && this.positioning && this.computePosition().bottom !== '' ) {
                return 'bottom';
        }
        return 'top';
index 9f48204..19b51eb 100644 (file)
@@ -760,11 +760,6 @@ table.floatleft {
        vertical-align: baseline;
        /* Reset line-height; headings tend to have it set to larger values */
        line-height: 1em;
-       /* As .mw-editsection is a <span> (inline element), it is treated as part */
-       /* of the heading content when selecting text by multiple clicks and thus */
-       /* selected together with heading content, despite the user-select: none; */
-       /* rule set above. This enforces non-selection without changing the look. */
-       display: inline-block;
 }
 
 /* Correct directionality when page dir is different from site/user dir */
index 22c176f..98acab0 100644 (file)
        mw.rcfilters.ui.MenuSelectWidget.prototype.toggle = function ( show ) {
                this.lazyMenuCreation();
                mw.rcfilters.ui.MenuSelectWidget.parent.prototype.toggle.call( this, show );
+               // Always open this menu downwards. FilterTagMultiselectWidget scrolls it into view.
+               this.setVerticalPosition( 'below' );
        };
 
        /**
         */
        mw.rcfilters.ui.MenuSelectWidget.prototype.onKeyDown = function ( e ) {
                var nextItem,
-                       currentItem = this.getHighlightedItem() || this.getSelectedItem();
+                       currentItem = this.findHighlightedItem() || this.getSelectedItem();
 
                // Call parent
                mw.rcfilters.ui.MenuSelectWidget.parent.prototype.onKeyDown.call( this, e );
index 393ab4a..6a218e3 100644 (file)
                        // If we have an exception object, log it to the warning channel to trigger
                        // proper stacktraces in browsers that support it.
                        if ( e && console.warn ) {
-                               console.warn( String( e ), e );
+                               console.warn( e );
                        }
                }
                /* eslint-enable no-console */
index a5c4688..4d39f7b 100644 (file)
@@ -7,6 +7,8 @@ use MediaWiki\Services\DestructibleService;
 use MediaWiki\Services\SalvageableService;
 use MediaWiki\Services\ServiceDisabledException;
 use MediaWiki\Shell\CommandFactory;
+use MediaWiki\Storage\BlobStore;
+use MediaWiki\Storage\RevisionStore;
 
 /**
  * @covers MediaWiki\MediaWikiServices
@@ -331,6 +333,8 @@ class MediaWikiServicesTest extends MediaWikiTestCase {
                        'LocalServerObjectCache' => [ 'LocalServerObjectCache', BagOStuff::class ],
                        'VirtualRESTServiceClient' => [ 'VirtualRESTServiceClient', VirtualRESTServiceClient::class ],
                        'ShellCommandFactory' => [ 'ShellCommandFactory', CommandFactory::class ],
+                       'BlobStore' => [ 'BlobStore', BlobStore::class ],
+                       'RevisionStore' => [ 'RevisionStore', RevisionStore::class ],
                ];
        }
 
index 91dbf2c..9ab76c8 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\RevisionStore;
+use MediaWiki\Storage\IncompleteRevisionException;
+use MediaWiki\Storage\RevisionRecord;
 
 /**
  * RevisionDbTestBase contains test cases for the Revision class that have Database interactions.
@@ -72,6 +76,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                MWNamespace::clearCaches();
                // Reset namespace cache
                $wgContLang->resetNamespaces();
+
                if ( !$this->testPage ) {
                        /**
                         * We have to create a new page for each subclass as the page creation may result
@@ -102,6 +107,14 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        $props['text'] = 'Lorem Ipsum';
                }
 
+               if ( !isset( $props['user_text'] ) ) {
+                       $props['user_text'] = 'Tester';
+               }
+
+               if ( !isset( $props['user'] ) ) {
+                       $props['user'] = 0;
+               }
+
                if ( !isset( $props['comment'] ) ) {
                        $props['comment'] = 'just a test';
                }
@@ -110,6 +123,10 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        $props['page'] = $this->testPage->getId();
                }
 
+               if ( !isset( $props['content_model'] ) ) {
+                       $props['content_model'] = CONTENT_MODEL_WIKITEXT;
+               }
+
                $rev = new Revision( $props );
 
                $dbw = wfGetDB( DB_MASTER );
@@ -202,14 +219,23 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                $revId = $rev->insertOn( wfGetDB( DB_MASTER ) );
 
                $this->assertInternalType( 'integer', $revId );
-               $this->assertInternalType( 'integer', $rev->getTextId() );
                $this->assertSame( $revId, $rev->getId() );
 
+               // getTextId() must be an int!
+               $this->assertInternalType( 'integer', $rev->getTextId() );
+
+               $mainSlot = $rev->getRevisionRecord()->getSlot( 'main', RevisionRecord::RAW );
+
+               // we currently only support storage in the text table
+               $textId = MediaWikiServices::getInstance()
+                       ->getBlobStore()
+                       ->getTextIdFromAddress( $mainSlot->getAddress() );
+
                $this->assertSelect(
                        'text',
                        [ 'old_id', 'old_text' ],
-                       "old_id = {$rev->getTextId()}",
-                       [ [ strval( $rev->getTextId() ), 'Revision Text' ] ]
+                       "old_id = $textId",
+                       [ [ strval( $textId ), 'Revision Text' ] ]
                );
                $this->assertSelect(
                        'revision',
@@ -228,7 +254,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        [ [
                                strval( $rev->getId() ),
                                strval( $this->testPage->getId() ),
-                               strval( $rev->getTextId() ),
+                               strval( $textId ),
                                '0',
                                '0',
                                '0',
@@ -246,11 +272,12 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                // If an ExternalStore is set don't use it.
                $this->setMwGlobals( 'wgDefaultExternalStore', false );
                $this->setExpectedException(
-                       MWException::class,
-                       "Cannot insert revision: page ID must be nonzero"
+                       IncompleteRevisionException::class,
+                       "rev_page field must not be 0!"
                );
 
-               $rev = new Revision( [] );
+               $title = Title::newFromText( 'Nonexistant-' . __METHOD__ );
+               $rev = new Revision( [], 0, $title );
 
                $rev->insertOn( wfGetDB( DB_MASTER ) );
        }
@@ -321,12 +348,42 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                                return $f + [ 'ar_namespace', 'ar_title' ];
                        },
                ];
+               yield [
+                       function ( $f ) {
+                               unset( $f['ar_text'] );
+                               return $f;
+                       },
+               ];
                yield [
                        function ( $f ) {
                                unset( $f['ar_text_id'] );
                                return $f;
                        },
                ];
+               yield [
+                       function ( $f ) {
+                               unset( $f['ar_page_id'] );
+                               return $f;
+                       },
+               ];
+               yield [
+                       function ( $f ) {
+                               unset( $f['ar_parent_id'] );
+                               return $f;
+                       },
+               ];
+               yield [
+                       function ( $f ) {
+                               unset( $f['ar_rev_id'] );
+                               return $f;
+                       },
+               ];
+               yield [
+                       function ( $f ) {
+                               unset( $f['ar_sha1'] );
+                               return $f;
+                       },
+               ];
        }
 
        /**
@@ -334,6 +391,17 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
         * @covers Revision::newFromArchiveRow
         */
        public function testNewFromArchiveRow( $selectModifier ) {
+               $services = MediaWikiServices::getInstance();
+
+               $store = new RevisionStore(
+                       $services->getDBLoadBalancer(),
+                       $services->getService( '_SqlBlobStore' ),
+                       $services->getMainWANObjectCache()
+               );
+
+               $store->setContentHandlerUseDB( $this->getContentHandlerUseDB() );
+               $this->setService( 'RevisionStore', $store );
+
                $page = $this->createPage(
                        'RevisionStorageTest_testNewFromArchiveRow',
                        'Lorem Ipsum',
@@ -354,6 +422,8 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                $row = $res->fetchObject();
                $res->free();
 
+               // MCR migration note: $row is now required to contain ar_title and ar_namespace.
+               // Alternatively, a Title object can be passed to RevisionStore::newRevisionFromArchiveRow
                $rev = Revision::newFromArchiveRow( $row );
 
                $this->assertRevEquals( $orig, $rev );
@@ -382,7 +452,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                $row = $res->fetchObject();
                $res->free();
 
-               $rev = Revision::newFromArchiveRow( $row, [ 'comment' => 'SOMEOVERRIDE' ] );
+               $rev = Revision::newFromArchiveRow( $row, [ 'comment_text' => 'SOMEOVERRIDE' ] );
 
                $this->assertNotEquals( $orig->getComment(), $rev->getComment() );
                $this->assertEquals( 'SOMEOVERRIDE', $rev->getComment() );
@@ -426,7 +496,8 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
         * @covers Revision::newFromPageId
         */
        public function testNewFromPageIdWithNotLatestId() {
-               $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
+               $content = new WikitextContent( __METHOD__ );
+               $this->testPage->doEditContent( $content, __METHOD__ );
                $rev = Revision::newFromPageId(
                        $this->testPage->getId(),
                        $this->testPage->getRevision()->getPrevious()->getId()
@@ -447,6 +518,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
                $id = $this->testPage->getRevision()->getId();
 
+               $this->hideDeprecated( 'Revision::fetchRevision' );
                $res = Revision::fetchRevision( $this->testPage->getTitle() );
 
                # note: order is unspecified
@@ -455,8 +527,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        $rows[$row->rev_id] = $row;
                }
 
-               $this->assertEquals( 1, count( $rows ), 'expected exactly one revision' );
-               $this->assertArrayHasKey( $id, $rows, 'missing revision with id ' . $id );
+               $this->assertEmpty( $rows, 'expected empty set' );
        }
 
        /**
@@ -541,6 +612,10 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        'new null revision should have a different id from the original revision' );
                $this->assertEquals( $orig->getTextId(), $rev->getTextId(),
                        'new null revision should have the same text id as the original revision' );
+               $this->assertEquals( $orig->getSha1(), $rev->getSha1(),
+                       'new null revision should have the same SHA1 as the original revision' );
+               $this->assertTrue( $orig->getRevisionRecord()->hasSameContent( $rev->getRevisionRecord() ),
+                       'new null revision should have the same content as the original revision' );
                $this->assertEquals( __METHOD__, $rev->getContent()->getNativeData() );
        }
 
@@ -606,7 +681,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        'user' => $userA->getId(),
                        'text' => 'zero',
                        'content_model' => CONTENT_MODEL_WIKITEXT,
-                       'summary' => 'edit zero'
+                       'comment' => 'edit zero'
                ] );
                $revisions[0]->insertOn( $dbw );
 
@@ -618,7 +693,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        'user' => $userA->getId(),
                        'text' => 'one',
                        'content_model' => CONTENT_MODEL_WIKITEXT,
-                       'summary' => 'edit one'
+                       'comment' => 'edit one'
                ] );
                $revisions[1]->insertOn( $dbw );
 
@@ -629,7 +704,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        'user' => $userB->getId(),
                        'text' => 'two',
                        'content_model' => CONTENT_MODEL_WIKITEXT,
-                       'summary' => 'edit two'
+                       'comment' => 'edit two'
                ] );
                $revisions[2]->insertOn( $dbw );
 
@@ -640,7 +715,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        'user' => $userA->getId(),
                        'text' => 'three',
                        'content_model' => CONTENT_MODEL_WIKITEXT,
-                       'summary' => 'edit three'
+                       'comment' => 'edit three'
                ] );
                $revisions[3]->insertOn( $dbw );
 
@@ -651,13 +726,24 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        'user' => $userA->getId(),
                        'text' => 'zero',
                        'content_model' => CONTENT_MODEL_WIKITEXT,
-                       'summary' => 'edit four'
+                       'comment' => 'edit four'
                ] );
                $revisions[4]->insertOn( $dbw );
 
                // test it ---------------------------------
                $since = $revisions[$sinceIdx]->getTimestamp();
 
+               $allRows = iterator_to_array( $dbw->select(
+                       'revision',
+                       [ 'rev_id', 'rev_timestamp', 'rev_user' ],
+                       [
+                               'rev_page' => $page->getId(),
+                               //'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $since ) )
+                       ],
+                       __METHOD__,
+                       [ 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 50 ]
+               ) );
+
                $wasLast = Revision::userWasLastToEdit( $dbw, $page->getId(), $userA->getId(), $since );
 
                $this->assertEquals( $expectedLast, $wasLast );
@@ -805,12 +891,16 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        'text_id' => 123456789, // not in the test DB
                ] );
 
+               MediaWiki\suppressWarnings(); // bad text_id will trigger a warning.
+
                $this->assertNull( $rev->getContent(),
                        "getContent() should return null if the revision's text blob could not be loaded." );
 
                // NOTE: check this twice, once for lazy initialization, and once with the cached value.
                $this->assertNull( $rev->getContent(),
                        "getContent() should return null if the revision's text blob could not be loaded." );
+
+               MediaWiki\suppressWarnings( 'end' );
        }
 
        public function provideGetSize() {
@@ -904,6 +994,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
         */
        public function testLoadFromId() {
                $rev = $this->testPage->getRevision();
+               $this->hideDeprecated( 'Revision::loadFromId' );
                $this->assertRevEquals(
                        $rev,
                        Revision::loadFromId( wfGetDB( DB_MASTER ), $rev->getId() )
@@ -1026,7 +1117,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                $rev[1] = $this->testPage->getLatest();
 
                $this->assertSame(
-                       [ $rev[1] => strval( $textLength ) ],
+                       [ $rev[1] => $textLength ],
                        Revision::getParentLengths(
                                wfGetDB( DB_MASTER ),
                                [ $rev[1] ]
@@ -1049,7 +1140,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                $rev[2] = $this->testPage->getLatest();
 
                $this->assertSame(
-                       [ $rev[1] => strval( $textOneLength ), $rev[2] => strval( $textTwoLength ) ],
+                       [ $rev[1] => $textOneLength, $rev[2] => $textTwoLength ],
                        Revision::getParentLengths(
                                wfGetDB( DB_MASTER ),
                                [ $rev[1], $rev[2] ]
@@ -1080,14 +1171,6 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                );
        }
 
-       /**
-        * @covers Revision::getTitle
-        */
-       public function testGetTitle_forBadRevision() {
-               $rev = new Revision( [] );
-               $this->assertNull( $rev->getTitle() );
-       }
-
        /**
         * @covers Revision::isMinor
         */
@@ -1263,14 +1346,21 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                $rev = $this->testPage->getRevision();
 
                // Clear any previous cache for the revision during creation
-               $key = $cache->makeGlobalKey( 'revision', $db->getDomainID(), $rev->getPage(), $rev->getId() );
+               $key = $cache->makeGlobalKey( 'revision-row-1.29',
+                       $db->getDomainID(),
+                       $rev->getPage(),
+                       $rev->getId()
+               );
                $cache->delete( $key, WANObjectCache::HOLDOFF_NONE );
                $this->assertFalse( $cache->get( $key ) );
 
                // Get the new revision and make sure it is in the cache and correct
                $newRev = Revision::newKnownCurrent( $db, $rev->getPage(), $rev->getId() );
                $this->assertRevEquals( $rev, $newRev );
-               $this->assertRevEquals( $rev, $cache->get( $key ) );
+
+               $cachedRow = $cache->get( $key );
+               $this->assertNotFalse( $cachedRow );
+               $this->assertEquals( $rev->getId(), $cachedRow->rev_id );
        }
 
        public function provideUserCanBitfield() {
@@ -1377,7 +1467,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
                        ]
                );
                $user = $this->getTestUser( $userGroups )->getUser();
-               $revision = new Revision( [ 'deleted' => $bitField ] );
+               $revision = new Revision( [ 'deleted' => $bitField ], 0, $this->testPage->getTitle() );
 
                $this->assertSame(
                        $expected,
index 3d0556e..b7f1a47 100644 (file)
@@ -1,6 +1,9 @@
 <?php
 
-use Wikimedia\TestingAccessWrapper;
+use MediaWiki\Storage\RevisionStore;
+use MediaWiki\Storage\SqlBlobStore;
+use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\LoadBalancer;
 
 /**
  * Test cases in RevisionTest should not interact with the Database.
@@ -20,6 +23,35 @@ class RevisionTest extends MediaWikiTestCase {
                                'content' => new JavaScriptContent( 'hellow world.' )
                        ],
                ];
+               // FIXME: test with and without user ID, and with a user object.
+               // We can't prepare that here though, since we don't yet have a dummy DB
+       }
+
+       /**
+        * @param string $model
+        * @return Title
+        */
+       public function getMockTitle( $model = CONTENT_MODEL_WIKITEXT ) {
+               $mock = $this->getMockBuilder( Title::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $mock->expects( $this->any() )
+                       ->method( 'getNamespace' )
+                       ->will( $this->returnValue( $this->getDefaultWikitextNS() ) );
+               $mock->expects( $this->any() )
+                       ->method( 'getPrefixedText' )
+                       ->will( $this->returnValue( 'RevisionTest' ) );
+               $mock->expects( $this->any() )
+                       ->method( 'getDBKey' )
+                       ->will( $this->returnValue( 'RevisionTest' ) );
+               $mock->expects( $this->any() )
+                       ->method( 'getArticleID' )
+                       ->will( $this->returnValue( 23 ) );
+               $mock->expects( $this->any() )
+                       ->method( 'getModel' )
+                       ->will( $this->returnValue( $model ) );
+
+               return $mock;
        }
 
        /**
@@ -27,13 +59,22 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::__construct
         * @covers Revision::constructFromRowArray
         */
-       public function testConstructFromArray( array $rowArray ) {
-               $rev = new Revision( $rowArray );
+       public function testConstructFromArray( $rowArray ) {
+               $rev = new Revision( $rowArray, 0, $this->getMockTitle() );
                $this->assertNotNull( $rev->getContent(), 'no content object available' );
                $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContent()->getModel() );
                $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() );
        }
 
+       /**
+        * @covers Revision::__construct
+        * @covers Revision::constructFromRowArray
+        */
+       public function testConstructFromEmptyArray() {
+               $rev = new Revision( [], 0, $this->getMockTitle() );
+               $this->assertNull( $rev->getContent(), 'no content object should be available' );
+       }
+
        public function provideConstructFromArray_userSetAsExpected() {
                yield 'no user defaults to wgUser' => [
                        [
@@ -52,24 +93,14 @@ class RevisionTest extends MediaWikiTestCase {
                        99,
                        'SomeTextUserName',
                ];
-               // Note: the below XXX test cases are odd and probably result in unexpected behaviour if used
-               // in production code.
-               yield 'XXX: user text only' => [
+               yield 'user text only' => [
                        [
                                'content' => new JavaScriptContent( 'hello world.' ),
                                'user_text' => '111.111.111.111',
                        ],
-                       null,
+                       0,
                        '111.111.111.111',
                ];
-               yield 'XXX: user id only' => [
-                       [
-                               'content' => new JavaScriptContent( 'hello world.' ),
-                               'user' => 9989,
-                       ],
-                       9989,
-                       null,
-               ];
        }
 
        /**
@@ -95,7 +126,7 @@ class RevisionTest extends MediaWikiTestCase {
                        $expectedUserName = $testUser->getName();
                }
 
-               $rev = new Revision( $rowArray );
+               $rev = new Revision( $rowArray, 0, $this->getMockTitle() );
                $this->assertEquals( $expectedUserId, $rev->getUser() );
                $this->assertEquals( $expectedUserName, $rev->getUserText() );
        }
@@ -105,28 +136,37 @@ class RevisionTest extends MediaWikiTestCase {
                        [
                                'content' => new WikitextContent( 'GOAT' ),
                                'text_id' => 'someid',
-                               ],
+                       ],
                        new MWException( "Text already stored in external store (id someid), " .
                                "can't serialize content object" )
                ];
+               yield 'unknown user id and no user name' => [
+                       [
+                               'content' => new JavaScriptContent( 'hello world.' ),
+                               'user' => 9989,
+                       ],
+                       new MWException( 'user_text not given, and unknown user ID 9989' )
+               ];
                yield 'with bad content object (class)' => [
                        [ 'content' => new stdClass() ],
-                       new MWException( '`content` field must contain a Content object.' )
+                       new MWException( 'content field must contain a Content object.' )
                ];
                yield 'with bad content object (string)' => [
                        [ 'content' => 'ImAGoat' ],
-                       new MWException( '`content` field must contain a Content object.' )
+                       new MWException( 'content field must contain a Content object.' )
                ];
                yield 'bad row format' => [
                        'imastring, not a row',
-                       new MWException( 'Revision constructor passed invalid row format.' )
+                       new InvalidArgumentException(
+                               '$row must be a row object, an associative array, or a RevisionRecord'
+                       )
                ];
        }
 
        /**
         * @dataProvider provideConstructFromArrayThrowsExceptions
         * @covers Revision::__construct
-        * @covers Revision::constructFromRowArray
+        * @covers RevisionStore::newMutableRevisionFromArray
         */
        public function testConstructFromArrayThrowsExceptions( $rowArray, Exception $expectedException ) {
                $this->setExpectedException(
@@ -134,14 +174,25 @@ class RevisionTest extends MediaWikiTestCase {
                        $expectedException->getMessage(),
                        $expectedException->getCode()
                );
-               new Revision( $rowArray );
+               new Revision( $rowArray, 0, $this->getMockTitle() );
+       }
+
+       /**
+        * @covers Revision::__construct
+        * @covers RevisionStore::newMutableRevisionFromArray
+        */
+       public function testConstructFromNothing() {
+               $this->setExpectedException(
+                       InvalidArgumentException::class
+               );
+               new Revision( [] );
        }
 
        public function provideConstructFromRow() {
                yield 'Full construction' => [
                        [
-                               'rev_id' => '2',
-                               'rev_page' => '1',
+                               'rev_id' => '42',
+                               'rev_page' => '23',
                                'rev_text_id' => '2',
                                'rev_timestamp' => '20171017114835',
                                'rev_user_text' => '127.0.0.1',
@@ -158,8 +209,8 @@ class RevisionTest extends MediaWikiTestCase {
                                'rev_content_model' => 'GOATMODEL',
                        ],
                        function ( RevisionTest $testCase, Revision $rev ) {
-                               $testCase->assertSame( 2, $rev->getId() );
-                               $testCase->assertSame( 1, $rev->getPage() );
+                               $testCase->assertSame( 42, $rev->getId() );
+                               $testCase->assertSame( 23, $rev->getPage() );
                                $testCase->assertSame( 2, $rev->getTextId() );
                                $testCase->assertSame( '20171017114835', $rev->getTimestamp() );
                                $testCase->assertSame( '127.0.0.1', $rev->getUserText() );
@@ -174,10 +225,10 @@ class RevisionTest extends MediaWikiTestCase {
                                $testCase->assertSame( 'GOATMODEL', $rev->getContentModel() );
                        }
                ];
-               yield 'null fields' => [
+               yield 'default field values' => [
                        [
-                               'rev_id' => '2',
-                               'rev_page' => '1',
+                               'rev_id' => '42',
+                               'rev_page' => '23',
                                'rev_text_id' => '2',
                                'rev_timestamp' => '20171017114835',
                                'rev_user_text' => '127.0.0.1',
@@ -189,11 +240,24 @@ class RevisionTest extends MediaWikiTestCase {
                                'rev_comment_cid' => null,
                        ],
                        function ( RevisionTest $testCase, Revision $rev ) {
-                               $testCase->assertNull( $rev->getSize() );
-                               $testCase->assertNull( $rev->getParentId() );
-                               $testCase->assertNull( $rev->getSha1() );
-                               $testCase->assertSame( 'text/x-wiki', $rev->getContentFormat() );
-                               $testCase->assertSame( 'wikitext', $rev->getContentModel() );
+                               // parent ID may be null
+                               $testCase->assertSame( null, $rev->getParentId(), 'revision id' );
+
+                               // given fields
+                               $testCase->assertSame( $rev->getTimestamp(), '20171017114835', 'timestamp' );
+                               $testCase->assertSame( $rev->getUserText(), '127.0.0.1', 'user name' );
+                               $testCase->assertSame( $rev->getUser(), 0, 'user id' );
+                               $testCase->assertSame( $rev->getComment(), 'Goat Comment!' );
+                               $testCase->assertSame( false, $rev->isMinor(), 'minor edit' );
+                               $testCase->assertSame( 0, $rev->getVisibility(), 'visibility flags' );
+
+                               // computed fields
+                               $testCase->assertNotNull( $rev->getSize(), 'size' );
+                               $testCase->assertNotNull( $rev->getSha1(), 'hash' );
+
+                               // NOTE: model and format will be detected based on the namespace of the (mock) title
+                               $testCase->assertSame( 'text/x-wiki', $rev->getContentFormat(), 'format' );
+                               $testCase->assertSame( 'wikitext', $rev->getContentModel(), 'model' );
                        }
                ];
        }
@@ -201,11 +265,34 @@ class RevisionTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideConstructFromRow
         * @covers Revision::__construct
-        * @covers Revision::constructFromDbRowObject
+        * @covers RevisionStore::newRevisionFromRow
         */
        public function testConstructFromRow( array $arrayData, $assertions ) {
+               $data = 'Hello goat.'; // needs to match model and format
+
+               $blobStore = $this->getMockBuilder( SqlBlobStore::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+
+               $blobStore->method( 'getBlob' )
+                       ->will( $this->returnValue( $data ) );
+
+               $blobStore->method( 'getTextIdFromAddress' )
+                       ->will( $this->returnCallback(
+                               function ( $address ) {
+                                       // Turn "tt:1234" into 12345.
+                                       // Note that this must be functional so we can test getTextId().
+                                       // Ideally, we'd un-mock getTextIdFromAddress and use its actual implementation.
+                                       $parts = explode( ':', $address );
+                                       return (int)array_pop( $parts );
+                               }
+                       ) );
+
+               // Note override internal service, so RevisionStore uses it as well.
+               $this->setService( '_SqlBlobStore', $blobStore );
+
                $row = (object)$arrayData;
-               $rev = new Revision( $row );
+               $rev = new Revision( $row, 0, $this->getMockTitle() );
                $assertions( $this, $rev );
        }
 
@@ -235,7 +322,7 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::getId
         */
        public function testGetId( $rowArray, $expectedId ) {
-               $rev = new Revision( $rowArray );
+               $rev = new Revision( $rowArray, 0, $this->getMockTitle() );
                $this->assertEquals( $expectedId, $rev->getId() );
        }
 
@@ -249,7 +336,7 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::setId
         */
        public function testSetId( $input, $expected ) {
-               $rev = new Revision( [] );
+               $rev = new Revision( [], 0, $this->getMockTitle() );
                $rev->setId( $input );
                $this->assertSame( $expected, $rev->getId() );
        }
@@ -264,7 +351,7 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::setUserIdAndName
         */
        public function testSetUserIdAndName( $inputId, $expectedId, $name ) {
-               $rev = new Revision( [] );
+               $rev = new Revision( [], 0, $this->getMockTitle() );
                $rev->setUserIdAndName( $inputId, $name );
                $this->assertSame( $expectedId, $rev->getUser( Revision::RAW ) );
                $this->assertEquals( $name, $rev->getUserText( Revision::RAW ) );
@@ -281,7 +368,7 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::getTextId()
         */
        public function testGetTextId( $rowArray, $expected ) {
-               $rev = new Revision( $rowArray );
+               $rev = new Revision( $rowArray, 0, $this->getMockTitle() );
                $this->assertSame( $expected, $rev->getTextId() );
        }
 
@@ -296,7 +383,7 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::getParentId()
         */
        public function testGetParentId( $rowArray, $expected ) {
-               $rev = new Revision( $rowArray );
+               $rev = new Revision( $rowArray, 0, $this->getMockTitle() );
                $this->assertSame( $expected, $rev->getParentId() );
        }
 
@@ -329,9 +416,44 @@ class RevisionTest extends MediaWikiTestCase {
                $this->testGetRevisionText( $expected, $rowData );
        }
 
+       private function getWANObjectCache() {
+               return new WANObjectCache( [ 'cache' => new HashBagOStuff() ] );
+       }
+
+       /**
+        * @return SqlBlobStore
+        */
+       private function getBlobStore() {
+               /** @var LoadBalancer $lb */
+               $lb = $this->getMockBuilder( LoadBalancer::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+
+               $cache = $this->getWANObjectCache();
+
+               $blobStore = new SqlBlobStore( $lb, $cache );
+               return $blobStore;
+       }
+
+       /**
+        * @return RevisionStore
+        */
+       private function getRevisionStore() {
+               /** @var LoadBalancer $lb */
+               $lb = $this->getMockBuilder( LoadBalancer::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+
+               $cache = $this->getWANObjectCache();
+
+               $blobStore = new RevisionStore( $lb, $this->getBlobStore(), $cache );
+               return $blobStore;
+       }
+
        public function provideGetRevisionTextWithLegacyEncoding() {
                yield 'Utf8Native' => [
                        "Wiki est l'\xc3\xa9cole superieur !",
+                       'fr',
                        'iso-8859-1',
                        [
                                'old_flags' => 'utf-8',
@@ -340,6 +462,7 @@ class RevisionTest extends MediaWikiTestCase {
                ];
                yield 'Utf8Legacy' => [
                        "Wiki est l'\xc3\xa9cole superieur !",
+                       'fr',
                        'iso-8859-1',
                        [
                                'old_flags' => '',
@@ -352,8 +475,11 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::getRevisionText
         * @dataProvider provideGetRevisionTextWithLegacyEncoding
         */
-       public function testGetRevisionWithLegacyEncoding( $expected, $encoding, $rowData ) {
-               $this->setMwGlobals( 'wgLegacyEncoding', $encoding );
+       public function testGetRevisionWithLegacyEncoding( $expected, $lang, $encoding, $rowData ) {
+               $blobStore = $this->getBlobStore();
+               $blobStore->setLegacyEncoding( $encoding, Language::factory( $lang ) );
+               $this->setService( 'BlobStore', $blobStore );
+
                $this->testGetRevisionText( $expected, $rowData );
        }
 
@@ -365,6 +491,7 @@ class RevisionTest extends MediaWikiTestCase {
                 */
                yield 'Utf8NativeGzip' => [
                        "Wiki est l'\xc3\xa9cole superieur !",
+                       'fr',
                        'iso-8859-1',
                        [
                                'old_flags' => 'gzip,utf-8',
@@ -373,6 +500,7 @@ class RevisionTest extends MediaWikiTestCase {
                ];
                yield 'Utf8LegacyGzip' => [
                        "Wiki est l'\xc3\xa9cole superieur !",
+                       'fr',
                        'iso-8859-1',
                        [
                                'old_flags' => 'gzip',
@@ -385,9 +513,13 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::getRevisionText
         * @dataProvider provideGetRevisionTextWithGzipAndLegacyEncoding
         */
-       public function testGetRevisionWithGzipAndLegacyEncoding( $expected, $encoding, $rowData ) {
+       public function testGetRevisionWithGzipAndLegacyEncoding( $expected, $lang, $encoding, $rowData ) {
                $this->checkPHPExtension( 'zlib' );
-               $this->setMwGlobals( 'wgLegacyEncoding', $encoding );
+
+               $blobStore = $this->getBlobStore();
+               $blobStore->setLegacyEncoding( $encoding, Language::factory( $lang ) );
+               $this->setService( 'BlobStore', $blobStore );
+
                $this->testGetRevisionText( $expected, $rowData );
        }
 
@@ -413,7 +545,10 @@ class RevisionTest extends MediaWikiTestCase {
         */
        public function testCompressRevisionTextUtf8Gzip() {
                $this->checkPHPExtension( 'zlib' );
-               $this->setMwGlobals( 'wgCompressRevisions', true );
+
+               $blobStore = $this->getBlobStore();
+               $blobStore->setCompressBlobs( true );
+               $this->setService( 'BlobStore', $blobStore );
 
                $row = new stdClass;
                $row->old_text = "Wiki est l'\xc3\xa9cole superieur !";
@@ -428,20 +563,41 @@ class RevisionTest extends MediaWikiTestCase {
                        Revision::getRevisionText( $row ), "getRevisionText" );
        }
 
-       public function provideFetchFromConds() {
-               yield [ 0, [] ];
-               yield [ Revision::READ_LOCKING, [ 'FOR UPDATE' ] ];
-       }
-
        /**
-        * @dataProvider provideFetchFromConds
-        * @covers Revision::fetchFromConds
+        * @covers Revision::loadFromTitle
         */
-       public function testFetchFromConds( $flags, array $options ) {
-               $this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', MIGRATION_OLD );
-               $conditions = [ 'conditionsArray' ];
+       public function testLoadFromTitle() {
+               $title = $this->getMockTitle();
+
+               $conditions = [
+                       'rev_id=page_latest',
+                       'page_namespace' => $title->getNamespace(),
+                       'page_title' => $title->getDBkey()
+               ];
+
+               $row = (object)[
+                       'rev_id' => '42',
+                       'rev_page' => $title->getArticleID(),
+                       'rev_text_id' => '2',
+                       'rev_timestamp' => '20171017114835',
+                       'rev_user_text' => '127.0.0.1',
+                       'rev_user' => '0',
+                       'rev_minor_edit' => '0',
+                       'rev_deleted' => '0',
+                       'rev_len' => '46',
+                       'rev_parent_id' => '1',
+                       'rev_sha1' => 'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
+                       'rev_comment_text' => 'Goat Comment!',
+                       'rev_comment_data' => null,
+                       'rev_comment_cid' => null,
+                       'rev_content_format' => 'GOATFORMAT',
+                       'rev_content_model' => 'GOATMODEL',
+               ];
 
                $db = $this->getMock( IDatabase::class );
+               $db->expects( $this->any() )
+                       ->method( 'getDomainId' )
+                       ->will( $this->returnValue( wfWikiID() ) );
                $db->expects( $this->once() )
                        ->method( 'selectRow' )
                        ->with(
@@ -450,17 +606,24 @@ class RevisionTest extends MediaWikiTestCase {
                                $this->isType( 'array' ),
                                $this->equalTo( $conditions ),
                                // Method name
-                               $this->equalTo( 'Revision::fetchFromConds' ),
-                               $this->equalTo( $options ),
+                               $this->stringContains( 'fetchRevisionRowFromConds' ),
+                               // We don't really care about the options here
+                               $this->isType( 'array' ),
                                // We don't really care about the join conds are they come from the joinCond methods
                                $this->isType( 'array' )
                        )
-                       ->willReturn( 'RETURNVALUE' );
+                       ->willReturn( $row );
 
-               $wrapper = TestingAccessWrapper::newFromClass( Revision::class );
-               $result = $wrapper->fetchFromConds( $db, $conditions, $flags );
+               $revision = Revision::loadFromTitle( $db, $title );
 
-               $this->assertEquals( 'RETURNVALUE', $result );
+               $this->assertEquals( $title->getArticleID(), $revision->getTitle()->getArticleID() );
+               $this->assertEquals( $row->rev_id, $revision->getId() );
+               $this->assertEquals( $row->rev_len, $revision->getSize() );
+               $this->assertEquals( $row->rev_sha1, $revision->getSha1() );
+               $this->assertEquals( $row->rev_parent_id, $revision->getParentId() );
+               $this->assertEquals( $row->rev_timestamp, $revision->getTimestamp() );
+               $this->assertEquals( $row->rev_comment_text, $revision->getComment() );
+               $this->assertEquals( $row->rev_user_text, $revision->getUserText() );
        }
 
        public function provideDecompressRevisionText() {
@@ -491,25 +654,25 @@ class RevisionTest extends MediaWikiTestCase {
                ];
                yield '(ISO-8859-1 encoding), string in string out' => [
                        'ISO-8859-1',
-                       iconv( 'utf8', 'ISO-8859-1', "1®Àþ1" ),
+                       iconv( 'utf-8', 'ISO-8859-1', "1®Àþ1" ),
                        [],
                        '1®Àþ1',
                ];
                yield '(ISO-8859-1 encoding), serialized object in with gzip flags returns string' => [
                        'ISO-8859-1',
-                       gzdeflate( iconv( 'utf8', 'ISO-8859-1', "4®Àþ4" ) ),
+                       gzdeflate( iconv( 'utf-8', 'ISO-8859-1', "4®Àþ4" ) ),
                        [ 'gzip' ],
                        '4®Àþ4',
                ];
                yield '(ISO-8859-1 encoding), serialized object in with object flags returns string' => [
                        'ISO-8859-1',
-                       serialize( new TitleValue( 0, iconv( 'utf8', 'ISO-8859-1', "3®Àþ3" ) ) ),
+                       serialize( new TitleValue( 0, iconv( 'utf-8', 'ISO-8859-1', "3®Àþ3" ) ) ),
                        [ 'object' ],
                        '3®Àþ3',
                ];
                yield '(ISO-8859-1 encoding), serialized object in with object & gzip flags returns string' => [
                        'ISO-8859-1',
-                       gzdeflate( serialize( new TitleValue( 0, iconv( 'utf8', 'ISO-8859-1', "2®Àþ2" ) ) ) ),
+                       gzdeflate( serialize( new TitleValue( 0, iconv( 'utf-8', 'ISO-8859-1', "2®Àþ2" ) ) ) ),
                        [ 'gzip', 'object' ],
                        '2®Àþ2',
                ];
@@ -525,8 +688,12 @@ class RevisionTest extends MediaWikiTestCase {
         * @param mixed $expected
         */
        public function testDecompressRevisionText( $legacyEncoding, $text, $flags, $expected ) {
-               $this->setMwGlobals( 'wgLegacyEncoding', $legacyEncoding );
-               $this->setMwGlobals( 'wgLanguageCode', 'en' );
+               $blobStore = $this->getBlobStore();
+               if ( $legacyEncoding ) {
+                       $blobStore->setLegacyEncoding( $legacyEncoding, Language::factory( 'en' ) );
+               }
+
+               $this->setService( 'BlobStore', $blobStore );
                $this->assertSame(
                        $expected,
                        Revision::decompressRevisionText( $text, $flags )
@@ -622,14 +789,20 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::getRevisionText
         */
        public function testGetRevisionText_external_oldId() {
-               $cache = new WANObjectCache( [ 'cache' => new HashBagOStuff() ] );
+               $cache = $this->getWANObjectCache();
                $this->setService( 'MainWANObjectCache', $cache );
+
                $this->setService(
                        'ExternalStoreFactory',
                        new ExternalStoreFactory( [ 'ForTesting' ] )
                );
 
-               $cacheKey = $cache->makeKey( 'revisiontext', 'textid', '7777' );
+               $lb = $this->getMockBuilder( LoadBalancer::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+
+               $blobStore = new SqlBlobStore( $lb, $cache );
+               $this->setService( 'BlobStore', $blobStore );
 
                $this->assertSame(
                        'AAAABBAAA',
@@ -641,6 +814,8 @@ class RevisionTest extends MediaWikiTestCase {
                                ]
                        )
                );
+
+               $cacheKey = $cache->makeKey( 'revisiontext', 'textid', 'tt:7777' );
                $this->assertSame( 'AAAABBAAA', $cache->get( $cacheKey ) );
        }
 
@@ -836,6 +1011,8 @@ class RevisionTest extends MediaWikiTestCase {
                                'fields' => [
                                        'ar_id',
                                        'ar_page_id',
+                                       'ar_namespace',
+                                       'ar_title',
                                        'ar_rev_id',
                                        'ar_text',
                                        'ar_text_id',
@@ -864,6 +1041,8 @@ class RevisionTest extends MediaWikiTestCase {
                                'fields' => [
                                        'ar_id',
                                        'ar_page_id',
+                                       'ar_namespace',
+                                       'ar_title',
                                        'ar_rev_id',
                                        'ar_text',
                                        'ar_text_id',
@@ -897,6 +1076,8 @@ class RevisionTest extends MediaWikiTestCase {
                                'fields' => [
                                        'ar_id',
                                        'ar_page_id',
+                                       'ar_namespace',
+                                       'ar_title',
                                        'ar_rev_id',
                                        'ar_text',
                                        'ar_text_id',
@@ -933,6 +1114,8 @@ class RevisionTest extends MediaWikiTestCase {
                                'fields' => [
                                        'ar_id',
                                        'ar_page_id',
+                                       'ar_namespace',
+                                       'ar_title',
                                        'ar_rev_id',
                                        'ar_text',
                                        'ar_text_id',
@@ -969,6 +1152,8 @@ class RevisionTest extends MediaWikiTestCase {
                                'fields' => [
                                        'ar_id',
                                        'ar_page_id',
+                                       'ar_namespace',
+                                       'ar_title',
                                        'ar_rev_id',
                                        'ar_text',
                                        'ar_text_id',
@@ -1000,6 +1185,11 @@ class RevisionTest extends MediaWikiTestCase {
         */
        public function testGetArchiveQueryInfo( $globals, $expected ) {
                $this->setMwGlobals( $globals );
+
+               $revisionStore = $this->getRevisionStore();
+               $revisionStore->setContentHandlerUseDB( $globals['wgContentHandlerUseDB'] );
+               $this->setService( 'RevisionStore', $revisionStore );
+
                $this->assertEquals(
                        $expected,
                        Revision::getArchiveQueryInfo()
@@ -1351,6 +1541,11 @@ class RevisionTest extends MediaWikiTestCase {
         */
        public function testGetQueryInfo( $globals, $options, $expected ) {
                $this->setMwGlobals( $globals );
+
+               $revisionStore = $this->getRevisionStore();
+               $revisionStore->setContentHandlerUseDB( $globals['wgContentHandlerUseDB'] );
+               $this->setService( 'RevisionStore', $revisionStore );
+
                $this->assertEquals(
                        $expected,
                        Revision::getQueryInfo( $options )
diff --git a/tests/phpunit/includes/Storage/MutableRevisionRecordTest.php b/tests/phpunit/includes/Storage/MutableRevisionRecordTest.php
new file mode 100644 (file)
index 0000000..79cac5e
--- /dev/null
@@ -0,0 +1,120 @@
+<?php
+
+namespace MediaWiki\Tests\Storage;
+
+use CommentStoreComment;
+use MediaWiki\Storage\MutableRevisionRecord;
+use MediaWiki\Storage\RevisionAccessException;
+use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Storage\SlotRecord;
+use MediaWikiTestCase;
+use Title;
+use WikitextContent;
+
+/**
+ * @covers \MediaWiki\Storage\MutableRevisionRecord
+ */
+class MutableRevisionRecordTest extends MediaWikiTestCase {
+
+       public function testSimpleSetGetId() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->assertNull( $record->getId() );
+               $record->setId( 888 );
+               $this->assertSame( 888, $record->getId() );
+       }
+
+       public function testSimpleSetGetUser() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $user = $this->getTestSysop()->getUser();
+               $this->assertNull( $record->getUser() );
+               $record->setUser( $user );
+               $this->assertSame( $user, $record->getUser() );
+       }
+
+       public function testSimpleSetGetPageId() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->assertSame( 0, $record->getPageId() );
+               $record->setPageId( 999 );
+               $this->assertSame( 999, $record->getPageId() );
+       }
+
+       public function testSimpleSetGetParentId() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->assertNull( $record->getParentId() );
+               $record->setParentId( 100 );
+               $this->assertSame( 100, $record->getParentId() );
+       }
+
+       public function testSimpleGetMainContentWhenEmpty() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->setExpectedException( RevisionAccessException::class );
+               $this->assertNull( $record->getContent( 'main' ) );
+       }
+
+       public function testSimpleSetGetMainContent() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $content = new WikitextContent( 'Badger' );
+               $record->setContent( 'main', $content );
+               $this->assertSame( $content, $record->getContent( 'main' ) );
+       }
+
+       public function testSimpleGetSlotWhenEmpty() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->setExpectedException( RevisionAccessException::class );
+               $record->getSlot( 'main' );
+       }
+
+       public function testSimpleSetGetSlot() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $slot = new SlotRecord(
+                       (object)[ 'role_name' => 'main' ],
+                       new WikitextContent( 'x' )
+               );
+               $record->setSlot( $slot );
+               $this->assertSame( $slot, $record->getSlot( 'main' ) );
+       }
+
+       public function testSimpleSetGetMinor() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->assertFalse( $record->isMinor() );
+               $record->setMinorEdit( true );
+               $this->assertSame( true, $record->isMinor() );
+       }
+
+       public function testSimpleSetGetTimestamp() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->assertNull( $record->getTimestamp() );
+               $record->setTimestamp( '20180101010101' );
+               $this->assertSame( '20180101010101', $record->getTimestamp() );
+       }
+
+       public function testSimpleSetGetVisibility() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->assertSame( 0, $record->getVisibility() );
+               $record->setVisibility( RevisionRecord::DELETED_USER );
+               $this->assertSame( RevisionRecord::DELETED_USER, $record->getVisibility() );
+       }
+
+       public function testSimpleSetGetSha1() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->assertSame( 'phoiac9h4m842xq45sp7s6u21eteeq1', $record->getSha1() );
+               $record->setSha1( 'someHash' );
+               $this->assertSame( 'someHash', $record->getSha1() );
+       }
+
+       public function testSimpleSetGetSize() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $this->assertSame( 0, $record->getSize() );
+               $record->setSize( 775 );
+               $this->assertSame( 775, $record->getSize() );
+       }
+
+       public function testSimpleSetGetComment() {
+               $record = new MutableRevisionRecord( Title::newFromText( 'Foo' ) );
+               $comment = new CommentStoreComment( 1, 'foo' );
+               $this->assertNull( $record->getComment() );
+               $record->setComment( $comment );
+               $this->assertSame( $comment, $record->getComment() );
+       }
+
+}
diff --git a/tests/phpunit/includes/Storage/MutableRevisionSlotsTest.php b/tests/phpunit/includes/Storage/MutableRevisionSlotsTest.php
new file mode 100644 (file)
index 0000000..c2a275f
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+
+namespace MediaWiki\Tests\Storage;
+
+use MediaWiki\Storage\MutableRevisionSlots;
+use MediaWiki\Storage\RevisionAccessException;
+use MediaWiki\Storage\SlotRecord;
+use MediaWikiTestCase;
+use WikitextContent;
+
+/**
+ * @covers \MediaWiki\Storage\MutableRevisionSlots
+ */
+class MutableRevisionSlotsTest extends MediaWikiTestCase {
+
+       public function testSetMultipleSlots() {
+               $slots = new MutableRevisionSlots();
+
+               $this->assertSame( [], $slots->getSlots() );
+
+               $slotA = SlotRecord::newUnsaved( 'some', new WikitextContent( 'A' ) );
+               $slots->setSlot( $slotA );
+               $this->assertSame( $slotA, $slots->getSlot( 'some' ) );
+               $this->assertSame( [ 'some' => $slotA ], $slots->getSlots() );
+
+               $slotB = SlotRecord::newUnsaved( 'other', new WikitextContent( 'B' ) );
+               $slots->setSlot( $slotB );
+               $this->assertSame( $slotB, $slots->getSlot( 'other' ) );
+               $this->assertSame( [ 'some' => $slotA, 'other' => $slotB ], $slots->getSlots() );
+       }
+
+       public function testSetExistingSlotOverwritesSlot() {
+               $slots = new MutableRevisionSlots();
+
+               $this->assertSame( [], $slots->getSlots() );
+
+               $slotA = SlotRecord::newUnsaved( 'main', new WikitextContent( 'A' ) );
+               $slots->setSlot( $slotA );
+               $this->assertSame( $slotA, $slots->getSlot( 'main' ) );
+               $this->assertSame( [ 'main' => $slotA ], $slots->getSlots() );
+
+               $slotB = SlotRecord::newUnsaved( 'main', new WikitextContent( 'B' ) );
+               $slots->setSlot( $slotB );
+               $this->assertSame( $slotB, $slots->getSlot( 'main' ) );
+               $this->assertSame( [ 'main' => $slotB ], $slots->getSlots() );
+       }
+
+       public function testSetContentOfExistingSlotOverwritesContent() {
+               $slots = new MutableRevisionSlots();
+
+               $this->assertSame( [], $slots->getSlots() );
+
+               $slotA = SlotRecord::newUnsaved( 'main', new WikitextContent( 'A' ) );
+               $slots->setSlot( $slotA );
+               $this->assertSame( $slotA, $slots->getSlot( 'main' ) );
+               $this->assertSame( [ 'main' => $slotA ], $slots->getSlots() );
+
+               $newContent = new WikitextContent( 'B' );
+               $slots->setContent( 'main', $newContent );
+               $this->assertSame( $newContent, $slots->getContent( 'main' ) );
+       }
+
+       public function testRemoveExistingSlot() {
+               $slotA = SlotRecord::newUnsaved( 'main', new WikitextContent( 'A' ) );
+               $slots = new MutableRevisionSlots( [ $slotA ] );
+
+               $this->assertSame( [ 'main' => $slotA ], $slots->getSlots() );
+
+               $slots->removeSlot( 'main' );
+               $this->assertSame( [], $slots->getSlots() );
+               $this->setExpectedException( RevisionAccessException::class );
+               $slots->getSlot( 'main' );
+       }
+
+}
diff --git a/tests/phpunit/includes/Storage/RevisionRecordTest.php b/tests/phpunit/includes/Storage/RevisionRecordTest.php
new file mode 100644 (file)
index 0000000..ea5f209
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+
+namespace MediaWiki\Tests\Storage;
+
+use MediaWikiTestCase;
+
+/**
+ * @covers \MediaWiki\Storage\RevisionRecord
+ */
+class RevisionRecordTest extends MediaWikiTestCase {
+
+       public function testUserCanBitfield() {
+       }
+
+}
diff --git a/tests/phpunit/includes/Storage/RevisionSlotsTest.php b/tests/phpunit/includes/Storage/RevisionSlotsTest.php
new file mode 100644 (file)
index 0000000..4dfae4b
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+
+namespace MediaWiki\Tests\Storage;
+
+use MediaWiki\Storage\RevisionAccessException;
+use MediaWiki\Storage\RevisionSlots;
+use MediaWiki\Storage\SlotRecord;
+use MediaWikiTestCase;
+use WikitextContent;
+
+class RevisionSlotsTest extends MediaWikiTestCase {
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionSlots::getSlot
+        */
+       public function testGetSlot() {
+               $mainSlot = SlotRecord::newUnsaved( 'main', new WikitextContent( 'A' ) );
+               $auxSlot = SlotRecord::newUnsaved( 'aux', new WikitextContent( 'B' ) );
+               $slots = new RevisionSlots( [ $mainSlot, $auxSlot ] );
+
+               $this->assertSame( $mainSlot, $slots->getSlot( 'main' ) );
+               $this->assertSame( $auxSlot, $slots->getSlot( 'aux' ) );
+               $this->setExpectedException( RevisionAccessException::class );
+               $slots->getSlot( 'nothere' );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionSlots::getContent
+        */
+       public function testGetContent() {
+               $mainContent = new WikitextContent( 'A' );
+               $auxContent = new WikitextContent( 'B' );
+               $mainSlot = SlotRecord::newUnsaved( 'main', $mainContent );
+               $auxSlot = SlotRecord::newUnsaved( 'aux', $auxContent );
+               $slots = new RevisionSlots( [ $mainSlot, $auxSlot ] );
+
+               $this->assertSame( $mainContent, $slots->getContent( 'main' ) );
+               $this->assertSame( $auxContent, $slots->getContent( 'aux' ) );
+               $this->setExpectedException( RevisionAccessException::class );
+               $slots->getContent( 'nothere' );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionSlots::getSlotRoles
+        */
+       public function testGetSlotRoles_someSlots() {
+               $mainSlot = SlotRecord::newUnsaved( 'main', new WikitextContent( 'A' ) );
+               $auxSlot = SlotRecord::newUnsaved( 'aux', new WikitextContent( 'B' ) );
+               $slots = new RevisionSlots( [ $mainSlot, $auxSlot ] );
+
+               $this->assertSame( [ 'main', 'aux' ], $slots->getSlotRoles() );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionSlots::getSlotRoles
+        */
+       public function testGetSlotRoles_noSlots() {
+               $slots = new RevisionSlots( [] );
+
+               $this->assertSame( [], $slots->getSlotRoles() );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionSlots::getSlots
+        */
+       public function testGetSlots() {
+               $mainSlot = SlotRecord::newUnsaved( 'main', new WikitextContent( 'A' ) );
+               $auxSlot = SlotRecord::newUnsaved( 'aux', new WikitextContent( 'B' ) );
+               $slotsArray = [ $mainSlot, $auxSlot ];
+               $slots = new RevisionSlots( $slotsArray );
+
+               $this->assertEquals( [ 'main' => $mainSlot, 'aux' => $auxSlot ], $slots->getSlots() );
+       }
+
+       public function provideComputeSize() {
+               yield [ 1, [ 'A' ] ];
+               yield [ 2, [ 'AA' ] ];
+               yield [ 4, [ 'AA', 'X', 'H' ] ];
+       }
+
+       /**
+        * @dataProvider provideComputeSize
+        * @covers \MediaWiki\Storage\RevisionSlots::computeSize
+        */
+       public function testComputeSize( $expected, $contentStrings ) {
+               $slotsArray = [];
+               foreach ( $contentStrings as $key => $contentString ) {
+                       $slotsArray[] = SlotRecord::newUnsaved( strval( $key ), new WikitextContent( $contentString ) );
+               }
+               $slots = new RevisionSlots( $slotsArray );
+
+               $this->assertSame( $expected, $slots->computeSize() );
+       }
+
+       public function provideComputeSha1() {
+               yield [ 'ctqm7794fr2dp1taki8a88ovwnvmnmj', [ 'A' ] ];
+               yield [ 'eyq8wiwlcofnaiy4eid97gyfy60uw51', [ 'AA' ] ];
+               yield [ 'lavctqfpxartyjr31f853drgfl4kj1g', [ 'AA', 'X', 'H' ] ];
+       }
+
+       /**
+        * @dataProvider provideComputeSha1
+        * @covers \MediaWiki\Storage\RevisionSlots::computeSha1
+        * @note this test is a bit brittle as the hashes are hardcoded, perhaps just check that strings
+        *       are returned and different Slots objects return different strings?
+        */
+       public function testComputeSha1( $expected, $contentStrings ) {
+               $slotsArray = [];
+               foreach ( $contentStrings as $key => $contentString ) {
+                       $slotsArray[] = SlotRecord::newUnsaved( strval( $key ), new WikitextContent( $contentString ) );
+               }
+               $slots = new RevisionSlots( $slotsArray );
+
+               $this->assertSame( $expected, $slots->computeSha1() );
+       }
+
+}
diff --git a/tests/phpunit/includes/Storage/RevisionStoreDbTest.php b/tests/phpunit/includes/Storage/RevisionStoreDbTest.php
new file mode 100644 (file)
index 0000000..695a6b3
--- /dev/null
@@ -0,0 +1,991 @@
+<?php
+
+namespace MediaWiki\Tests\Storage;
+
+use CommentStoreComment;
+use Exception;
+use InvalidArgumentException;
+use MediaWiki\Linker\LinkTarget;
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\IncompleteRevisionException;
+use MediaWiki\Storage\MutableRevisionRecord;
+use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Storage\SlotRecord;
+use MediaWikiTestCase;
+use Revision;
+use TestUserRegistry;
+use Title;
+use WikiPage;
+use WikitextContent;
+
+/**
+ * @group Database
+ */
+class RevisionStoreDbTest extends MediaWikiTestCase {
+
+       private function assertLinkTargetsEqual( LinkTarget $l1, LinkTarget $l2 ) {
+               $this->assertEquals( $l1->getDBkey(), $l2->getDBkey() );
+               $this->assertEquals( $l1->getNamespace(), $l2->getNamespace() );
+               $this->assertEquals( $l1->getFragment(), $l2->getFragment() );
+               $this->assertEquals( $l1->getInterwiki(), $l2->getInterwiki() );
+       }
+
+       private function assertRevisionRecordsEqual( RevisionRecord $r1, RevisionRecord $r2 ) {
+               $this->assertEquals( $r1->getUser()->getName(), $r2->getUser()->getName() );
+               $this->assertEquals( $r1->getUser()->getId(), $r2->getUser()->getId() );
+               $this->assertEquals( $r1->getComment(), $r2->getComment() );
+               $this->assertEquals( $r1->getPageAsLinkTarget(), $r2->getPageAsLinkTarget() );
+               $this->assertEquals( $r1->getTimestamp(), $r2->getTimestamp() );
+               $this->assertEquals( $r1->getVisibility(), $r2->getVisibility() );
+               $this->assertEquals( $r1->getSha1(), $r2->getSha1() );
+               $this->assertEquals( $r1->getParentId(), $r2->getParentId() );
+               $this->assertEquals( $r1->getSize(), $r2->getSize() );
+               $this->assertEquals( $r1->getPageId(), $r2->getPageId() );
+               $this->assertEquals( $r1->getSlotRoles(), $r2->getSlotRoles() );
+               $this->assertEquals( $r1->getWikiId(), $r2->getWikiId() );
+               $this->assertEquals( $r1->isMinor(), $r2->isMinor() );
+               foreach ( $r1->getSlotRoles() as $role ) {
+                       $this->assertEquals( $r1->getSlot( $role ), $r2->getSlot( $role ) );
+                       $this->assertEquals( $r1->getContent( $role ), $r2->getContent( $role ) );
+               }
+               foreach ( [
+                       RevisionRecord::DELETED_TEXT,
+                       RevisionRecord::DELETED_COMMENT,
+                       RevisionRecord::DELETED_USER,
+                       RevisionRecord::DELETED_RESTRICTED,
+               ] as $field ) {
+                       $this->assertEquals( $r1->isDeleted( $field ), $r2->isDeleted( $field ) );
+               }
+       }
+
+       /**
+        * @param mixed[] $details
+        *
+        * @return RevisionRecord
+        */
+       private function getRevisionRecordFromDetailsArray( $title, $details = [] ) {
+               // Convert some values that can't be provided by dataProviders
+               $page = WikiPage::factory( $title );
+               if ( isset( $details['user'] ) && $details['user'] === true ) {
+                       $details['user'] = $this->getTestUser()->getUser();
+               }
+               if ( isset( $details['page'] ) && $details['page'] === true ) {
+                       $details['page'] = $page->getId();
+               }
+               if ( isset( $details['parent'] ) && $details['parent'] === true ) {
+                       $details['parent'] = $page->getLatest();
+               }
+
+               // Create the RevisionRecord with any available data
+               $rev = new MutableRevisionRecord( $title );
+               isset( $details['slot'] ) ? $rev->setSlot( $details['slot'] ) : null;
+               isset( $details['parent'] ) ? $rev->setParentId( $details['parent'] ) : null;
+               isset( $details['page'] ) ? $rev->setPageId( $details['page'] ) : null;
+               isset( $details['size'] ) ? $rev->setSize( $details['size'] ) : null;
+               isset( $details['sha1'] ) ? $rev->setSha1( $details['sha1'] ) : null;
+               isset( $details['comment'] ) ? $rev->setComment( $details['comment'] ) : null;
+               isset( $details['timestamp'] ) ? $rev->setTimestamp( $details['timestamp'] ) : null;
+               isset( $details['minor'] ) ? $rev->setMinorEdit( $details['minor'] ) : null;
+               isset( $details['user'] ) ? $rev->setUser( $details['user'] ) : null;
+               isset( $details['visibility'] ) ? $rev->setVisibility( $details['visibility'] ) : null;
+               isset( $details['id'] ) ? $rev->setId( $details['id'] ) : null;
+
+               return $rev;
+       }
+
+       private function getRandomCommentStoreComment() {
+               return CommentStoreComment::newUnsavedComment( __METHOD__ . '.' . rand( 0, 1000 ) );
+       }
+
+       public function provideInsertRevisionOn_successes() {
+               yield 'Bare minimum revision insertion' => [
+                       Title::newFromText( 'UTPage' ),
+                       [
+                               'slot' => SlotRecord::newUnsaved( 'main', new WikitextContent( 'Chicken' ) ),
+                               'parent' => true,
+                               'comment' => $this->getRandomCommentStoreComment(),
+                               'timestamp' => '20171117010101',
+                               'user' => true,
+                       ],
+               ];
+               yield 'Detailed revision insertion' => [
+                       Title::newFromText( 'UTPage' ),
+                       [
+                               'slot' => SlotRecord::newUnsaved( 'main', new WikitextContent( 'Chicken' ) ),
+                               'parent' => true,
+                               'page' => true,
+                               'comment' => $this->getRandomCommentStoreComment(),
+                               'timestamp' => '20171117010101',
+                               'user' => true,
+                               'minor' => true,
+                               'visibility' => RevisionRecord::DELETED_RESTRICTED,
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideInsertRevisionOn_successes
+        * @covers \MediaWiki\Storage\RevisionStore::insertRevisionOn
+        */
+       public function testInsertRevisionOn_successes( Title $title, array $revDetails = [] ) {
+               $rev = $this->getRevisionRecordFromDetailsArray( $title, $revDetails );
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $return = $store->insertRevisionOn( $rev, wfGetDB( DB_MASTER ) );
+
+               $this->assertLinkTargetsEqual( $title, $return->getPageAsLinkTarget() );
+               $this->assertRevisionRecordsEqual( $rev, $return );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::insertRevisionOn
+        */
+       public function testInsertRevisionOn_blobAddressExists() {
+               $title = Title::newFromText( 'UTPage' );
+               $revDetails = [
+                       'slot' => SlotRecord::newUnsaved( 'main', new WikitextContent( 'Chicken' ) ),
+                       'parent' => true,
+                       'comment' => $this->getRandomCommentStoreComment(),
+                       'timestamp' => '20171117010101',
+                       'user' => true,
+               ];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+
+               // Insert the first revision
+               $revOne = $this->getRevisionRecordFromDetailsArray( $title, $revDetails );
+               $firstReturn = $store->insertRevisionOn( $revOne, wfGetDB( DB_MASTER ) );
+               $this->assertLinkTargetsEqual( $title, $firstReturn->getPageAsLinkTarget() );
+               $this->assertRevisionRecordsEqual( $revOne, $firstReturn );
+
+               // Insert a second revision inheriting the same blob address
+               $revDetails['slot'] = SlotRecord::newInherited( $firstReturn->getSlot( 'main' ) );
+               $revTwo = $this->getRevisionRecordFromDetailsArray( $title, $revDetails );
+               $secondReturn = $store->insertRevisionOn( $revTwo, wfGetDB( DB_MASTER ) );
+               $this->assertLinkTargetsEqual( $title, $secondReturn->getPageAsLinkTarget() );
+               $this->assertRevisionRecordsEqual( $revTwo, $secondReturn );
+
+               // Assert that the same blob address has been used.
+               $this->assertEquals(
+                       $firstReturn->getSlot( 'main' )->getAddress(),
+                       $secondReturn->getSlot( 'main' )->getAddress()
+               );
+               // And that different revisions have been created.
+               $this->assertNotSame(
+                       $firstReturn->getId(),
+                       $secondReturn->getId()
+               );
+       }
+
+       public function provideInsertRevisionOn_failures() {
+               yield 'no slot' => [
+                       Title::newFromText( 'UTPage' ),
+                       [
+                               'comment' => $this->getRandomCommentStoreComment(),
+                               'timestamp' => '20171117010101',
+                               'user' => true,
+                       ],
+                       new InvalidArgumentException( 'At least one slot needs to be defined!' )
+               ];
+               yield 'slot that is not main slot' => [
+                       Title::newFromText( 'UTPage' ),
+                       [
+                               'slot' => SlotRecord::newUnsaved( 'lalala', new WikitextContent( 'Chicken' ) ),
+                               'comment' => $this->getRandomCommentStoreComment(),
+                               'timestamp' => '20171117010101',
+                               'user' => true,
+                       ],
+                       new InvalidArgumentException( 'Only the main slot is supported for now!' )
+               ];
+               yield 'no timestamp' => [
+                       Title::newFromText( 'UTPage' ),
+                       [
+                               'slot' => SlotRecord::newUnsaved( 'main', new WikitextContent( 'Chicken' ) ),
+                               'comment' => $this->getRandomCommentStoreComment(),
+                               'user' => true,
+                       ],
+                       new IncompleteRevisionException( 'timestamp field must not be NULL!' )
+               ];
+               yield 'no comment' => [
+                       Title::newFromText( 'UTPage' ),
+                       [
+                               'slot' => SlotRecord::newUnsaved( 'main', new WikitextContent( 'Chicken' ) ),
+                               'timestamp' => '20171117010101',
+                               'user' => true,
+                       ],
+                       new IncompleteRevisionException( 'comment must not be NULL!' )
+               ];
+               yield 'no user' => [
+                       Title::newFromText( 'UTPage' ),
+                       [
+                               'slot' => SlotRecord::newUnsaved( 'main', new WikitextContent( 'Chicken' ) ),
+                               'comment' => $this->getRandomCommentStoreComment(),
+                               'timestamp' => '20171117010101',
+                       ],
+                       new IncompleteRevisionException( 'user must not be NULL!' )
+               ];
+       }
+
+       /**
+        * @dataProvider provideInsertRevisionOn_failures
+        * @covers \MediaWiki\Storage\RevisionStore::insertRevisionOn
+        */
+       public function testInsertRevisionOn_failures(
+               Title $title,
+               array $revDetails = [],
+               Exception $exception ) {
+               $rev = $this->getRevisionRecordFromDetailsArray( $title, $revDetails );
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+
+               $this->setExpectedException(
+                       get_class( $exception ),
+                       $exception->getMessage(),
+                       $exception->getCode()
+               );
+               $store->insertRevisionOn( $rev, wfGetDB( DB_MASTER ) );
+       }
+
+       public function provideNewNullRevision() {
+               yield [
+                       Title::newFromText( 'UTPage' ),
+                       CommentStoreComment::newUnsavedComment( __METHOD__ . ' comment1' ),
+                       true,
+               ];
+               yield [
+                       Title::newFromText( 'UTPage' ),
+                       CommentStoreComment::newUnsavedComment( __METHOD__ . ' comment2', [ 'a' => 1 ] ),
+                       false,
+               ];
+       }
+
+       /**
+        * @dataProvider provideNewNullRevision
+        * @covers \MediaWiki\Storage\RevisionStore::newNullRevision
+        */
+       public function testNewNullRevision( Title $title, $comment, $minor ) {
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $user = TestUserRegistry::getMutableTestUser( __METHOD__ )->getUser();
+               $record = $store->newNullRevision(
+                       wfGetDB( DB_MASTER ),
+                       $title,
+                       $comment,
+                       $minor,
+                       $user
+               );
+
+               $this->assertEquals( $title->getNamespace(), $record->getPageAsLinkTarget()->getNamespace() );
+               $this->assertEquals( $title->getDBkey(), $record->getPageAsLinkTarget()->getDBkey() );
+               $this->assertEquals( $comment, $record->getComment() );
+               $this->assertEquals( $minor, $record->isMinor() );
+               $this->assertEquals( $user->getName(), $record->getUser()->getName() );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::newNullRevision
+        */
+       public function testNewNullRevision_nonExistingTitle() {
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $record = $store->newNullRevision(
+                       wfGetDB( DB_MASTER ),
+                       Title::newFromText( __METHOD__ . '.iDontExist!' ),
+                       CommentStoreComment::newUnsavedComment( __METHOD__ . ' comment' ),
+                       false,
+                       TestUserRegistry::getMutableTestUser( __METHOD__ )->getUser()
+               );
+               $this->assertNull( $record );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::isUnpatrolled
+        */
+       public function testIsUnpatrolled_returnsRecentChangesId() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               $status = $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
+               /** @var Revision $rev */
+               $rev = $status->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $revisionRecord = $store->getRevisionById( $rev->getId() );
+               $result = $store->isUnpatrolled( $revisionRecord );
+
+               $this->assertGreaterThan( 0, $result );
+               $this->assertSame(
+                       $page->getRevision()->getRecentChange()->getAttribute( 'rc_id' ),
+                       $result
+               );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::isUnpatrolled
+        */
+       public function testIsUnpatrolled_returnsZeroIfPatrolled() {
+               // This assumes that sysops are auto patrolled
+               $sysop = $this->getTestSysop()->getUser();
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               $status = $page->doEditContent(
+                       new WikitextContent( __METHOD__ ),
+                       __METHOD__,
+                       0,
+                       false,
+                       $sysop
+               );
+               /** @var Revision $rev */
+               $rev = $status->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $revisionRecord = $store->getRevisionById( $rev->getId() );
+               $result = $store->isUnpatrolled( $revisionRecord );
+
+               $this->assertSame( 0, $result );
+       }
+
+       public function testGetRecentChange() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               $content = new WikitextContent( __METHOD__ );
+               $status = $page->doEditContent( $content, __METHOD__ );
+               /** @var Revision $rev */
+               $rev = $status->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $revRecord = $store->getRevisionById( $rev->getId() );
+               $recentChange = $store->getRecentChange( $revRecord );
+
+               $this->assertEquals( $rev->getId(), $recentChange->getAttribute( 'rc_this_oldid' ) );
+               $this->assertEquals( $rev->getRecentChange(), $recentChange );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getRevisionById
+        */
+       public function testGetRevisionById() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               $content = new WikitextContent( __METHOD__ );
+               $status = $page->doEditContent( $content, __METHOD__ );
+               /** @var Revision $rev */
+               $rev = $status->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $revRecord = $store->getRevisionById( $rev->getId() );
+
+               $this->assertSame( $rev->getId(), $revRecord->getId() );
+               $this->assertTrue( $revRecord->getSlot( 'main' )->getContent()->equals( $content ) );
+               $this->assertSame( __METHOD__, $revRecord->getComment()->text );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getRevisionByTitle
+        */
+       public function testGetRevisionByTitle() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               $content = new WikitextContent( __METHOD__ );
+               $status = $page->doEditContent( $content, __METHOD__ );
+               /** @var Revision $rev */
+               $rev = $status->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $revRecord = $store->getRevisionByTitle( $page->getTitle() );
+
+               $this->assertSame( $rev->getId(), $revRecord->getId() );
+               $this->assertTrue( $revRecord->getSlot( 'main' )->getContent()->equals( $content ) );
+               $this->assertSame( __METHOD__, $revRecord->getComment()->text );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getRevisionByPageId
+        */
+       public function testGetRevisionByPageId() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               $content = new WikitextContent( __METHOD__ );
+               $status = $page->doEditContent( $content, __METHOD__ );
+               /** @var Revision $rev */
+               $rev = $status->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $revRecord = $store->getRevisionByPageId( $page->getId() );
+
+               $this->assertSame( $rev->getId(), $revRecord->getId() );
+               $this->assertTrue( $revRecord->getSlot( 'main' )->getContent()->equals( $content ) );
+               $this->assertSame( __METHOD__, $revRecord->getComment()->text );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getRevisionFromTimestamp
+        */
+       public function testGetRevisionFromTimestamp() {
+               // Make sure there is 1 second between the last revision and the rev we create...
+               // Otherwise we might not get the correct revision and the test may fail...
+               // :(
+               sleep( 1 );
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               $content = new WikitextContent( __METHOD__ );
+               $status = $page->doEditContent( $content, __METHOD__ );
+               /** @var Revision $rev */
+               $rev = $status->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $revRecord = $store->getRevisionFromTimestamp(
+                       $page->getTitle(),
+                       $rev->getTimestamp()
+               );
+
+               $this->assertSame( $rev->getId(), $revRecord->getId() );
+               $this->assertTrue( $revRecord->getSlot( 'main' )->getContent()->equals( $content ) );
+               $this->assertSame( __METHOD__, $revRecord->getComment()->text );
+       }
+
+       private function revisionToRow( Revision $rev ) {
+               $page = WikiPage::factory( $rev->getTitle() );
+
+               return (object)[
+                       'rev_id' => (string)$rev->getId(),
+                       'rev_page' => (string)$rev->getPage(),
+                       'rev_text_id' => (string)$rev->getTextId(),
+                       'rev_timestamp' => (string)$rev->getTimestamp(),
+                       'rev_user_text' => (string)$rev->getUserText(),
+                       'rev_user' => (string)$rev->getUser(),
+                       'rev_minor_edit' => $rev->isMinor() ? '1' : '0',
+                       'rev_deleted' => (string)$rev->getVisibility(),
+                       'rev_len' => (string)$rev->getSize(),
+                       'rev_parent_id' => (string)$rev->getParentId(),
+                       'rev_sha1' => (string)$rev->getSha1(),
+                       'rev_comment_text' => $rev->getComment(),
+                       'rev_comment_data' => null,
+                       'rev_comment_cid' => null,
+                       'rev_content_format' => $rev->getContentFormat(),
+                       'rev_content_model' => $rev->getContentModel(),
+                       'page_namespace' => (string)$page->getTitle()->getNamespace(),
+                       'page_title' => $page->getTitle()->getDBkey(),
+                       'page_id' => (string)$page->getId(),
+                       'page_latest' => (string)$page->getLatest(),
+                       'page_is_redirect' => $page->isRedirect() ? '1' : '0',
+                       'page_len' => (string)$page->getContent()->getSize(),
+                       'user_name' => (string)$rev->getUserText(),
+               ];
+       }
+
+       private function assertRevisionRecordMatchesRevision(
+               Revision $rev,
+               RevisionRecord $record
+       ) {
+               $this->assertSame( $rev->getId(), $record->getId() );
+               $this->assertSame( $rev->getPage(), $record->getPageId() );
+               $this->assertSame( $rev->getTimestamp(), $record->getTimestamp() );
+               $this->assertSame( $rev->getUserText(), $record->getUser()->getName() );
+               $this->assertSame( $rev->getUser(), $record->getUser()->getId() );
+               $this->assertSame( $rev->isMinor(), $record->isMinor() );
+               $this->assertSame( $rev->getVisibility(), $record->getVisibility() );
+               $this->assertSame( $rev->getSize(), $record->getSize() );
+               /**
+                * @note As of MW 1.31, the database schema allows the parent ID to be
+                * NULL to indicate that it is unknown.
+                */
+               $expectedParent = $rev->getParentId();
+               if ( $expectedParent === null ) {
+                       $expectedParent = 0;
+               }
+               $this->assertSame( $expectedParent, $record->getParentId() );
+               $this->assertSame( $rev->getSha1(), $record->getSha1() );
+               $this->assertSame( $rev->getComment(), $record->getComment()->text );
+               $this->assertSame( $rev->getContentFormat(), $record->getContent( 'main' )->getDefaultFormat() );
+               $this->assertSame( $rev->getContentModel(), $record->getContent( 'main' )->getModel() );
+               $this->assertLinkTargetsEqual( $rev->getTitle(), $record->getPageAsLinkTarget() );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::newRevisionFromRow
+        * @covers \MediaWiki\Storage\RevisionStore::newRevisionFromRow_1_29
+        */
+       public function testNewRevisionFromRow_anonEdit() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               /** @var Revision $rev */
+               $rev = $page->doEditContent(
+                       new WikitextContent( __METHOD__. 'a' ),
+                       __METHOD__. 'a'
+               )->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $record = $store->newRevisionFromRow(
+                       $this->revisionToRow( $rev ),
+                       [],
+                       $page->getTitle()
+               );
+               $this->assertRevisionRecordMatchesRevision( $rev, $record );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::newRevisionFromRow
+        * @covers \MediaWiki\Storage\RevisionStore::newRevisionFromRow_1_29
+        */
+       public function testNewRevisionFromRow_userEdit() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               /** @var Revision $rev */
+               $rev = $page->doEditContent(
+                       new WikitextContent( __METHOD__. 'b' ),
+                       __METHOD__ . 'b',
+                       0,
+                       false,
+                       $this->getTestUser()->getUser()
+               )->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $record = $store->newRevisionFromRow(
+                       $this->revisionToRow( $rev ),
+                       [],
+                       $page->getTitle()
+               );
+               $this->assertRevisionRecordMatchesRevision( $rev, $record );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::newRevisionFromArchiveRow
+        */
+       public function testNewRevisionFromArchiveRow() {
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $title = Title::newFromText( __METHOD__ );
+               $page = WikiPage::factory( $title );
+               /** @var Revision $orig */
+               $orig = $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ )
+                       ->value['revision'];
+               $page->doDeleteArticle( __METHOD__ );
+
+               $db = wfGetDB( DB_MASTER );
+               $arQuery = $store->getArchiveQueryInfo();
+               $res = $db->select(
+                       $arQuery['tables'], $arQuery['fields'], [ 'ar_rev_id' => $orig->getId() ],
+                       __METHOD__, [], $arQuery['joins']
+               );
+               $this->assertTrue( is_object( $res ), 'query failed' );
+
+               $row = $res->fetchObject();
+               $res->free();
+               $record = $store->newRevisionFromArchiveRow( $row );
+
+               $this->assertRevisionRecordMatchesRevision( $orig, $record );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::loadRevisionFromId
+        */
+       public function testLoadRevisionFromId() {
+               $title = Title::newFromText( __METHOD__ );
+               $page = WikiPage::factory( $title );
+               /** @var Revision $rev */
+               $rev = $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ )
+                       ->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $result = $store->loadRevisionFromId( wfGetDB( DB_MASTER ), $rev->getId() );
+               $this->assertRevisionRecordMatchesRevision( $rev, $result );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::loadRevisionFromPageId
+        */
+       public function testLoadRevisionFromPageId() {
+               $title = Title::newFromText( __METHOD__ );
+               $page = WikiPage::factory( $title );
+               /** @var Revision $rev */
+               $rev = $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ )
+                       ->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $result = $store->loadRevisionFromPageId( wfGetDB( DB_MASTER ), $page->getId() );
+               $this->assertRevisionRecordMatchesRevision( $rev, $result );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::loadRevisionFromTitle
+        */
+       public function testLoadRevisionFromTitle() {
+               $title = Title::newFromText( __METHOD__ );
+               $page = WikiPage::factory( $title );
+               /** @var Revision $rev */
+               $rev = $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ )
+                       ->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $result = $store->loadRevisionFromTitle( wfGetDB( DB_MASTER ), $title );
+               $this->assertRevisionRecordMatchesRevision( $rev, $result );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::loadRevisionFromTimestamp
+        */
+       public function testLoadRevisionFromTimestamp() {
+               $title = Title::newFromText( __METHOD__ );
+               $page = WikiPage::factory( $title );
+               /** @var Revision $revOne */
+               $revOne = $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ )
+                       ->value['revision'];
+               // Sleep to ensure different timestamps... )(evil)
+               sleep( 1 );
+               /** @var Revision $revTwo */
+               $revTwo = $page->doEditContent( new WikitextContent( __METHOD__ . 'a' ), '' )
+                       ->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $this->assertNull(
+                       $store->loadRevisionFromTimestamp( wfGetDB( DB_MASTER ), $title, '20150101010101' )
+               );
+               $this->assertSame(
+                       $revOne->getId(),
+                       $store->loadRevisionFromTimestamp(
+                               wfGetDB( DB_MASTER ),
+                               $title,
+                               $revOne->getTimestamp()
+                       )->getId()
+               );
+               $this->assertSame(
+                       $revTwo->getId(),
+                       $store->loadRevisionFromTimestamp(
+                               wfGetDB( DB_MASTER ),
+                               $title,
+                               $revTwo->getTimestamp()
+                       )->getId()
+               );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::listRevisionSizes
+        */
+       public function testGetParentLengths() {
+               $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
+               /** @var Revision $revOne */
+               $revOne = $page->doEditContent(
+                       new WikitextContent( __METHOD__ ), __METHOD__
+               )->value['revision'];
+               /** @var Revision $revTwo */
+               $revTwo = $page->doEditContent(
+                       new WikitextContent( __METHOD__ . '2' ), __METHOD__
+               )->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $this->assertSame(
+                       [
+                               $revOne->getId() => strlen( __METHOD__ ),
+                       ],
+                       $store->listRevisionSizes(
+                               wfGetDB( DB_MASTER ),
+                               [ $revOne->getId() ]
+                       )
+               );
+               $this->assertSame(
+                       [
+                               $revOne->getId() => strlen( __METHOD__ ),
+                               $revTwo->getId() => strlen( __METHOD__ ) + 1,
+                       ],
+                       $store->listRevisionSizes(
+                               wfGetDB( DB_MASTER ),
+                               [ $revOne->getId(), $revTwo->getId() ]
+                       )
+               );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getPreviousRevision
+        */
+       public function testGetPreviousRevision() {
+               $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
+               /** @var Revision $revOne */
+               $revOne = $page->doEditContent(
+                       new WikitextContent( __METHOD__ ), __METHOD__
+               )->value['revision'];
+               /** @var Revision $revTwo */
+               $revTwo = $page->doEditContent(
+                       new WikitextContent( __METHOD__ . '2' ), __METHOD__
+               )->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $this->assertNull(
+                       $store->getPreviousRevision( $store->getRevisionById( $revOne->getId() ) )
+               );
+               $this->assertSame(
+                       $revOne->getId(),
+                       $store->getPreviousRevision( $store->getRevisionById( $revTwo->getId() ) )->getId()
+               );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getNextRevision
+        */
+       public function testGetNextRevision() {
+               $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
+               /** @var Revision $revOne */
+               $revOne = $page->doEditContent(
+                       new WikitextContent( __METHOD__ ), __METHOD__
+               )->value['revision'];
+               /** @var Revision $revTwo */
+               $revTwo = $page->doEditContent(
+                       new WikitextContent( __METHOD__ . '2' ), __METHOD__
+               )->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $this->assertSame(
+                       $revTwo->getId(),
+                       $store->getNextRevision( $store->getRevisionById( $revOne->getId() ) )->getId()
+               );
+               $this->assertNull(
+                       $store->getNextRevision( $store->getRevisionById( $revTwo->getId() ) )
+               );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getTimestampFromId
+        */
+       public function testGetTimestampFromId_found() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               /** @var Revision $rev */
+               $rev = $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ )
+                       ->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $result = $store->getTimestampFromId(
+                       $page->getTitle(),
+                       $rev->getId()
+               );
+
+               $this->assertSame( $rev->getTimestamp(), $result );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getTimestampFromId
+        */
+       public function testGetTimestampFromId_notFound() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               /** @var Revision $rev */
+               $rev = $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ )
+                       ->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $result = $store->getTimestampFromId(
+                       $page->getTitle(),
+                       $rev->getId() + 1
+               );
+
+               $this->assertFalse( $result );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::countRevisionsByPageId
+        */
+       public function testCountRevisionsByPageId() {
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
+
+               $this->assertSame(
+                       0,
+                       $store->countRevisionsByPageId( wfGetDB( DB_MASTER ), $page->getId() )
+               );
+               $page->doEditContent( new WikitextContent( 'a' ), 'a' );
+               $this->assertSame(
+                       1,
+                       $store->countRevisionsByPageId( wfGetDB( DB_MASTER ), $page->getId() )
+               );
+               $page->doEditContent( new WikitextContent( 'b' ), 'b' );
+               $this->assertSame(
+                       2,
+                       $store->countRevisionsByPageId( wfGetDB( DB_MASTER ), $page->getId() )
+               );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::countRevisionsByTitle
+        */
+       public function testCountRevisionsByTitle() {
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
+
+               $this->assertSame(
+                       0,
+                       $store->countRevisionsByTitle( wfGetDB( DB_MASTER ), $page->getTitle() )
+               );
+               $page->doEditContent( new WikitextContent( 'a' ), 'a' );
+               $this->assertSame(
+                       1,
+                       $store->countRevisionsByTitle( wfGetDB( DB_MASTER ), $page->getTitle() )
+               );
+               $page->doEditContent( new WikitextContent( 'b' ), 'b' );
+               $this->assertSame(
+                       2,
+                       $store->countRevisionsByTitle( wfGetDB( DB_MASTER ), $page->getTitle() )
+               );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::userWasLastToEdit
+        */
+       public function testUserWasLastToEdit_false() {
+               $sysop = $this->getTestSysop()->getUser();
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $result = $store->userWasLastToEdit(
+                       wfGetDB( DB_MASTER ),
+                       $page->getId(),
+                       $sysop->getId(),
+                       '20160101010101'
+               );
+               $this->assertFalse( $result );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::userWasLastToEdit
+        */
+       public function testUserWasLastToEdit_true() {
+               $startTime = wfTimestampNow();
+               $sysop = $this->getTestSysop()->getUser();
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               $page->doEditContent(
+                       new WikitextContent( __METHOD__ ),
+                       __METHOD__,
+                       0,
+                       false,
+                       $sysop
+               );
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $result = $store->userWasLastToEdit(
+                       wfGetDB( DB_MASTER ),
+                       $page->getId(),
+                       $sysop->getId(),
+                       $startTime
+               );
+               $this->assertTrue( $result );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getKnownCurrentRevision
+        */
+       public function testGetKnownCurrentRevision() {
+               $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
+               /** @var Revision $rev */
+               $rev = $page->doEditContent(
+                       new WikitextContent( __METHOD__. 'b' ),
+                       __METHOD__ . 'b',
+                       0,
+                       false,
+                       $this->getTestUser()->getUser()
+               )->value['revision'];
+
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $record = $store->getKnownCurrentRevision(
+                       $page->getTitle(),
+                       $rev->getId()
+               );
+
+               $this->assertRevisionRecordMatchesRevision( $rev, $record );
+       }
+
+       public function provideNewMutableRevisionFromArray() {
+               yield 'Basic array, with page & id' => [
+                       [
+                               'id' => 2,
+                               'page' => 1,
+                               'text_id' => 2,
+                               'timestamp' => '20171017114835',
+                               'user_text' => '111.0.1.2',
+                               'user' => 0,
+                               'minor_edit' => false,
+                               'deleted' => 0,
+                               'len' => 46,
+                               'parent_id' => 1,
+                               'sha1' => 'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
+                               'comment' => 'Goat Comment!',
+                               'content_format' => 'text/x-wiki',
+                               'content_model' => 'wikitext',
+                       ]
+               ];
+               yield 'Basic array, content object' => [
+                       [
+                               'id' => 2,
+                               'page' => 1,
+                               'timestamp' => '20171017114835',
+                               'user_text' => '111.0.1.2',
+                               'user' => 0,
+                               'minor_edit' => false,
+                               'deleted' => 0,
+                               'len' => 46,
+                               'parent_id' => 1,
+                               'sha1' => 'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
+                               'comment' => 'Goat Comment!',
+                               'content' => new WikitextContent( 'Some Content' ),
+                       ]
+               ];
+               yield 'Basic array, with title' => [
+                       [
+                               'title' => Title::newFromText( 'SomeText' ),
+                               'text_id' => 2,
+                               'timestamp' => '20171017114835',
+                               'user_text' => '111.0.1.2',
+                               'user' => 0,
+                               'minor_edit' => false,
+                               'deleted' => 0,
+                               'len' => 46,
+                               'parent_id' => 1,
+                               'sha1' => 'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
+                               'comment' => 'Goat Comment!',
+                               'content_format' => 'text/x-wiki',
+                               'content_model' => 'wikitext',
+                       ]
+               ];
+               yield 'Basic array, no user field' => [
+                       [
+                               'id' => 2,
+                               'page' => 1,
+                               'text_id' => 2,
+                               'timestamp' => '20171017114835',
+                               'user_text' => '111.0.1.3',
+                               'minor_edit' => false,
+                               'deleted' => 0,
+                               'len' => 46,
+                               'parent_id' => 1,
+                               'sha1' => 'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
+                               'comment' => 'Goat Comment!',
+                               'content_format' => 'text/x-wiki',
+                               'content_model' => 'wikitext',
+                       ]
+               ];
+       }
+
+       /**
+        * @dataProvider provideNewMutableRevisionFromArray
+        * @covers \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray
+        */
+       public function testNewMutableRevisionFromArray( array $array ) {
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+
+               $result = $store->newMutableRevisionFromArray( $array );
+
+               if ( isset( $array['id'] ) ) {
+                       $this->assertSame( $array['id'], $result->getId() );
+               }
+               if ( isset( $array['page'] ) ) {
+                       $this->assertSame( $array['page'], $result->getPageId() );
+               }
+               $this->assertSame( $array['timestamp'], $result->getTimestamp() );
+               $this->assertSame( $array['user_text'], $result->getUser()->getName() );
+               if ( isset( $array['user'] ) ) {
+                       $this->assertSame( $array['user'], $result->getUser()->getId() );
+               }
+               $this->assertSame( (bool)$array['minor_edit'], $result->isMinor() );
+               $this->assertSame( $array['deleted'], $result->getVisibility() );
+               $this->assertSame( $array['len'], $result->getSize() );
+               $this->assertSame( $array['parent_id'], $result->getParentId() );
+               $this->assertSame( $array['sha1'], $result->getSha1() );
+               $this->assertSame( $array['comment'], $result->getComment()->text );
+               if ( isset( $array['content'] ) ) {
+                       $this->assertTrue(
+                               $result->getSlot( 'main' )->getContent()->equals( $array['content'] )
+                       );
+               } else {
+                       $this->assertSame(
+                               $array['content_format'],
+                               $result->getSlot( 'main' )->getContent()->getDefaultFormat()
+                       );
+                       $this->assertSame( $array['content_model'], $result->getSlot( 'main' )->getModel() );
+               }
+       }
+
+}
diff --git a/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php b/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php
new file mode 100644 (file)
index 0000000..aa59a5b
--- /dev/null
@@ -0,0 +1,814 @@
+<?php
+
+namespace MediaWiki\Tests\Storage;
+
+use CommentStoreComment;
+use InvalidArgumentException;
+use LogicException;
+use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Storage\RevisionSlots;
+use MediaWiki\Storage\RevisionStoreRecord;
+use MediaWiki\Storage\SlotRecord;
+use MediaWiki\Storage\SuppressedDataException;
+use MediaWiki\User\UserIdentity;
+use MediaWiki\User\UserIdentityValue;
+use MediaWikiTestCase;
+use TextContent;
+use Title;
+
+/**
+ * @covers \MediaWiki\Storage\RevisionStoreRecord
+ */
+class RevisionStoreRecordTest extends MediaWikiTestCase {
+
+       /**
+        * @param array $rowOverrides
+        *
+        * @return RevisionStoreRecord
+        */
+       public function newRevision( array $rowOverrides = [] ) {
+               $title = Title::newFromText( 'Dummy' );
+               $title->resetArticleID( 17 );
+
+               $user = new UserIdentityValue( 11, 'Tester' );
+               $comment = CommentStoreComment::newUnsavedComment( 'Hello World' );
+
+               $main = SlotRecord::newUnsaved( 'main', new TextContent( 'Lorem Ipsum' ) );
+               $aux = SlotRecord::newUnsaved( 'aux', new TextContent( 'Frumious Bandersnatch' ) );
+               $slots = new RevisionSlots( [ $main, $aux ] );
+
+               $row = [
+                       'rev_id' => '7',
+                       'rev_page' => strval( $title->getArticleID() ),
+                       'rev_timestamp' => '20200101000000',
+                       'rev_deleted' => 0,
+                       'rev_minor_edit' => 0,
+                       'rev_parent_id' => '5',
+                       'rev_len' => $slots->computeSize(),
+                       'rev_sha1' => $slots->computeSha1(),
+                       'page_latest' => '18',
+               ];
+
+               $row = array_merge( $row, $rowOverrides );
+
+               return new RevisionStoreRecord( $title, $user, $comment, (object)$row, $slots );
+       }
+
+       public function provideConstructor() {
+               $title = Title::newFromText( 'Dummy' );
+               $title->resetArticleID( 17 );
+
+               $user = new UserIdentityValue( 11, 'Tester' );
+               $comment = CommentStoreComment::newUnsavedComment( 'Hello World' );
+
+               $main = SlotRecord::newUnsaved( 'main', new TextContent( 'Lorem Ipsum' ) );
+               $aux = SlotRecord::newUnsaved( 'aux', new TextContent( 'Frumious Bandersnatch' ) );
+               $slots = new RevisionSlots( [ $main, $aux ] );
+
+               $protoRow = [
+                       'rev_id' => '7',
+                       'rev_page' => strval( $title->getArticleID() ),
+                       'rev_timestamp' => '20200101000000',
+                       'rev_deleted' => 0,
+                       'rev_minor_edit' => 0,
+                       'rev_parent_id' => '5',
+                       'rev_len' => $slots->computeSize(),
+                       'rev_sha1' => $slots->computeSha1(),
+                       'page_latest' => '18',
+               ];
+
+               $row = $protoRow;
+               yield 'all info' => [
+                       $title,
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots,
+                       'acmewiki'
+               ];
+
+               $row = $protoRow;
+               $row['rev_minor_edit'] = '1';
+               $row['rev_deleted'] = strval( RevisionRecord::DELETED_USER );
+
+               yield 'minor deleted' => [
+                       $title,
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots
+               ];
+
+               $row = $protoRow;
+               $row['page_latest'] = $row['rev_id'];
+
+               yield 'latest' => [
+                       $title,
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots
+               ];
+
+               $row = $protoRow;
+               unset( $row['rev_parent'] );
+
+               yield 'no parent' => [
+                       $title,
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots
+               ];
+
+               $row = $protoRow;
+               unset( $row['rev_len'] );
+               unset( $row['rev_sha1'] );
+
+               yield 'no length, no hash' => [
+                       $title,
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots
+               ];
+
+               $row = $protoRow;
+               yield 'no length, no hash' => [
+                       Title::newFromText( 'DummyDoesNotExist' ),
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots
+               ];
+       }
+
+       /**
+        * @dataProvider provideConstructor
+        *
+        * @param Title $title
+        * @param UserIdentity $user
+        * @param CommentStoreComment $comment
+        * @param object $row
+        * @param RevisionSlots $slots
+        * @param bool $wikiId
+        */
+       public function testConstructorAndGetters(
+               Title $title,
+               UserIdentity $user,
+               CommentStoreComment $comment,
+               $row,
+               RevisionSlots $slots,
+               $wikiId = false
+       ) {
+               $rec = new RevisionStoreRecord( $title, $user, $comment, $row, $slots, $wikiId );
+
+               $this->assertSame( $title, $rec->getPageAsLinkTarget(), 'getPageAsLinkTarget' );
+               $this->assertSame( $user, $rec->getUser( RevisionRecord::RAW ), 'getUser' );
+               $this->assertSame( $comment, $rec->getComment(), 'getComment' );
+
+               $this->assertSame( $slots->getSlotRoles(), $rec->getSlotRoles(), 'getSlotRoles' );
+               $this->assertSame( $wikiId, $rec->getWikiId(), 'getWikiId' );
+
+               $this->assertSame( (int)$row->rev_id, $rec->getId(), 'getId' );
+               $this->assertSame( (int)$row->rev_page, $rec->getPageId(), 'getId' );
+               $this->assertSame( $row->rev_timestamp, $rec->getTimestamp(), 'getTimestamp' );
+               $this->assertSame( (int)$row->rev_deleted, $rec->getVisibility(), 'getVisibility' );
+               $this->assertSame( (bool)$row->rev_minor_edit, $rec->isMinor(), 'getIsMinor' );
+
+               if ( isset( $row->rev_parent_id ) ) {
+                       $this->assertSame( (int)$row->rev_parent_id, $rec->getParentId(), 'getParentId' );
+               } else {
+                       $this->assertSame( 0, $rec->getParentId(), 'getParentId' );
+               }
+
+               if ( isset( $row->rev_len ) ) {
+                       $this->assertSame( (int)$row->rev_len, $rec->getSize(), 'getSize' );
+               } else {
+                       $this->assertSame( $slots->computeSize(), $rec->getSize(), 'getSize' );
+               }
+
+               if ( isset( $row->rev_sha1 ) ) {
+                       $this->assertSame( $row->rev_sha1, $rec->getSha1(), 'getSha1' );
+               } else {
+                       $this->assertSame( $slots->computeSha1(), $rec->getSha1(), 'getSha1' );
+               }
+
+               if ( isset( $row->page_latest ) ) {
+                       $this->assertSame(
+                               (int)$row->rev_id === (int)$row->page_latest,
+                               $rec->isCurrent(),
+                               'isCurrent'
+                       );
+               } else {
+                       $this->assertSame(
+                               false,
+                               $rec->isCurrent(),
+                               'isCurrent'
+                       );
+               }
+       }
+
+       public function provideConstructorFailure() {
+               $title = Title::newFromText( 'Dummy' );
+               $title->resetArticleID( 17 );
+
+               $user = new UserIdentityValue( 11, 'Tester' );
+
+               $comment = CommentStoreComment::newUnsavedComment( 'Hello World' );
+
+               $main = SlotRecord::newUnsaved( 'main', new TextContent( 'Lorem Ipsum' ) );
+               $aux = SlotRecord::newUnsaved( 'aux', new TextContent( 'Frumious Bandersnatch' ) );
+               $slots = new RevisionSlots( [ $main, $aux ] );
+
+               $protoRow = [
+                       'rev_id' => '7',
+                       'rev_page' => strval( $title->getArticleID() ),
+                       'rev_timestamp' => '20200101000000',
+                       'rev_deleted' => 0,
+                       'rev_minor_edit' => 0,
+                       'rev_parent_id' => '5',
+                       'rev_len' => $slots->computeSize(),
+                       'rev_sha1' => $slots->computeSha1(),
+                       'page_latest' => '18',
+               ];
+
+               yield 'not a row' => [
+                       $title,
+                       $user,
+                       $comment,
+                       'not a row',
+                       $slots,
+                       'acmewiki'
+               ];
+
+               $row = $protoRow;
+               $row['rev_timestamp'] = 'kittens';
+
+               yield 'bad timestamp' => [
+                       $title,
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots
+               ];
+
+               $row = $protoRow;
+               $row['rev_page'] = 99;
+
+               yield 'page ID mismatch' => [
+                       $title,
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots
+               ];
+
+               $row = $protoRow;
+
+               yield 'bad wiki' => [
+                       $title,
+                       $user,
+                       $comment,
+                       (object)$row,
+                       $slots,
+                       12345
+               ];
+       }
+
+       /**
+        * @dataProvider provideConstructorFailure
+        *
+        * @param Title $title
+        * @param UserIdentity $user
+        * @param CommentStoreComment $comment
+        * @param object $row
+        * @param RevisionSlots $slots
+        * @param bool $wikiId
+        */
+       public function testConstructorFailure(
+               Title $title,
+               UserIdentity $user,
+               CommentStoreComment $comment,
+               $row,
+               RevisionSlots $slots,
+               $wikiId = false
+       ) {
+               $this->setExpectedException( InvalidArgumentException::class );
+               new RevisionStoreRecord( $title, $user, $comment, $row, $slots, $wikiId );
+       }
+
+       private function provideAudienceCheckData( $field ) {
+               yield 'field accessible for oversighter (ALL)' => [
+                       RevisionRecord::SUPPRESSED_ALL,
+                       [ 'oversight' ],
+                       true,
+                       false
+               ];
+
+               yield 'field accessible for oversighter' => [
+                       RevisionRecord::DELETED_RESTRICTED | $field,
+                       [ 'oversight' ],
+                       true,
+                       false
+               ];
+
+               yield 'field not accessible for sysops (ALL)' => [
+                       RevisionRecord::SUPPRESSED_ALL,
+                       [ 'sysop' ],
+                       false,
+                       false
+               ];
+
+               yield 'field not accessible for sysops' => [
+                       RevisionRecord::DELETED_RESTRICTED | $field,
+                       [ 'sysop' ],
+                       false,
+                       false
+               ];
+
+               yield 'field accessible for sysops' => [
+                       $field,
+                       [ 'sysop' ],
+                       true,
+                       false
+               ];
+
+               yield 'field suppressed for logged in users' => [
+                       $field,
+                       [ 'user' ],
+                       false,
+                       false
+               ];
+
+               yield 'unrelated field suppressed' => [
+                       $field === RevisionRecord::DELETED_COMMENT
+                               ? RevisionRecord::DELETED_USER
+                               : RevisionRecord::DELETED_COMMENT,
+                       [ 'user' ],
+                       true,
+                       true
+               ];
+
+               yield 'nothing suppressed' => [
+                       0,
+                       [ 'user' ],
+                       true,
+                       true
+               ];
+       }
+
+       public function testSerialization_fails() {
+               $this->setExpectedException( LogicException::class );
+               $rev = $this->newRevision();
+               serialize( $rev );
+       }
+
+       public function provideGetComment_audience() {
+               return $this->provideAudienceCheckData( RevisionRecord::DELETED_COMMENT );
+       }
+
+       private function forceStandardPermissions() {
+               $this->setMwGlobals(
+                       'wgGroupPermissions',
+                       [
+                               'user' => [
+                                       'viewsuppressed' => false,
+                                       'suppressrevision' => false,
+                                       'deletedtext' => false,
+                                       'deletedhistory' => false,
+                               ],
+                               'sysop' => [
+                                       'viewsuppressed' => false,
+                                       'suppressrevision' => false,
+                                       'deletedtext' => true,
+                                       'deletedhistory' => true,
+                               ],
+                               'oversight' => [
+                                       'deletedtext' => true,
+                                       'deletedhistory' => true,
+                                       'viewsuppressed' => true,
+                                       'suppressrevision' => true,
+                               ],
+                       ]
+               );
+       }
+
+       /**
+        * @dataProvider provideGetComment_audience
+        */
+       public function testGetComment_audience( $visibility, $groups, $userCan, $publicCan ) {
+               $this->forceStandardPermissions();
+
+               $user = $this->getTestUser( $groups )->getUser();
+               $rev = $this->newRevision( [ 'rev_deleted' => $visibility ] );
+
+               $this->assertNotNull( $rev->getComment( RevisionRecord::RAW ), 'raw can' );
+
+               $this->assertSame(
+                       $publicCan,
+                       $rev->getComment( RevisionRecord::FOR_PUBLIC ) !== null,
+                       'public can'
+               );
+               $this->assertSame(
+                       $userCan,
+                       $rev->getComment( RevisionRecord::FOR_THIS_USER, $user ) !== null,
+                       'user can'
+               );
+       }
+
+       public function provideGetUser_audience() {
+               return $this->provideAudienceCheckData( RevisionRecord::DELETED_USER );
+       }
+
+       /**
+        * @dataProvider provideGetUser_audience
+        */
+       public function testGetUser_audience( $visibility, $groups, $userCan, $publicCan ) {
+               $this->forceStandardPermissions();
+
+               $user = $this->getTestUser( $groups )->getUser();
+               $rev = $this->newRevision( [ 'rev_deleted' => $visibility ] );
+
+               $this->assertNotNull( $rev->getUser( RevisionRecord::RAW ), 'raw can' );
+
+               $this->assertSame(
+                       $publicCan,
+                       $rev->getUser( RevisionRecord::FOR_PUBLIC ) !== null,
+                       'public can'
+               );
+               $this->assertSame(
+                       $userCan,
+                       $rev->getUser( RevisionRecord::FOR_THIS_USER, $user ) !== null,
+                       'user can'
+               );
+       }
+
+       public function provideGetSlot_audience() {
+               return $this->provideAudienceCheckData( RevisionRecord::DELETED_TEXT );
+       }
+
+       /**
+        * @dataProvider provideGetSlot_audience
+        */
+       public function testGetSlot_audience( $visibility, $groups, $userCan, $publicCan ) {
+               $this->forceStandardPermissions();
+
+               $user = $this->getTestUser( $groups )->getUser();
+               $rev = $this->newRevision( [ 'rev_deleted' => $visibility ] );
+
+               // NOTE: slot meta-data is never suppressed, just the content is!
+               $this->assertNotNull( $rev->getSlot( 'main', RevisionRecord::RAW ), 'raw can' );
+               $this->assertNotNull( $rev->getSlot( 'main', RevisionRecord::FOR_PUBLIC ), 'public can' );
+
+               $this->assertNotNull(
+                       $rev->getSlot( 'main', RevisionRecord::FOR_THIS_USER, $user ),
+                       'user can'
+               );
+
+               try {
+                       $rev->getSlot( 'main', RevisionRecord::FOR_PUBLIC )->getContent();
+                       $exception = null;
+               } catch ( SuppressedDataException $ex ) {
+                       $exception = $ex;
+               }
+
+               $this->assertSame(
+                       $publicCan,
+                       $exception === null,
+                       'public can'
+               );
+
+               try {
+                       $rev->getSlot( 'main', RevisionRecord::FOR_THIS_USER, $user )->getContent();
+                       $exception = null;
+               } catch ( SuppressedDataException $ex ) {
+                       $exception = $ex;
+               }
+
+               $this->assertSame(
+                       $userCan,
+                       $exception === null,
+                       'user can'
+               );
+       }
+
+       public function provideGetSlot_audience_latest() {
+               return $this->provideAudienceCheckData( RevisionRecord::DELETED_TEXT );
+       }
+
+       /**
+        * @dataProvider provideGetSlot_audience_latest
+        */
+       public function testGetSlot_audience_latest( $visibility, $groups, $userCan, $publicCan ) {
+               $this->forceStandardPermissions();
+
+               $user = $this->getTestUser( $groups )->getUser();
+               $rev = $this->newRevision(
+                       [
+                               'rev_deleted' => $visibility,
+                               'rev_id' => 11,
+                               'page_latest' => 11, // revision is current
+                       ]
+               );
+
+               // sanity check
+               $this->assertTrue( $rev->isCurrent(), 'isCurrent()' );
+
+               // NOTE: slot meta-data is never suppressed, just the content is!
+               $this->assertNotNull( $rev->getSlot( 'main', RevisionRecord::RAW ), 'raw can' );
+               $this->assertNotNull( $rev->getSlot( 'main', RevisionRecord::FOR_PUBLIC ), 'public can' );
+
+               $this->assertNotNull(
+                       $rev->getSlot( 'main', RevisionRecord::FOR_THIS_USER, $user ),
+                       'user can'
+               );
+
+               // NOTE: the content of the current revision is never suppressed!
+               // Check that getContent() doesn't throw SuppressedDataException
+               $rev->getSlot( 'main', RevisionRecord::RAW )->getContent();
+               $rev->getSlot( 'main', RevisionRecord::FOR_PUBLIC )->getContent();
+               $rev->getSlot( 'main', RevisionRecord::FOR_THIS_USER, $user )->getContent();
+       }
+
+       /**
+        * @dataProvider provideGetSlot_audience
+        */
+       public function testGetContent_audience( $visibility, $groups, $userCan, $publicCan ) {
+               $this->forceStandardPermissions();
+
+               $user = $this->getTestUser( $groups )->getUser();
+               $rev = $this->newRevision( [ 'rev_deleted' => $visibility ] );
+
+               $this->assertNotNull( $rev->getContent( 'main', RevisionRecord::RAW ), 'raw can' );
+
+               $this->assertSame(
+                       $publicCan,
+                       $rev->getContent( 'main', RevisionRecord::FOR_PUBLIC ) !== null,
+                       'public can'
+               );
+               $this->assertSame(
+                       $userCan,
+                       $rev->getContent( 'main', RevisionRecord::FOR_THIS_USER, $user ) !== null,
+                       'user can'
+               );
+       }
+
+       public function testGetSlot() {
+               $rev = $this->newRevision();
+
+               $slot = $rev->getSlot( 'main' );
+               $this->assertNotNull( $slot, 'getSlot()' );
+               $this->assertSame( 'main', $slot->getRole(), 'getRole()' );
+       }
+
+       public function testGetContent() {
+               $rev = $this->newRevision();
+
+               $content = $rev->getSlot( 'main' );
+               $this->assertNotNull( $content, 'getContent()' );
+               $this->assertSame( CONTENT_MODEL_TEXT, $content->getModel(), 'getModel()' );
+       }
+
+       public function provideUserCanBitfield() {
+               yield [ 0, 0, [], null, true ];
+               // Bitfields match, user has no permissions
+               yield [
+                       RevisionRecord::DELETED_TEXT,
+                       RevisionRecord::DELETED_TEXT,
+                       [],
+                       null,
+                       false
+               ];
+               yield [
+                       RevisionRecord::DELETED_COMMENT,
+                       RevisionRecord::DELETED_COMMENT,
+                       [],
+                       null,
+                       false,
+               ];
+               yield [
+                       RevisionRecord::DELETED_USER,
+                       RevisionRecord::DELETED_USER,
+                       [],
+                       null,
+                       false
+               ];
+               yield [
+                       RevisionRecord::DELETED_RESTRICTED,
+                       RevisionRecord::DELETED_RESTRICTED,
+                       [],
+                       null,
+                       false,
+               ];
+               // Bitfields match, user (admin) does have permissions
+               yield [
+                       RevisionRecord::DELETED_TEXT,
+                       RevisionRecord::DELETED_TEXT,
+                       [ 'sysop' ],
+                       null,
+                       true,
+               ];
+               yield [
+                       RevisionRecord::DELETED_COMMENT,
+                       RevisionRecord::DELETED_COMMENT,
+                       [ 'sysop' ],
+                       null,
+                       true,
+               ];
+               yield [
+                       RevisionRecord::DELETED_USER,
+                       RevisionRecord::DELETED_USER,
+                       [ 'sysop' ],
+                       null,
+                       true,
+               ];
+               // Bitfields match, user (admin) does not have permissions
+               yield [
+                       RevisionRecord::DELETED_RESTRICTED,
+                       RevisionRecord::DELETED_RESTRICTED,
+                       [ 'sysop' ],
+                       null,
+                       false,
+               ];
+               // Bitfields match, user (oversight) does have permissions
+               yield [
+                       RevisionRecord::DELETED_RESTRICTED,
+                       RevisionRecord::DELETED_RESTRICTED,
+                       [ 'oversight' ],
+                       null,
+                       true,
+               ];
+               // Check permissions using the title
+               yield [
+                       RevisionRecord::DELETED_TEXT,
+                       RevisionRecord::DELETED_TEXT,
+                       [ 'sysop' ],
+                       Title::newFromText( __METHOD__ ),
+                       true,
+               ];
+               yield [
+                       RevisionRecord::DELETED_TEXT,
+                       RevisionRecord::DELETED_TEXT,
+                       [],
+                       Title::newFromText( __METHOD__ ),
+                       false,
+               ];
+       }
+
+       /**
+        * @dataProvider provideUserCanBitfield
+        * @covers \MediaWiki\Storage\RevisionRecord::userCanBitfield
+        */
+       public function testUserCanBitfield( $bitField, $field, $userGroups, $title, $expected ) {
+               $this->forceStandardPermissions();
+
+               $user = $this->getTestUser( $userGroups )->getUser();
+
+               $this->assertSame(
+                       $expected,
+                       RevisionRecord::userCanBitfield( $bitField, $field, $user, $title )
+               );
+       }
+
+       private function getSlotRecord( $role, $contentString ) {
+               return SlotRecord::newUnsaved( $role, new TextContent( $contentString ) );
+       }
+
+       public function provideHasSameContent() {
+               /**
+                * @param SlotRecord[] $slots
+                * @param int $revId
+                * @return RevisionStoreRecord
+                */
+               $recordCreator = function ( array $slots, $revId ) {
+                       $title = Title::newFromText( 'provideHasSameContent' );
+                       $title->resetArticleID( 19 );
+                       $slots = new RevisionSlots( $slots );
+
+                       return new RevisionStoreRecord(
+                               $title,
+                               new UserIdentityValue( 11, __METHOD__ ),
+                               CommentStoreComment::newUnsavedComment( __METHOD__ ),
+                               (object)[
+                                       'rev_id' => strval( $revId ),
+                                       'rev_page' => strval( $title->getArticleID() ),
+                                       'rev_timestamp' => '20200101000000',
+                                       'rev_deleted' => 0,
+                                       'rev_minor_edit' => 0,
+                                       'rev_parent_id' => '5',
+                                       'rev_len' => $slots->computeSize(),
+                                       'rev_sha1' => $slots->computeSha1(),
+                                       'page_latest' => '18',
+                               ],
+                               $slots
+                       );
+               };
+
+               // Create some slots with content
+               $mainA = SlotRecord::newUnsaved( 'main', new TextContent( 'A' ) );
+               $mainB = SlotRecord::newUnsaved( 'main', new TextContent( 'B' ) );
+               $auxA = SlotRecord::newUnsaved( 'aux', new TextContent( 'A' ) );
+               $auxB = SlotRecord::newUnsaved( 'aux', new TextContent( 'A' ) );
+
+               $initialRecord = $recordCreator( [ $mainA ], 12 );
+
+               return [
+                       'same record object' => [
+                               true,
+                               $initialRecord,
+                               $initialRecord,
+                       ],
+                       'same record content, different object' => [
+                               true,
+                               $recordCreator( [ $mainA ], 12 ),
+                               $recordCreator( [ $mainA ], 13 ),
+                       ],
+                       'same record content, aux slot, different object' => [
+                               true,
+                               $recordCreator( [ $auxA ], 12 ),
+                               $recordCreator( [ $auxB ], 13 ),
+                       ],
+                       'different content' => [
+                               false,
+                               $recordCreator( [ $mainA ], 12 ),
+                               $recordCreator( [ $mainB ], 13 ),
+                       ],
+                       'different content and number of slots' => [
+                               false,
+                               $recordCreator( [ $mainA ], 12 ),
+                               $recordCreator( [ $mainA, $mainB ], 13 ),
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideHasSameContent
+        * @covers \MediaWiki\Storage\RevisionRecord::hasSameContent
+        * @group Database
+        */
+       public function testHasSameContent(
+               $expected,
+               RevisionRecord $record1,
+               RevisionRecord $record2
+       ) {
+               $this->assertSame(
+                       $expected,
+                       $record1->hasSameContent( $record2 )
+               );
+       }
+
+       public function provideIsDeleted() {
+               yield 'no deletion' => [
+                       0,
+                       [
+                               RevisionRecord::DELETED_TEXT => false,
+                               RevisionRecord::DELETED_COMMENT => false,
+                               RevisionRecord::DELETED_USER => false,
+                               RevisionRecord::DELETED_RESTRICTED => false,
+                       ]
+               ];
+               yield 'text deleted' => [
+                       RevisionRecord::DELETED_TEXT,
+                       [
+                               RevisionRecord::DELETED_TEXT => true,
+                               RevisionRecord::DELETED_COMMENT => false,
+                               RevisionRecord::DELETED_USER => false,
+                               RevisionRecord::DELETED_RESTRICTED => false,
+                       ]
+               ];
+               yield 'text and comment deleted' => [
+                       RevisionRecord::DELETED_TEXT + RevisionRecord::DELETED_COMMENT,
+                       [
+                               RevisionRecord::DELETED_TEXT => true,
+                               RevisionRecord::DELETED_COMMENT => true,
+                               RevisionRecord::DELETED_USER => false,
+                               RevisionRecord::DELETED_RESTRICTED => false,
+                       ]
+               ];
+               yield 'all 4 deleted' => [
+                       RevisionRecord::DELETED_TEXT +
+                       RevisionRecord::DELETED_COMMENT +
+                       RevisionRecord::DELETED_RESTRICTED +
+                       RevisionRecord::DELETED_USER,
+                       [
+                               RevisionRecord::DELETED_TEXT => true,
+                               RevisionRecord::DELETED_COMMENT => true,
+                               RevisionRecord::DELETED_USER => true,
+                               RevisionRecord::DELETED_RESTRICTED => true,
+                       ]
+               ];
+       }
+
+       /**
+        * @dataProvider provideIsDeleted
+        * @covers \MediaWiki\Storage\RevisionRecord::isDeleted
+        */
+       public function testIsDeleted( $revDeleted, $assertionMap ) {
+               $rev = $this->newRevision( [ 'rev_deleted' => $revDeleted ] );
+               foreach ( $assertionMap as $deletionLevel => $expected ) {
+                       $this->assertSame( $expected, $rev->isDeleted( $deletionLevel ) );
+               }
+       }
+
+}
diff --git a/tests/phpunit/includes/Storage/RevisionStoreTest.php b/tests/phpunit/includes/Storage/RevisionStoreTest.php
new file mode 100644 (file)
index 0000000..efad1b1
--- /dev/null
@@ -0,0 +1,291 @@
+<?php
+
+namespace MediaWiki\Tests\Storage;
+
+use MediaWiki\Storage\RevisionStore;
+use MediaWiki\Storage\SqlBlobStore;
+use MediaWikiTestCase;
+use WANObjectCache;
+use Wikimedia\Rdbms\LoadBalancer;
+
+class RevisionStoreTest extends MediaWikiTestCase {
+
+       /**
+        * @param LoadBalancer $loadBalancer
+        * @param SqlBlobStore $blobStore
+        * @param WANObjectCache $WANObjectCache
+        *
+        * @return RevisionStore
+        */
+       private function getRevisionStore(
+               $loadBalancer = null,
+               $blobStore = null,
+               $WANObjectCache = null
+       ) {
+               return new RevisionStore(
+                       $loadBalancer ? $loadBalancer : $this->getMockLoadBalancer(),
+                       $blobStore ? $blobStore : $this->getMockSqlBlobStore(),
+                       $WANObjectCache ? $WANObjectCache : $this->getHashWANObjectCache()
+               );
+       }
+
+       /**
+        * @return \PHPUnit_Framework_MockObject_MockObject|LoadBalancer
+        */
+       private function getMockLoadBalancer() {
+               return $this->getMockBuilder( LoadBalancer::class )
+                       ->disableOriginalConstructor()->getMock();
+       }
+
+       /**
+        * @return \PHPUnit_Framework_MockObject_MockObject|SqlBlobStore
+        */
+       private function getMockSqlBlobStore() {
+               return $this->getMockBuilder( SqlBlobStore::class )
+                       ->disableOriginalConstructor()->getMock();
+       }
+
+       private function getHashWANObjectCache() {
+               return new WANObjectCache( [ 'cache' => new \HashBagOStuff() ] );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getContentHandlerUseDB
+        * @covers \MediaWiki\Storage\RevisionStore::setContentHandlerUseDB
+        */
+       public function testGetSetContentHandlerDb() {
+               $store = $this->getRevisionStore();
+               $this->assertTrue( $store->getContentHandlerUseDB() );
+               $store->setContentHandlerUseDB( false );
+               $this->assertFalse( $store->getContentHandlerUseDB() );
+               $store->setContentHandlerUseDB( true );
+               $this->assertTrue( $store->getContentHandlerUseDB() );
+       }
+
+       private function getDefaultQueryFields() {
+               return [
+                       'rev_id',
+                       'rev_page',
+                       'rev_text_id',
+                       'rev_timestamp',
+                       'rev_user_text',
+                       'rev_user',
+                       'rev_minor_edit',
+                       'rev_deleted',
+                       'rev_len',
+                       'rev_parent_id',
+                       'rev_sha1',
+               ];
+       }
+
+       private function getCommentQueryFields() {
+               return [
+                       'rev_comment_text' => 'rev_comment',
+                       'rev_comment_data' => 'NULL',
+                       'rev_comment_cid' => 'NULL',
+               ];
+       }
+
+       private function getContentHandlerQueryFields() {
+               return [
+                       'rev_content_format',
+                       'rev_content_model',
+               ];
+       }
+
+       public function provideGetQueryInfo() {
+               yield [
+                       true,
+                       [],
+                       [
+                               'tables' => [ 'revision' ],
+                               'fields' => array_merge(
+                                       $this->getDefaultQueryFields(),
+                                       $this->getCommentQueryFields(),
+                                       $this->getContentHandlerQueryFields()
+                               ),
+                               'joins' => [],
+                       ]
+               ];
+               yield [
+                       false,
+                       [],
+                       [
+                               'tables' => [ 'revision' ],
+                               'fields' => array_merge(
+                                       $this->getDefaultQueryFields(),
+                                       $this->getCommentQueryFields()
+                               ),
+                               'joins' => [],
+                       ]
+               ];
+               yield [
+                       false,
+                       [ 'page' ],
+                       [
+                               'tables' => [ 'revision', 'page' ],
+                               'fields' => array_merge(
+                                       $this->getDefaultQueryFields(),
+                                       $this->getCommentQueryFields(),
+                                       [
+                                               'page_namespace',
+                                               'page_title',
+                                               'page_id',
+                                               'page_latest',
+                                               'page_is_redirect',
+                                               'page_len',
+                                       ]
+                               ),
+                               'joins' => [
+                                       'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ],
+                               ],
+                       ]
+               ];
+               yield [
+                       false,
+                       [ 'user' ],
+                       [
+                               'tables' => [ 'revision', 'user' ],
+                               'fields' => array_merge(
+                                       $this->getDefaultQueryFields(),
+                                       $this->getCommentQueryFields(),
+                                       [
+                                               'user_name',
+                                       ]
+                               ),
+                               'joins' => [
+                                       'user' => [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ],
+                               ],
+                       ]
+               ];
+               yield [
+                       false,
+                       [ 'text' ],
+                       [
+                               'tables' => [ 'revision', 'text' ],
+                               'fields' => array_merge(
+                                       $this->getDefaultQueryFields(),
+                                       $this->getCommentQueryFields(),
+                                       [
+                                               'old_text',
+                                               'old_flags',
+                                       ]
+                               ),
+                               'joins' => [
+                                       'text' => [ 'INNER JOIN', [ 'rev_text_id=old_id' ] ],
+                               ],
+                       ]
+               ];
+               yield [
+                       true,
+                       [ 'page', 'user', 'text' ],
+                       [
+                               'tables' => [ 'revision', 'page', 'user', 'text' ],
+                               'fields' => array_merge(
+                                       $this->getDefaultQueryFields(),
+                                       $this->getCommentQueryFields(),
+                                       $this->getContentHandlerQueryFields(),
+                                       [
+                                               'page_namespace',
+                                               'page_title',
+                                               'page_id',
+                                               'page_latest',
+                                               'page_is_redirect',
+                                               'page_len',
+                                               'user_name',
+                                               'old_text',
+                                               'old_flags',
+                                       ]
+                               ),
+                               'joins' => [
+                                       'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ],
+                                       'user' => [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ],
+                                       'text' => [ 'INNER JOIN', [ 'rev_text_id=old_id' ] ],
+                               ],
+                       ]
+               ];
+       }
+
+       /**
+        * @dataProvider provideGetQueryInfo
+        * @covers \MediaWiki\Storage\RevisionStore::getQueryInfo
+        */
+       public function testGetQueryInfo( $contentHandlerUseDb, $options, $expected ) {
+               $store = $this->getRevisionStore();
+               $store->setContentHandlerUseDB( $contentHandlerUseDb );
+               $this->assertEquals( $expected, $store->getQueryInfo( $options ) );
+       }
+
+       private function getDefaultArchiveFields() {
+               return [
+                       'ar_id',
+                       'ar_page_id',
+                       'ar_namespace',
+                       'ar_title',
+                       'ar_rev_id',
+                       'ar_text',
+                       'ar_text_id',
+                       'ar_timestamp',
+                       'ar_user_text',
+                       'ar_user',
+                       'ar_minor_edit',
+                       'ar_deleted',
+                       'ar_len',
+                       'ar_parent_id',
+                       'ar_sha1',
+               ];
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getArchiveQueryInfo
+        */
+       public function testGetArchiveQueryInfo_contentHandlerDb() {
+               $store = $this->getRevisionStore();
+               $store->setContentHandlerUseDB( true );
+               $this->assertEquals(
+                       [
+                               'tables' => [
+                                       'archive'
+                               ],
+                               'fields' => array_merge(
+                                       $this->getDefaultArchiveFields(),
+                                       [
+                                               'ar_comment_text' => 'ar_comment',
+                                               'ar_comment_data' => 'NULL',
+                                               'ar_comment_cid' => 'NULL',
+                                               'ar_content_format',
+                                               'ar_content_model',
+                                       ]
+                               ),
+                               'joins' => [],
+                       ],
+                       $store->getArchiveQueryInfo()
+               );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\RevisionStore::getArchiveQueryInfo
+        */
+       public function testGetArchiveQueryInfo_noContentHandlerDb() {
+               $store = $this->getRevisionStore();
+               $store->setContentHandlerUseDB( false );
+               $this->assertEquals(
+                       [
+                               'tables' => [
+                                       'archive'
+                               ],
+                               'fields' => array_merge(
+                                       $this->getDefaultArchiveFields(),
+                                       [
+                                               'ar_comment_text' => 'ar_comment',
+                                               'ar_comment_data' => 'NULL',
+                                               'ar_comment_cid' => 'NULL',
+                                       ]
+                               ),
+                               'joins' => [],
+                       ],
+                       $store->getArchiveQueryInfo()
+               );
+       }
+
+}
diff --git a/tests/phpunit/includes/Storage/SlotRecordTest.php b/tests/phpunit/includes/Storage/SlotRecordTest.php
new file mode 100644 (file)
index 0000000..27fcd0c
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+
+namespace MediaWiki\Tests\Storage;
+
+use MediaWiki\Storage\SlotRecord;
+use MediaWikiTestCase;
+use RuntimeException;
+use Wikimedia\Assert\ParameterTypeException;
+use WikitextContent;
+
+/**
+ * @covers \MediaWiki\Storage\SlotRecord
+ */
+class SlotRecordTest extends MediaWikiTestCase {
+
+       public function provideAContent() {
+               yield [ new WikitextContent( 'A' ) ];
+               yield [
+                       function ( SlotRecord $slotRecord ) {
+                               if ( $slotRecord->getAddress() === 'tt:456' ) {
+                                       return new WikitextContent( 'A' );
+                               }
+                               throw new RuntimeException( 'Got Wrong SlotRecord for callback' );
+                       },
+               ];
+       }
+
+       /**
+        * @dataProvider provideAContent
+        */
+       public function testValidConstruction( $content ) {
+               $row = (object)[
+                       'cont_size' => '1',
+                       'cont_sha1' => 'someHash',
+                       'cont_address' => 'tt:456',
+                       'model_name' => 'aModelname',
+                       'slot_revision' => '2',
+                       'format_name' => 'someFormatName',
+                       'role_name' => 'myRole',
+                       'slot_inherited' => '99'
+               ];
+
+               $record = new SlotRecord( $row, $content );
+
+               $this->assertSame( 'A', $record->getContent()->getNativeData() );
+               $this->assertSame( 1, $record->getSize() );
+               $this->assertSame( 'someHash', $record->getSha1() );
+               $this->assertSame( 'aModelname', $record->getModel() );
+               $this->assertSame( 2, $record->getRevision() );
+               $this->assertSame( 'tt:456', $record->getAddress() );
+               $this->assertSame( 'someFormatName', $record->getFormat() );
+               $this->assertSame( 'myRole', $record->getRole() );
+               $this->assertTrue( $record->hasAddress() );
+               $this->assertTrue( $record->hasRevision() );
+               $this->assertTrue( $record->isInherited() );
+       }
+
+       public function provideInvalidConstruction() {
+               yield 'both null' => [ null, null ];
+               yield 'null row' => [ null, new WikitextContent( 'A' ) ];
+               yield 'array row' => [ null, new WikitextContent( 'A' ) ];
+               yield 'null content' => [ (object)[], null ];
+       }
+
+       /**
+        * @dataProvider provideInvalidConstruction
+        */
+       public function testInvalidConstruction( $row, $content ) {
+               $this->setExpectedException( ParameterTypeException::class );
+               new SlotRecord( $row, $content );
+       }
+
+       public function testHasAddress_false() {
+               $record = new SlotRecord( (object)[], new WikitextContent( 'A' ) );
+               $this->assertFalse( $record->hasAddress() );
+       }
+
+       public function testHasRevision_false() {
+               $record = new SlotRecord( (object)[], new WikitextContent( 'A' ) );
+               $this->assertFalse( $record->hasRevision() );
+       }
+
+       public function testInInherited_false() {
+               // TODO unskip me once fixed.
+               $this->markTestSkipped( 'Should probably return false, needs fixing?' );
+               $record = new SlotRecord( (object)[], new WikitextContent( 'A' ) );
+               $this->assertFalse( $record->isInherited() );
+       }
+
+}
diff --git a/tests/phpunit/includes/Storage/SqlBlobStoreTest.php b/tests/phpunit/includes/Storage/SqlBlobStoreTest.php
new file mode 100644 (file)
index 0000000..6d2b09b
--- /dev/null
@@ -0,0 +1,206 @@
+<?php
+
+namespace MediaWiki\Tests\Storage;
+
+use Language;
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\SqlBlobStore;
+use MediaWikiTestCase;
+use stdClass;
+use TitleValue;
+
+/**
+ * @covers \MediaWiki\Storage\SqlBlobStore
+ * @group Database
+ */
+class SqlBlobStoreTest extends MediaWikiTestCase {
+
+       /**
+        * @return SqlBlobStore
+        */
+       public function getBlobStore( $legacyEncoding = false, $compressRevisions = false ) {
+               $services = MediaWikiServices::getInstance();
+
+               $store = new SqlBlobStore(
+                       $services->getDBLoadBalancer(),
+                       $services->getMainWANObjectCache()
+               );
+
+               if ( $compressRevisions ) {
+                       $store->setCompressBlobs( $compressRevisions );
+               }
+               if ( $legacyEncoding ) {
+                       $store->setLegacyEncoding( $legacyEncoding, Language::factory( 'en' ) );
+               }
+
+               return $store;
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\SqlBlobStore::getCompressBlobs()
+        * @covers \MediaWiki\Storage\SqlBlobStore::setCompressBlobs()
+        */
+       public function testGetSetCompressRevisions() {
+               $store = $this->getBlobStore();
+               $this->assertFalse( $store->getCompressBlobs() );
+               $store->setCompressBlobs( true );
+               $this->assertTrue( $store->getCompressBlobs() );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\SqlBlobStore::getLegacyEncoding()
+        * @covers \MediaWiki\Storage\SqlBlobStore::getLegacyEncodingConversionLang()
+        * @covers \MediaWiki\Storage\SqlBlobStore::setLegacyEncoding()
+        */
+       public function testGetSetLegacyEncoding() {
+               $store = $this->getBlobStore();
+               $this->assertFalse( $store->getLegacyEncoding() );
+               $this->assertNull( $store->getLegacyEncodingConversionLang() );
+               $en = Language::factory( 'en' );
+               $store->setLegacyEncoding( 'foo', $en );
+               $this->assertSame( 'foo', $store->getLegacyEncoding() );
+               $this->assertSame( $en, $store->getLegacyEncodingConversionLang() );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\SqlBlobStore::getCacheExpiry()
+        * @covers \MediaWiki\Storage\SqlBlobStore::setCacheExpiry()
+        */
+       public function testGetSetCacheExpiry() {
+               $store = $this->getBlobStore();
+               $this->assertSame( 604800, $store->getCacheExpiry() );
+               $store->setCacheExpiry( 12 );
+               $this->assertSame( 12, $store->getCacheExpiry() );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\SqlBlobStore::getUseExternalStore()
+        * @covers \MediaWiki\Storage\SqlBlobStore::setUseExternalStore()
+        */
+       public function testGetSetUseExternalStore() {
+               $store = $this->getBlobStore();
+               $this->assertFalse( $store->getUseExternalStore() );
+               $store->setUseExternalStore( true );
+               $this->assertTrue( $store->getUseExternalStore() );
+       }
+
+       public function provideDecompress() {
+               yield '(no legacy encoding), false in false out' => [ false, false, [], false ];
+               yield '(no legacy encoding), empty in empty out' => [ false, '', [], '' ];
+               yield '(no legacy encoding), empty in empty out' => [ false, 'A', [], 'A' ];
+               yield '(no legacy encoding), string in with gzip flag returns string' => [
+                       // gzip string below generated with gzdeflate( 'AAAABBAAA' )
+                       false, "sttttr\002\022\000", [ 'gzip' ], 'AAAABBAAA',
+               ];
+               yield '(no legacy encoding), string in with object flag returns false' => [
+                       // gzip string below generated with serialize( 'JOJO' )
+                       false, "s:4:\"JOJO\";", [ 'object' ], false,
+               ];
+               yield '(no legacy encoding), serialized object in with object flag returns string' => [
+                       false,
+                       // Using a TitleValue object as it has a getText method (which is needed)
+                       serialize( new TitleValue( 0, 'HHJJDDFF' ) ),
+                       [ 'object' ],
+                       'HHJJDDFF',
+               ];
+               yield '(no legacy encoding), serialized object in with object & gzip flag returns string' => [
+                       false,
+                       // Using a TitleValue object as it has a getText method (which is needed)
+                       gzdeflate( serialize( new TitleValue( 0, '8219JJJ840' ) ) ),
+                       [ 'object', 'gzip' ],
+                       '8219JJJ840',
+               ];
+               yield '(ISO-8859-1 encoding), string in string out' => [
+                       'ISO-8859-1',
+                       iconv( 'utf-8', 'ISO-8859-1', "1®Àþ1" ),
+                       [],
+                       '1®Àþ1',
+               ];
+               yield '(ISO-8859-1 encoding), serialized object in with gzip flags returns string' => [
+                       'ISO-8859-1',
+                       gzdeflate( iconv( 'utf-8', 'ISO-8859-1', "4®Àþ4" ) ),
+                       [ 'gzip' ],
+                       '4®Àþ4',
+               ];
+               yield '(ISO-8859-1 encoding), serialized object in with object flags returns string' => [
+                       'ISO-8859-1',
+                       serialize( new TitleValue( 0, iconv( 'utf-8', 'ISO-8859-1', "3®Àþ3" ) ) ),
+                       [ 'object' ],
+                       '3®Àþ3',
+               ];
+               yield '(ISO-8859-1 encoding), serialized object in with object & gzip flags returns string' => [
+                       'ISO-8859-1',
+                       gzdeflate( serialize( new TitleValue( 0, iconv( 'utf-8', 'ISO-8859-1', "2®Àþ2" ) ) ) ),
+                       [ 'gzip', 'object' ],
+                       '2®Àþ2',
+               ];
+       }
+
+       /**
+        * @dataProvider provideDecompress
+        * @covers \MediaWiki\Storage\SqlBlobStore::decompressData
+        *
+        * @param string|bool $legacyEncoding
+        * @param mixed $data
+        * @param array $flags
+        * @param mixed $expected
+        */
+       public function testDecompressData( $legacyEncoding, $data, $flags, $expected ) {
+               $store = $this->getBlobStore( $legacyEncoding );
+               $this->assertSame(
+                       $expected,
+                       $store->decompressData( $data, $flags )
+               );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\SqlBlobStore::compressData
+        */
+       public function testCompressRevisionTextUtf8() {
+               $store = $this->getBlobStore();
+               $row = new stdClass;
+               $row->old_text = "Wiki est l'\xc3\xa9cole superieur !";
+               $row->old_flags = $store->compressData( $row->old_text );
+               $this->assertTrue( false !== strpos( $row->old_flags, 'utf-8' ),
+                       "Flags should contain 'utf-8'" );
+               $this->assertFalse( false !== strpos( $row->old_flags, 'gzip' ),
+                       "Flags should not contain 'gzip'" );
+               $this->assertEquals( "Wiki est l'\xc3\xa9cole superieur !",
+                       $row->old_text, "Direct check" );
+       }
+
+       /**
+        * @covers \MediaWiki\Storage\SqlBlobStore::compressData
+        */
+       public function testCompressRevisionTextUtf8Gzip() {
+               $store = $this->getBlobStore( false, true );
+               $this->checkPHPExtension( 'zlib' );
+
+               $row = new stdClass;
+               $row->old_text = "Wiki est l'\xc3\xa9cole superieur !";
+               $row->old_flags = $store->compressData( $row->old_text );
+               $this->assertTrue( false !== strpos( $row->old_flags, 'utf-8' ),
+                       "Flags should contain 'utf-8'" );
+               $this->assertTrue( false !== strpos( $row->old_flags, 'gzip' ),
+                       "Flags should contain 'gzip'" );
+               $this->assertEquals( "Wiki est l'\xc3\xa9cole superieur !",
+                       gzinflate( $row->old_text ), "Direct check" );
+       }
+
+       public function provideBlobs() {
+               yield [ '' ];
+               yield [ 'someText' ];
+       }
+
+       /**
+        * @dataProvider provideBlobs
+        * @covers \MediaWiki\Storage\SqlBlobStore::storeBlob
+        * @covers \MediaWiki\Storage\SqlBlobStore::getBlob
+        */
+       public function testSimpleStoreGetBlobSimpleRoundtrip( $blob ) {
+               $store = $this->getBlobStore();
+               $address = $store->storeBlob( $blob );
+               $this->assertSame( $blob, $store->getBlob( $address ) );
+       }
+
+}
index e2aacae..395d12c 100644 (file)
@@ -101,7 +101,7 @@ class JobTest extends MediaWikiTestCase {
         * @covers Job::factory
         */
        public function testJobFactory( $handler ) {
-               $this->mergeMWGlobalArrayValue( 'wgJobClasses', [ 'testdummy' => $handler ] );
+               $this->mergeMwGlobalArrayValue( 'wgJobClasses', [ 'testdummy' => $handler ] );
 
                $job = Job::factory( 'testdummy', Title::newMainPage(), [] );
                $this->assertInstanceOf( NullJob::class, $job );
index b8480dd..2b803ae 100644 (file)
@@ -1678,7 +1678,7 @@ more stuff
        public function testInsertOn_idSpecified() {
                $title = Title::newFromText( __METHOD__ );
                $page = new WikiPage( $title );
-               $id = 3478952189;
+               $id = 1478952189;
 
                $result = $page->insertOn( $this->db, $id );
 
diff --git a/tests/phpunit/includes/watcheditem/WatchedItemIntegrationTest.php b/tests/phpunit/includes/watcheditem/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/watcheditem/WatchedItemUnitTest.php b/tests/phpunit/includes/watcheditem/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 );
-       }
-
-}
index d31779d..62ddace 100644 (file)
@@ -55,7 +55,7 @@ class ResourcesTest extends MediaWikiTestCase {
        public function testIllegalDependencies() {
                $data = self::getAllModules();
 
-               $illegalDeps = ResourceLoaderStartupModule::getStartupModules();
+               $illegalDeps = ResourceLoaderStartUpModule::getStartupModules();
                foreach ( $data['modules'] as $moduleName => $module ) {
                        if ( $module->isRaw() ) {
                                $illegalDeps[] = $moduleName;