Fix whitespace issues around parentheses
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index de8dd43..ac29ae0 100644 (file)
@@ -714,7 +714,7 @@ class DifferenceEngine extends ContextSource {
                        if ( !$this->mRefreshCache ) {
                                $difftext = $wgMemc->get( $key );
                                if ( $difftext ) {
-                                       wfIncrStats( 'diff_cache_hit' );
+                                       wfIncrStats( 'diff_cache.hit' );
                                        $difftext = $this->localiseLineNumbers( $difftext );
                                        $difftext .= "\n<!-- diff cache key $key -->\n";
 
@@ -734,12 +734,12 @@ class DifferenceEngine extends ContextSource {
 
                // Save to cache for 7 days
                if ( !Hooks::run( 'AbortDiffCache', array( &$this ) ) ) {
-                       wfIncrStats( 'diff_uncacheable' );
+                       wfIncrStats( 'diff_cache.uncacheable' );
                } elseif ( $key !== false && $difftext !== false ) {
-                       wfIncrStats( 'diff_cache_miss' );
+                       wfIncrStats( 'diff_cache.miss' );
                        $wgMemc->set( $key, $difftext, 7 * 86400 );
                } else {
-                       wfIncrStats( 'diff_uncacheable' );
+                       wfIncrStats( 'diff_cache.uncacheable' );
                }
                // Replace line numbers with the text in the user's language
                if ( $difftext !== false ) {
@@ -1040,7 +1040,7 @@ class DifferenceEngine extends ContextSource {
                        $key = $title->quickUserCan( 'edit', $user ) ? 'editold' : 'viewsourceold';
                        $msg = $this->msg( $key )->escaped();
                        $editLink = $this->msg( 'parentheses' )->rawParams(
-                               Linker::linkKnown( $title, $msg, array( ), $editQuery ) )->escaped();
+                               Linker::linkKnown( $title, $msg, array(), $editQuery ) )->escaped();
                        $header .= ' ' . Html::rawElement(
                                'span',
                                array( 'class' => 'mw-diff-edit' ),
@@ -1077,10 +1077,11 @@ class DifferenceEngine extends ContextSource {
                // is often in a different language, mostly the page content language/dir
                $tableClass = 'diff diff-contentalign-' . htmlspecialchars( $this->getDiffLang()->alignStart() );
                $header = "<table class='$tableClass'>";
+               $userLang = htmlspecialchars( $this->getLanguage()->getHtmlCode() );
 
                if ( !$diff && !$otitle ) {
                        $header .= "
-                       <tr style='vertical-align: top;'>
+                       <tr style='vertical-align: top;' lang='{$userLang}'>
                        <td class='diff-ntitle'>{$ntitle}</td>
                        </tr>";
                        $multiColspan = 1;
@@ -1099,7 +1100,7 @@ class DifferenceEngine extends ContextSource {
                        }
                        if ( $otitle || $ntitle ) {
                                $header .= "
-                               <tr style='vertical-align: top;'>
+                               <tr style='vertical-align: top;' lang='{$userLang}'>
                                <td colspan='$colspan' class='diff-otitle'>{$otitle}</td>
                                <td colspan='$colspan' class='diff-ntitle'>{$ntitle}</td>
                                </tr>";
@@ -1108,10 +1109,11 @@ class DifferenceEngine extends ContextSource {
 
                if ( $multi != '' ) {
                        $header .= "<tr><td colspan='{$multiColspan}' style='text-align: center;' " .
-                               "class='diff-multi'>{$multi}</td></tr>";
+                               "class='diff-multi' lang='{$userLang}'>{$multi}</td></tr>";
                }
                if ( $notice != '' ) {
-                       $header .= "<tr><td colspan='{$multiColspan}' style='text-align: center;'>{$notice}</td></tr>";
+                       $header .= "<tr><td colspan='{$multiColspan}' style='text-align: center;' " .
+                               "lang='{$userLang}'>{$notice}</td></tr>";
                }
 
                return $header . $diff . "</table>";
@@ -1233,12 +1235,6 @@ 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(),