Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php |
— | — | @@ -283,6 +283,7 @@ |
284 | 284 | } |
285 | 285 | # Environment (e.g. $wgTitle) will change in MediaWiki::initializeArticle |
286 | 286 | if ( $clearEnvironment ) $view->clear(); |
| 287 | + |
287 | 288 | return true; |
288 | 289 | } |
289 | 290 | |
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php |
— | — | @@ -60,9 +60,9 @@ |
61 | 61 | * or false if there isn't such a title |
62 | 62 | */ |
63 | 63 | public static function globalArticleInstance() { |
64 | | - global $wgTitle; |
65 | | - if ( !empty( $wgTitle ) ) { |
66 | | - return FlaggedPage::getTitleInstance( $wgTitle ); |
| 64 | + $title = RequestContext::getMain()->getTitle(); |
| 65 | + if ( $title ) { |
| 66 | + return FlaggedPage::getTitleInstance( $title ); |
67 | 67 | } |
68 | 68 | return null; |
69 | 69 | } |
— | — | @@ -596,18 +596,21 @@ |
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | | - # Check if this is a redirect... |
601 | 600 | $text = $frev->getRevText(); |
602 | | - $redirHtml = $this->getRedirectHtml( $text ); |
| 601 | + # Get the new stable parser output... |
| 602 | + $pOpts = $this->article->makeParserOptions( $wgUser ); |
| 603 | + $parserOut = FlaggedRevs::parseStableText( |
| 604 | + $this->article->getTitle(), $text, $frev->getRevId(), $pOpts ); |
603 | 605 | |
604 | 606 | # Parse and output HTML |
605 | | - if ( $redirHtml == '' ) { |
606 | | - $parserOptions = $this->article->makeParserOptions( $wgUser ); |
607 | | - $parserOut = FlaggedRevs::parseStableText( |
608 | | - $this->article->getTitle(), $text, $frev->getRevId(), $parserOptions ); |
| 607 | + $redirHtml = $this->getRedirectHtml( $text ); |
| 608 | + if ( $redirHtml == '' ) { // page is not a redirect... |
| 609 | + # Add the stable output to the page view |
609 | 610 | $this->addParserOutput( $parserOut ); |
610 | | - } else { |
| 611 | + } else { // page is a redirect... |
611 | 612 | $this->out->addHtml( $redirHtml ); |
| 613 | + # Add output to set categories, displaytitle, etc. |
| 614 | + $this->out->addParserOutputNoText( $parserOut ); |
612 | 615 | } |
613 | 616 | } |
614 | 617 | |
— | — | @@ -675,30 +678,31 @@ |
676 | 679 | } |
677 | 680 | |
678 | 681 | # Get parsed stable version and output HTML |
679 | | - $parserOptions = $this->article->makeParserOptions( $wgUser ); |
| 682 | + $pOpts = $this->article->makeParserOptions( $wgUser ); |
680 | 683 | $parserCache = FRParserCacheStable::singleton(); |
681 | | - $parserOut = $parserCache->get( $this->article, $parserOptions ); |
| 684 | + $parserOut = $parserCache->get( $this->article, $pOpts ); |
682 | 685 | if ( $parserOut ) { |
| 686 | + # Cache hit. Note that redirects are not cached. |
683 | 687 | $this->addParserOutput( $parserOut ); |
684 | 688 | } else { |
685 | 689 | $text = $srev->getRevText(); |
686 | | - # Check if this is a redirect... |
| 690 | + # Get the new stable parser output... |
| 691 | + $parserOut = FlaggedRevs::parseStableText( |
| 692 | + $this->article->getTitle(), $text, $srev->getRevId(), $pOpts ); |
| 693 | + |
687 | 694 | $redirHtml = $this->getRedirectHtml( $text ); |
688 | | - # Don't parse redirects, use separate handling... |
689 | | - if ( $redirHtml == '' ) { |
690 | | - # Get the new stable output |
691 | | - $parserOut = FlaggedRevs::parseStableText( |
692 | | - $this->article->getTitle(), $text, $srev->getRevId(), $parserOptions ); |
| 695 | + if ( $redirHtml == '' ) { // page is not a redirect... |
693 | 696 | # Update the stable version cache |
694 | | - $parserCache->save( $parserOut, $this->article, $parserOptions ); |
| 697 | + $parserCache->save( $parserOut, $this->article, $pOpts ); |
695 | 698 | # Add the stable output to the page view |
696 | 699 | $this->addParserOutput( $parserOut ); |
697 | | - |
698 | | - # Update the stable version dependancies |
699 | | - FlaggedRevs::updateStableOnlyDeps( $this->article, $parserOut ); |
700 | | - } else { |
| 700 | + } else { // page is a redirect... |
701 | 701 | $this->out->addHtml( $redirHtml ); |
| 702 | + # Add output to set categories, displaytitle, etc. |
| 703 | + $this->out->addParserOutputNoText( $parserOut ); |
702 | 704 | } |
| 705 | + # Update the stable version dependancies |
| 706 | + FlaggedRevs::updateStableOnlyDeps( $this->article, $parserOut ); |
703 | 707 | } |
704 | 708 | |
705 | 709 | # Update page sync status for tracking purposes. |
— | — | @@ -725,7 +729,8 @@ |
726 | 730 | protected function getRedirectHtml( $text ) { |
727 | 731 | $rTargets = Title::newFromRedirectArray( $text ); |
728 | 732 | if ( $rTargets ) { |
729 | | - return $this->article->viewRedirect( $rTargets ); |
| 733 | + $article = new Article( $this->article->getTitle() ); |
| 734 | + return $article->viewRedirect( $rTargets ); |
730 | 735 | } |
731 | 736 | return ''; |
732 | 737 | } |