Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -587,7 +587,7 @@ |
588 | 588 | * Callback that autopromotes user according to the setting in |
589 | 589 | * $wgFlaggedRevsAutopromote |
590 | 590 | */ |
591 | | - private static function autoPromoteUser( $article, $user, $text, $summary, $isminor, $iswatch, $section ) { |
| 591 | + private static function autoPromoteUser( &$article, &$user, &$text, &$summary, &$isminor, &$iswatch, &$section ) { |
592 | 592 | global $wgUser, $wgFlaggedRevsAutopromote; |
593 | 593 | |
594 | 594 | $groups = $user->getGroups(); |
— | — | @@ -603,8 +603,7 @@ |
604 | 604 | # Do not re-add status if it was previously removed... |
605 | 605 | $fname = 'FlaggedRevs::autoPromoteUser'; |
606 | 606 | $db = wfGetDB( DB_SLAVE ); |
607 | | - $result = $db->select( |
608 | | - array('logging'), |
| 607 | + $result = $db->select('logging', |
609 | 608 | array('log_user'), |
610 | 609 | array("log_type='validate'", "log_action='revoke1'", 'log_namespace' => NS_USER, 'log_title' => $user->getName() ), |
611 | 610 | $fname, |
— | — | @@ -635,31 +634,32 @@ |
636 | 635 | * Adds stable version status/info tags and notes |
637 | 636 | * Adds a quick review form on the bottom if needed |
638 | 637 | */ |
639 | | - function setPageContent( &$out ) { |
640 | | - global $wgArticle, $wgRequest, $wgTitle, $action; |
| 638 | + function setPageContent( &$article, &$outputDone, &$pcache ) { |
| 639 | + global $wgRequest, $wgTitle, $wgOut, $action; |
641 | 640 | // Only trigger on article view, not for protect/delete/hist |
642 | 641 | // Talk pages cannot be validated |
643 | | - if( !$wgArticle || !$wgTitle->isContentPage() || $action !='view' ) return; |
| 642 | + if( !$article || !$article->mTitle->isContentPage() || $action !='view' ) |
| 643 | + return; |
644 | 644 | // Grab page and rev ids |
645 | | - $pageid = $wgArticle->getId(); |
646 | | - $revid = ( $wgArticle->mRevision ) ? $wgArticle->mRevision->mId : $wgArticle->getLatest(); |
| 645 | + $pageid = $article->getId(); |
| 646 | + $revid = ( $article->mRevision ) ? $article->mRevision->mId : $article->getLatest(); |
647 | 647 | // There must be a valid rev ID |
648 | 648 | if( !$revid ) return; |
649 | 649 | |
650 | 650 | $vis_id = $revid; |
651 | | - $tag = ''; $notes = ''; $newbody = $out->mBodytext; |
| 651 | + $tag = ''; $notes = ''; |
652 | 652 | // Check the newest stable version... |
653 | 653 | $quality = false; $featured = false; |
654 | 654 | if ( $this->pageOverride() ) { |
655 | 655 | // getLatestQualityRev() is slower, don't use it if we won't need to |
656 | | - $tfrev = $this->getLatestQualityRev(); |
| 656 | + $tfrev = $this->getLatestQualityRev( $article ); |
657 | 657 | if ( is_null($tfrev) ) { |
658 | | - $tfrev = $this->getLatestStableRev(); |
| 658 | + $tfrev = $this->getLatestStableRev( $article ); |
659 | 659 | } else { |
660 | 660 | $quality = true; |
661 | 661 | } |
662 | 662 | } else { |
663 | | - $tfrev = $this->getLatestStableRev(); |
| 663 | + $tfrev = $this->getLatestStableRev( $article ); |
664 | 664 | } |
665 | 665 | if( $wgRequest->getVal('diff') ) { |
666 | 666 | // Do not clutter up diffs any further... |
— | — | @@ -700,27 +700,29 @@ |
701 | 701 | $vis_id = $tfrev->fr_rev_id; |
702 | 702 | $revs_since = parent::getRevCountSince( $pageid, $vis_id ); |
703 | 703 | if ( $quality ) |
704 | | - $tag = wfMsgExt('revreview-quality', array('parse'), $vis_id, $wgArticle->getLatest(), $revs_since, $time); |
| 704 | + $tag = wfMsgExt('revreview-quality', array('parse'), $vis_id, $article->getLatest(), $revs_since, $time); |
705 | 705 | else |
706 | | - $tag = wfMsgExt('revreview-basic', array('parse'), $vis_id, $wgArticle->getLatest(), $revs_since, $time); |
| 706 | + $tag = wfMsgExt('revreview-basic', array('parse'), $vis_id, $article->getLatest(), $revs_since, $time); |
707 | 707 | # Try the stable page cache |
708 | | - $parserOutput = parent::getPageCache( $wgArticle ); |
709 | | - $newbody = $parserOutput ? $parserOutput->getText() : false; |
| 708 | + $parserOutput = parent::getPageCache( $article ); |
710 | 709 | # If no cache is available, get the text and parse it |
711 | | - if ( $newbody==false ) { |
| 710 | + if ( $parserOutput==false ) { |
712 | 711 | $text = parent::getFlaggedRevText( $vis_id ); |
713 | 712 | $options = ParserOptions::newFromUser($wgUser); |
714 | 713 | $parserOutput = parent::parseStableText( $wgTitle, $text, $vis_id, $options, $tfrev->fr_timestamp ); |
715 | 714 | # Update the general cache |
716 | | - parent::updatePageCache( $wgArticle, $parserOutput ); |
717 | | - $newbody = $parserOutput->getText(); |
| 715 | + parent::updatePageCache( $article, $parserOutput ); |
718 | 716 | } |
| 717 | + $wgOut->addHTML( $parserOutput->getText() ); |
719 | 718 | # Show stable categories and interwiki links only |
720 | | - $out->mCategoryLinks = array(); |
721 | | - $out->addCategoryLinks( $parserOutput->getCategories() ); |
722 | | - $out->mLanguageLinks = array(); |
723 | | - $out->addLanguageLinks( $parserOutput->getLanguageLinks() ); |
| 719 | + $wgOut->mCategoryLinks = array(); |
| 720 | + $wgOut->addCategoryLinks( $parserOutput->getCategories() ); |
| 721 | + $wgOut->mLanguageLinks = array(); |
| 722 | + $wgOut->addLanguageLinks( $parserOutput->getLanguageLinks() ); |
724 | 723 | $notes = parent::ReviewNotes( $tfrev ); |
| 724 | + // Tell MW that parser output is done |
| 725 | + $outputDone = true; |
| 726 | + $pcache = false; |
725 | 727 | } |
726 | 728 | // Construct some tagging |
727 | 729 | $tag .= parent::addTagRatings( $flags ); |
— | — | @@ -732,14 +734,14 @@ |
733 | 735 | else |
734 | 736 | $tag = '<div class="flaggedrevs_tag1 plainlinks">'.$tag.'</div>'; |
735 | 737 | // Set the new body HTML, place a tag on top |
736 | | - $out->mBodytext = $tag . $newbody . $notes; |
| 738 | + $wgOut->mBodytext = $tag . $wgOut->mBodytext . $notes; |
737 | 739 | } else { |
738 | 740 | $tag = '<div class="mw-warning plainlinks">'.wfMsgExt('revreview-noflagged', array('parse')).'</div>'; |
739 | | - $out->mBodytext = $tag . $out->mBodytext; |
| 741 | + $wgOut->addHTML( $tag ); |
740 | 742 | } |
741 | 743 | // Show review links for the VISIBLE revision |
742 | 744 | // We cannot review deleted revisions |
743 | | - if( is_object($wgArticle->mRevision) && $wgArticle->mRevision->mDeleted ) return; |
| 745 | + if( is_object($article->mRevision) && $article->mRevision->mDeleted ) return; |
744 | 746 | // Add quick review links IF we did not override, otherwise, they might |
745 | 747 | // review a revision that parses out newer templates/images than what they say |
746 | 748 | // Note: overrides are never done when viewing with "oldid=" |
— | — | @@ -818,7 +820,9 @@ |
819 | 821 | * per the $wgFlaggedRevTags variable |
820 | 822 | * This passes rev_deleted revisions |
821 | 823 | * This is based on the current article and caches results |
822 | | - * @param Article $article, used when in edit mode |
| 824 | + * Accepts an argument because of the fact that the article |
| 825 | + * object for edit mode is part of the editform; insert only |
| 826 | + * the article object for the current page! |
823 | 827 | * @output array ( rev, flags ) |
824 | 828 | */ |
825 | 829 | function getLatestQualityRev( $article=NULL ) { |
— | — | @@ -1049,7 +1053,7 @@ |
1050 | 1054 | |
1051 | 1055 | $flaggedrevs = new FlaggedRevs(); |
1052 | 1056 | $flaggedarticle = new FlaggedArticle(); |
1053 | | -$wgHooks['BeforePageDisplay'][] = array($flaggedarticle, 'setPageContent'); |
| 1057 | +$wgHooks['ArticleViewHeader'][] = array($flaggedarticle, 'setPageContent'); |
1054 | 1058 | $wgHooks['DiffViewHeader'][] = array($flaggedarticle, 'addToDiff'); |
1055 | 1059 | $wgHooks['EditPage::showEditForm:initial'][] = array($flaggedarticle, 'addToEditView'); |
1056 | 1060 | $wgHooks['SkinTemplateTabs'][] = array($flaggedarticle, 'setCurrentTab'); |