Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -123,6 +123,7 @@ |
124 | 124 | # Autoreview stuff |
125 | 125 | $wgHooks['ArticleInsertComplete'][] = array( $wgFlaggedArticle, 'maybeMakeNewPageReviewed' ); |
126 | 126 | $wgHooks['ArticleSaveComplete'][] = array( $wgFlaggedArticle, 'maybeMakeEditReviewed' ); |
| 127 | + $wgHooks['ArticleSaveComplete'][] = array( $wgFlaggedArticle, 'autoMarkPatrolled' ); |
127 | 128 | ######### |
128 | 129 | } |
129 | 130 | |
— | — | @@ -1092,6 +1093,22 @@ |
1093 | 1094 | |
1094 | 1095 | return true; |
1095 | 1096 | } |
| 1097 | + |
| 1098 | + /** |
| 1099 | + * When an edit is made to a page that can't be reviewed, treat rc_patrolled |
| 1100 | + * as 1. This avoids marks showing on edits that cannot be reviewed. |
| 1101 | + */ |
| 1102 | + function autoMarkPatrolled( $article, $user, $text, $c, $m, $a, $b, $flags, $rev ) { |
| 1103 | + global $wgFlaggedRevs; |
| 1104 | + |
| 1105 | + if( !$wgFlaggedRevs->isReviewable( $article->getTitle() ) ) { |
| 1106 | + $dbw = wfGetDB( DB_MASTER ); |
| 1107 | + $dbw->update( 'recentchanges', |
| 1108 | + array( 'rc_patrolled' => 1 ), |
| 1109 | + array( 'rc_this_oldid' => $rev->getID() ), |
| 1110 | + __METHOD__ ); |
| 1111 | + } |
| 1112 | + } |
1096 | 1113 | |
1097 | 1114 | /** |
1098 | 1115 | * When a new page is made by a reviwer, try to automatically review it. |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage_body.php |
— | — | @@ -574,7 +574,7 @@ |
575 | 575 | } |
576 | 576 | |
577 | 577 | function showStableRevision( $frev ) { |
578 | | - global $wgParser, $wgLang, $wgUser, $wgOut, $wgFlaggedRevs; |
| 578 | + global $wgParser, $wgLang, $wgUser, $wgOut, $wgFlaggedRevs, $wgFlaggedArticle; |
579 | 579 | // Get the revision |
580 | 580 | $frev = $wgFlaggedRevs->getFlaggedRev( $this->page, $this->oldid, true ); |
581 | 581 | // Revision must exists |
— | — | @@ -586,12 +586,12 @@ |
587 | 587 | $flags = $wgFlaggedRevs->getFlagsForRevision( $frev->fr_rev_id ); |
588 | 588 | $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $frev->fr_timestamp), true ); |
589 | 589 | // We will be looking at the reviewed revision... |
590 | | - $tag = wfMsgExt('revreview-static', array('parseinline'), |
591 | | - urlencode($this->page->getPrefixedText()), $time, $this->page->getPrefixedText()) . |
592 | | - ' <a id="mwrevisiontoggle" style="display:none;" href="javascript:toggleRevRatings()">' . |
| 590 | + $tag = wfMsgExt( 'revreview-static', array('parseinline'), |
| 591 | + urlencode($this->page->getPrefixedText()), $time, $this->page->getPrefixedText() ) . |
| 592 | + ' <a id="mwrevisiontoggle" style="display:none;" href="javascript:toggleRevRatings()">' . |
593 | 593 | wfMsg('revreview-toggle') . '</a>' . |
594 | | - '<span id="mwrevisionratings" style="display:block;">' . |
595 | | - wfMsg('revreview-oldrating') . $wgFlaggedRevs->addTagRatings( $flags ) . |
| 594 | + '<span id="mwrevisionratings" style="display:block;">' . |
| 595 | + wfMsg('revreview-oldrating') . $wgFlaggedArticle->addTagRatings( $flags ) . |
596 | 596 | '</span>'; |
597 | 597 | // Parse the text... |
598 | 598 | $article = new Article( $this->page ); |
— | — | @@ -970,7 +970,7 @@ |
971 | 971 | } |
972 | 972 | |
973 | 973 | function submit() { |
974 | | - global $wgOut, $wgFlaggedRevs; |
| 974 | + global $wgOut, $wgFlaggedRevs, $wgUser, $wgParser; |
975 | 975 | # Get current config |
976 | 976 | $config = $wgFlaggedRevs->getVisibilitySettings( $this->page, true ); |
977 | 977 | |
— | — | @@ -1003,7 +1003,18 @@ |
1004 | 1004 | |
1005 | 1005 | $log->addEntry( 'config', $this->page, $comment ); |
1006 | 1006 | } |
1007 | | - // Update the page rows and the stable version |
1008 | | - $wgFlaggedRevs->articleLinksUpdate2( $this->page ); |
| 1007 | + |
| 1008 | + $article = new Article( $this->page ); |
| 1009 | + # Update the links tables as the stable version may now be the default page... |
| 1010 | + $parserCache = ParserCache::singleton(); |
| 1011 | + $poutput = $parserCache->get( $article, $wgUser ); |
| 1012 | + if( $poutput==false ) { |
| 1013 | + $text = $article->getContent(); |
| 1014 | + $poutput = $wgParser->parse($text, $article->mTitle, ParserOptions::newFromUser($wgUser)); |
| 1015 | + # Might as well save the cache while we're at it |
| 1016 | + $parserCache->save( $poutput, $article, $wgUser ); |
| 1017 | + } |
| 1018 | + $u = new LinksUpdate( $article->mTitle, $poutput ); |
| 1019 | + $u->doUpdate(); // this will trigger our hook to add stable links too... |
1009 | 1020 | } |
1010 | 1021 | } |