Fallback to read from master in DifferenceEngine::loadRevisionData
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index 1bd2092..de8dd43 100644 (file)
@@ -94,6 +94,10 @@ class DifferenceEngine extends ContextSource {
 
        /** @var bool Show rev_deleted content if allowed */
        protected $unhide = false;
+
+       /** @var bool Refresh the diff cache */
+       protected $mRefreshCache = false;
+
        /**#@-*/
 
        /**
@@ -546,7 +550,7 @@ class DifferenceEngine extends ContextSource {
                $out = $this->getOutput();
                $revHeader = $this->getRevisionHeader( $this->mNewRev );
                # Add "current version as of X" title
-               $out->addHTML( "<hr class='diff-hr' />
+               $out->addHTML( "<hr class='diff-hr' id='mw-oldid' />
                <h2 class='diff-currentversion-title'>{$revHeader}</h2>\n" );
                # Page content may be handled by a hooked call instead...
                # @codingStandardsIgnoreStart Ignoring long lines.
@@ -1229,6 +1233,12 @@ class DifferenceEngine extends ContextSource {
                // Load the new revision object
                if ( $this->mNewid ) {
                        $this->mNewRev = Revision::newFromId( $this->mNewid );
+
+                       if ( !$this->mNewRev && wfGetLB()->getServerCount() > 1 ) {
+                               // Try harder… This is being hit after a rollback where we show the
+                               // diff immediately after the edit happened. T93866
+                               $this->mNewRev = Revision::newFromId( $this->mNewid, Revision::READ_LATEST );
+                       }
                } else {
                        $this->mNewRev = Revision::newFromTitle(
                                $this->getTitle(),