r60879 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60878‎ | r60879 | r60880 >
Date:21:37, 9 January 2010
Author:aaron
Status:ok
Tags:
Comment:
Follow up r60878: same for old reviewed revs.
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -424,7 +424,11 @@
425425 $quality = FlaggedRevs::isQuality( $flags );
426426 $pristine = FlaggedRevs::isPristine( $flags );
427427 $text = $frev->getRevText();
428 - $parserOut = FlaggedRevs::parseStableText( $this->article, $text, $frev->getRevId() );
 428+ # Check if this is a redirect...
 429+ $redirHtml = $this->getRedirectHtml( $text );
 430+ if( $redirHtml == '' ) {
 431+ $parserOut = FlaggedRevs::parseStableText( $this->article, $text, $frev->getRevId() );
 432+ }
429433 # Construct some tagging for non-printable outputs. Note that the pending
430434 # notice has all this info already, so don't do this if we added that already.
431435 if( !$wgOut->isPrintable() ) {
@@ -461,7 +465,11 @@
462466 }
463467 # Output HTML
464468 $this->setReviewNotes( $frev );
465 - $wgOut->addParserOutput( $parserOut );
 469+ if( $redirHtml != '' ) {
 470+ $wgOut->addHtml( $redirHtml );
 471+ } else {
 472+ $wgOut->addParserOutput( $parserOut );
 473+ }
466474 # Index the stable version only
467475 $wgOut->setRobotPolicy( 'noindex,nofollow' );
468476 }
@@ -489,11 +497,10 @@
490498 if( $parserOut == false ) {
491499 $text = $srev->getRevText();
492500 # Check if this is a redirect...
493 - $rTarget = $this->article->followRedirectText( $text );
494 - if( $rTarget ) {
495 - $redirHtml = $this->article->viewRedirect( $rTarget );
496 - } else {
497 - $parserOut = FlaggedRevs::parseStableText( $this->article, $text, $srev->getRevId() );
 501+ $redirHtml = $this->getRedirectHtml( $text );
 502+ if( $redirHtml == '' ) {
 503+ $parserOut = FlaggedRevs::parseStableText(
 504+ $this->article, $text, $srev->getRevId() );
498505 # Update the stable version cache
499506 FlaggedRevs::updatePageCache( $this->article, $wgUser, $parserOut );
500507 }
@@ -547,6 +554,14 @@
548555 $wgOut->addParserOutput( $parserOut );
549556 }
550557 }
 558+
 559+ protected function getRedirectHtml( $text ) {
 560+ $rTarget = $this->article->followRedirectText( $text );
 561+ if( $rTarget ) {
 562+ return $this->article->viewRedirect( $rTarget );
 563+ }
 564+ return '';
 565+ }
551566
552567 /**
553568 * @param FlaggedRevision $srev, stable version

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r60878* Display redirects normally for redirect=no&stable=1 URLs (bug 22036)...aaron21:24, 9 January 2010

Status & tagging log