r98032 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98031‎ | r98032 | r98033 >
Date:21:15, 24 September 2011
Author:aaron
Status:ok
Tags:post1.18deploy 
Comment:
* (bug 31144) __NOINDEX__should apply to stable versions of pages. Builds off r98030.
* Removed displaytitle duplication
Modified paths:
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php
@@ -349,14 +349,14 @@
350350 // requesting the stable revision ("&stableid=x"), defer to override
351351 // behavior below, since it is the same as ("&stable=1").
352352 if ( $old ) {
353 - $this->showOldReviewedVersion( $frev, $tag, $prot );
354 - $outputDone = true; # Tell MW that parser output is done
 353+ # Tell MW that parser output is done by setting $outputDone
 354+ $outputDone = $this->showOldReviewedVersion( $frev, $tag, $prot );
355355 $useParserCache = false;
356356 // Stable version requested by ID or relevant conditions met to
357357 // to override page view with the stable version.
358358 } elseif ( $stable || $this->showingStable() ) {
359 - $this->showStableVersion( $srev, $tag, $prot );
360 - $outputDone = true; # Tell MW that parser output is done
 359+ # Tell MW that parser output is done by setting $outputDone
 360+ $outputDone = $this->showStableVersion( $srev, $tag, $prot );
361361 $useParserCache = false;
362362 // Looking at some specific old revision (&oldid=x) or if FlaggedRevs is not
363363 // set to override given the relevant conditions (like &stable=0) or there
@@ -433,11 +433,12 @@
434434 }
435435
436436 /**
 437+ * Tag output function must be called by caller
 438+ * Parser cache control deferred to caller
437439 * @param $srev stable version
438440 * @param $tag review box/bar info
439441 * @param $prot protection notice icon
440 - * Tag output function must be called by caller
441 - * Parser cache control deferred to caller
 442+ * @return void
442443 */
443444 protected function showDraftVersion( FlaggedRevision $srev, &$tag, $prot ) {
444445 global $wgUser, $wgLang, $wgRequest;
@@ -543,12 +544,13 @@
544545 }
545546
546547 /**
 548+ * Tag output function must be called by caller
 549+ * Parser cache control deferred to caller
547550 * @param $srev stable version
548551 * @param $frev selected flagged revision
549552 * @param $tag review box/bar info
550553 * @param $prot protection notice icon
551 - * Tag output function must be called by caller
552 - * Parser cache control deferred to caller
 554+ * @return ParserOutput
553555 */
554556 protected function showOldReviewedVersion( FlaggedRevision $frev, &$tag, $prot ) {
555557 global $wgUser, $wgLang;
@@ -610,20 +612,23 @@
611613 $redirHtml = $this->getRedirectHtml( $text );
612614 if ( $redirHtml == '' ) { // page is not a redirect...
613615 # Add the stable output to the page view
614 - $this->addParserOutput( $parserOut );
 616+ $this->out->addParserOutput( $parserOut );
615617 } else { // page is a redirect...
616618 $this->out->addHtml( $redirHtml );
617619 # Add output to set categories, displaytitle, etc.
618620 $this->out->addParserOutputNoText( $parserOut );
619621 }
 622+
 623+ return $parserOut;
620624 }
621625
622626 /**
 627+ * Tag output function must be called by caller
 628+ * Parser cache control deferred to caller
623629 * @param $srev stable version
624630 * @param $tag review box/bar info
625631 * @param $prot protection notice
626 - * Tag output function must be called by caller
627 - * Parser cache control deferred to caller
 632+ * @return ParserOutput
628633 */
629634 protected function showStableVersion( FlaggedRevision $srev, &$tag, $prot ) {
630635 global $wgLang, $wgUser;
@@ -691,7 +696,7 @@
692697 $canReview = $this->article->getTitle()->userCan( 'review' );
693698 if ( $parserOut && ( !$canReview || FlaggedRevs::parserOutputIsVersioned( $parserOut ) ) ) {
694699 # Cache hit. Note that redirects are not cached.
695 - $this->addParserOutput( $parserOut );
 700+ $this->out->addParserOutput( $parserOut );
696701 } else {
697702 $text = $srev->getRevText();
698703 # Get the new stable parser output...
@@ -703,7 +708,7 @@
704709 # Update the stable version cache
705710 $parserCache->save( $parserOut, $this->article, $pOpts );
706711 # Add the stable output to the page view
707 - $this->addParserOutput( $parserOut );
 712+ $this->out->addParserOutput( $parserOut );
708713 } else { // page is a redirect...
709714 $this->out->addHtml( $redirHtml );
710715 # Add output to set categories, displaytitle, etc.
@@ -720,17 +725,8 @@
721726 $this->article->updateSyncStatus( $synced );
722727 }
723728 }
724 - }
725729
726 - // Add parser output and update title
727 - // @TODO: refactor MW core to move this back
728 - protected function addParserOutput( ParserOutput $parserOut ) {
729 - $this->out->addParserOutput( $parserOut );
730 - # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
731 - $titleText = $parserOut->getTitleText();
732 - if ( strval( $titleText ) !== '' ) {
733 - $this->out->setPageTitle( $titleText );
734 - }
 730+ return $parserOut;
735731 }
736732
737733 // Get fancy redirect arrow and link HTML

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98030Article refactoring and changes for bug 31144. Dependency inject ParserOutput...aaron21:12, 24 September 2011

Status & tagging log