Merge "[FileBackend] Reduced stat calls when using the multiwrite backend."
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index 08154c7..3846473 100644 (file)
@@ -179,6 +179,22 @@ class DifferenceEngine extends ContextSource {
                }
        }
 
+       private function showMissingRevision() {
+               $out = $this->getOutput();
+
+               $missing = array();
+               if ( $this->mOldRev === null ) {
+                       $missing[] = $this->deletedIdMarker( $this->mOldid );
+               }
+               if ( $this->mNewRev === null ) {
+                       $missing[] = $this->deletedIdMarker( $this->mNewid );
+               }
+
+               $out->setPageTitle( $this->msg( 'errorpagetitle' ) );
+               $out->addWikiMsg( 'difference-missing-revision',
+                       $this->getLanguage()->listToText( $missing ), count( $missing ) );
+       }
+
        function showDiffPage( $diffOnly = false ) {
                wfProfileIn( __METHOD__ );
 
@@ -188,13 +204,7 @@ class DifferenceEngine extends ContextSource {
                $out->setRobotPolicy( 'noindex,nofollow' );
 
                if ( !$this->loadRevisionData() ) {
-                       // Sounds like a deleted revision... Let's see what we can do.
-                       $t = $this->getTitle()->getPrefixedText();
-                       $d = $this->msg( 'missingarticle-diff',
-                               $this->deletedIdMarker( $this->mOldid ),
-                               $this->deletedIdMarker( $this->mNewid ) )->escaped();
-                       $out->setPageTitle( $this->msg( 'errorpagetitle' ) );
-                       $out->addWikiMsg( 'missing-article', "<nowiki>$t</nowiki>", "<span class='plainlinks'>$d</span>" );
+                       $this->showMissingRevision();
                        wfProfileOut( __METHOD__ );
                        return;
                }
@@ -557,7 +567,7 @@ class DifferenceEngine extends ContextSource {
        function showDiff( $otitle, $ntitle, $notice = '' ) {
                $diff = $this->getDiff( $otitle, $ntitle, $notice );
                if ( $diff === false ) {
-                       $this->getOutput()->addWikiMsg( 'missing-article', "<nowiki>(fixme, bug)</nowiki>", '' );
+                       $this->showMissingRevision();
                        return false;
                } else {
                        $this->showDiffStyle();
@@ -882,7 +892,8 @@ class DifferenceEngine extends ContextSource {
                        }
 
                        $msg = $this->msg( $title->quickUserCan( 'edit', $user ) ? 'editold' : 'viewsourceold' )->escaped();
-                       $header .= ' (' . Linker::linkKnown( $title, $msg, array(), $editQuery ) . ')';
+                       $header .= ' ' . $this->msg( 'parentheses' )->rawParams(
+                               Linker::linkKnown( $title, $msg, array(), $editQuery ) )->plain();
                        if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
                                $header = Html::rawElement( 'span', array( 'class' => 'history-deleted' ), $header );
                        }
@@ -906,7 +917,7 @@ class DifferenceEngine extends ContextSource {
 
                if ( !$diff && !$otitle ) {
                        $header .= "
-                       <tr valign='top'>
+                       <tr style='vertical-align: top;'>
                        <td class='diff-ntitle'>{$ntitle}</td>
                        </tr>";
                        $multiColspan = 1;
@@ -924,17 +935,17 @@ class DifferenceEngine extends ContextSource {
                                $multiColspan = 2;
                        }
                        $header .= "
-                       <tr valign='top'>
+                       <tr style='vertical-align: top;'>
                        <td colspan='$colspan' class='diff-otitle'>{$otitle}</td>
                        <td colspan='$colspan' class='diff-ntitle'>{$ntitle}</td>
                        </tr>";
                }
 
                if ( $multi != '' ) {
-                       $header .= "<tr><td colspan='{$multiColspan}' align='center' class='diff-multi'>{$multi}</td></tr>";
+                       $header .= "<tr><td colspan='{$multiColspan}' style='text-align: center;' class='diff-multi'>{$multi}</td></tr>";
                }
                if ( $notice != '' ) {
-                       $header .= "<tr><td colspan='{$multiColspan}' align='center'>{$notice}</td></tr>";
+                       $header .= "<tr><td colspan='{$multiColspan}' style='text-align: center;'>{$notice}</td></tr>";
                }
 
                return $header . $diff . "</table>";
@@ -1019,7 +1030,7 @@ class DifferenceEngine extends ContextSource {
                // Load the new revision object
                $this->mNewRev = $this->mNewid
                        ? Revision::newFromId( $this->mNewid )
-                       : Revision::newFromTitle( $this->getTitle(), false, Revision::AVOID_MASTER );
+                       : Revision::newFromTitle( $this->getTitle(), false, Revision::READ_NORMAL );
 
                if ( !$this->mNewRev instanceof Revision ) {
                        return false;