Index: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php |
— | — | @@ -349,14 +349,14 @@ |
350 | 350 | // requesting the stable revision ("&stableid=x"), defer to override |
351 | 351 | // behavior below, since it is the same as ("&stable=1"). |
352 | 352 | 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 ); |
355 | 355 | $useParserCache = false; |
356 | 356 | // Stable version requested by ID or relevant conditions met to |
357 | 357 | // to override page view with the stable version. |
358 | 358 | } 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 ); |
361 | 361 | $useParserCache = false; |
362 | 362 | // Looking at some specific old revision (&oldid=x) or if FlaggedRevs is not |
363 | 363 | // set to override given the relevant conditions (like &stable=0) or there |
— | — | @@ -433,11 +433,12 @@ |
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
| 437 | + * Tag output function must be called by caller |
| 438 | + * Parser cache control deferred to caller |
437 | 439 | * @param $srev stable version |
438 | 440 | * @param $tag review box/bar info |
439 | 441 | * @param $prot protection notice icon |
440 | | - * Tag output function must be called by caller |
441 | | - * Parser cache control deferred to caller |
| 442 | + * @return void |
442 | 443 | */ |
443 | 444 | protected function showDraftVersion( FlaggedRevision $srev, &$tag, $prot ) { |
444 | 445 | global $wgUser, $wgLang, $wgRequest; |
— | — | @@ -543,12 +544,13 @@ |
544 | 545 | } |
545 | 546 | |
546 | 547 | /** |
| 548 | + * Tag output function must be called by caller |
| 549 | + * Parser cache control deferred to caller |
547 | 550 | * @param $srev stable version |
548 | 551 | * @param $frev selected flagged revision |
549 | 552 | * @param $tag review box/bar info |
550 | 553 | * @param $prot protection notice icon |
551 | | - * Tag output function must be called by caller |
552 | | - * Parser cache control deferred to caller |
| 554 | + * @return ParserOutput |
553 | 555 | */ |
554 | 556 | protected function showOldReviewedVersion( FlaggedRevision $frev, &$tag, $prot ) { |
555 | 557 | global $wgUser, $wgLang; |
— | — | @@ -610,20 +612,23 @@ |
611 | 613 | $redirHtml = $this->getRedirectHtml( $text ); |
612 | 614 | if ( $redirHtml == '' ) { // page is not a redirect... |
613 | 615 | # Add the stable output to the page view |
614 | | - $this->addParserOutput( $parserOut ); |
| 616 | + $this->out->addParserOutput( $parserOut ); |
615 | 617 | } else { // page is a redirect... |
616 | 618 | $this->out->addHtml( $redirHtml ); |
617 | 619 | # Add output to set categories, displaytitle, etc. |
618 | 620 | $this->out->addParserOutputNoText( $parserOut ); |
619 | 621 | } |
| 622 | + |
| 623 | + return $parserOut; |
620 | 624 | } |
621 | 625 | |
622 | 626 | /** |
| 627 | + * Tag output function must be called by caller |
| 628 | + * Parser cache control deferred to caller |
623 | 629 | * @param $srev stable version |
624 | 630 | * @param $tag review box/bar info |
625 | 631 | * @param $prot protection notice |
626 | | - * Tag output function must be called by caller |
627 | | - * Parser cache control deferred to caller |
| 632 | + * @return ParserOutput |
628 | 633 | */ |
629 | 634 | protected function showStableVersion( FlaggedRevision $srev, &$tag, $prot ) { |
630 | 635 | global $wgLang, $wgUser; |
— | — | @@ -691,7 +696,7 @@ |
692 | 697 | $canReview = $this->article->getTitle()->userCan( 'review' ); |
693 | 698 | if ( $parserOut && ( !$canReview || FlaggedRevs::parserOutputIsVersioned( $parserOut ) ) ) { |
694 | 699 | # Cache hit. Note that redirects are not cached. |
695 | | - $this->addParserOutput( $parserOut ); |
| 700 | + $this->out->addParserOutput( $parserOut ); |
696 | 701 | } else { |
697 | 702 | $text = $srev->getRevText(); |
698 | 703 | # Get the new stable parser output... |
— | — | @@ -703,7 +708,7 @@ |
704 | 709 | # Update the stable version cache |
705 | 710 | $parserCache->save( $parserOut, $this->article, $pOpts ); |
706 | 711 | # Add the stable output to the page view |
707 | | - $this->addParserOutput( $parserOut ); |
| 712 | + $this->out->addParserOutput( $parserOut ); |
708 | 713 | } else { // page is a redirect... |
709 | 714 | $this->out->addHtml( $redirHtml ); |
710 | 715 | # Add output to set categories, displaytitle, etc. |
— | — | @@ -720,17 +725,8 @@ |
721 | 726 | $this->article->updateSyncStatus( $synced ); |
722 | 727 | } |
723 | 728 | } |
724 | | - } |
725 | 729 | |
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; |
735 | 731 | } |
736 | 732 | |
737 | 733 | // Get fancy redirect arrow and link HTML |