Addshore has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403391 )

Change subject: Revert "Revert "[MCR] Add and use $title param to 
RevisionStoregetPrevious/Next""
......................................................................

Revert "Revert "[MCR] Add and use $title param to 
RevisionStoregetPrevious/Next""

This is a partial revert of a revert that reverted a fix believed to
have had its underlying issue fixed in:
https://gerrit.wikimedia.org/r/#/c/400577/

The compat layer (Revision), now passes a Title object into the
RevisionStore, and this title is used to construct the Record and
also any new Revision objects.

Bug: T184559
Bug: T183548
Change-Id: Id073265c173f60aa8c456550fdb4bb5196013be8
---
M includes/Revision.php
M includes/Storage/RevisionStore.php
2 files changed, 18 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/91/403391/1

diff --git a/includes/Revision.php b/includes/Revision.php
index 10b896b..0174b24 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -923,18 +923,21 @@
         * @return Revision|null
         */
        public function getPrevious() {
-               $rec = self::getRevisionStore()->getPreviousRevision( 
$this->mRecord );
-               return $rec === null ? null : new Revision( $rec );
+               $title = $this->getTitle();
+               $rec = self::getRevisionStore()->getPreviousRevision( 
$this->mRecord, $title );
+               return $rec === null ? null : new Revision( $rec, 
self::READ_NORMAL, $title );
        }
 
-       /**
+
+               /**
         * Get next revision for this title
         *
         * @return Revision|null
         */
        public function getNext() {
-               $rec = self::getRevisionStore()->getNextRevision( 
$this->mRecord );
-               return $rec === null ? null : new Revision( $rec );
+               $title = $this->getTitle();
+               $rec = self::getRevisionStore()->getNextRevision( 
$this->mRecord, $title );
+               return $rec === null ? null : new Revision( $rec, 
self::READ_NORMAL, $title );
        }
 
        /**
diff --git a/includes/Storage/RevisionStore.php 
b/includes/Storage/RevisionStore.php
index 3101aea..e0ee06a 100644
--- a/includes/Storage/RevisionStore.php
+++ b/includes/Storage/RevisionStore.php
@@ -1707,11 +1707,14 @@
         * MCR migration note: this replaces Revision::getPrevious
         *
         * @param RevisionRecord $rev
+        * @param Title $title if known (optional)
         *
         * @return RevisionRecord|null
         */
-       public function getPreviousRevision( RevisionRecord $rev ) {
-               $title = $this->getTitle( $rev->getPageId(), $rev->getId() );
+       public function getPreviousRevision( RevisionRecord $rev, Title $title 
= null ) {
+               if ( $title === null ) {
+                       $title = $this->getTitle( $rev->getPageId(), 
$rev->getId() );
+               }
                $prev = $title->getPreviousRevisionID( $rev->getId() );
                if ( $prev ) {
                        return $this->getRevisionByTitle( $title, $prev );
@@ -1725,11 +1728,14 @@
         * MCR migration note: this replaces Revision::getNext
         *
         * @param RevisionRecord $rev
+        * @param Title $title if known (optional)
         *
         * @return RevisionRecord|null
         */
-       public function getNextRevision( RevisionRecord $rev ) {
-               $title = $this->getTitle( $rev->getPageId(), $rev->getId() );
+       public function getNextRevision( RevisionRecord $rev, Title $title = 
null ) {
+               if ( $title === null ) {
+                       $title = $this->getTitle( $rev->getPageId(), 
$rev->getId() );
+               }
                $next = $title->getNextRevisionID( $rev->getId() );
                if ( $next ) {
                        return $this->getRevisionByTitle( $title, $next );

-- 
To view, visit https://gerrit.wikimedia.org/r/403391
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id073265c173f60aa8c456550fdb4bb5196013be8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to