r26226 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26225‎ | r26226 | r26227 >
Date:22:37, 28 September 2007
Author:aaron
Status:old
Tags:
Comment:
*Don't show ! marks for unreviewable pages
*Some fixes
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -123,6 +123,7 @@
124124 # Autoreview stuff
125125 $wgHooks['ArticleInsertComplete'][] = array( $wgFlaggedArticle, 'maybeMakeNewPageReviewed' );
126126 $wgHooks['ArticleSaveComplete'][] = array( $wgFlaggedArticle, 'maybeMakeEditReviewed' );
 127+ $wgHooks['ArticleSaveComplete'][] = array( $wgFlaggedArticle, 'autoMarkPatrolled' );
127128 #########
128129 }
129130
@@ -1092,6 +1093,22 @@
10931094
10941095 return true;
10951096 }
 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+ }
10961113
10971114 /**
10981115 * 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 @@
575575 }
576576
577577 function showStableRevision( $frev ) {
578 - global $wgParser, $wgLang, $wgUser, $wgOut, $wgFlaggedRevs;
 578+ global $wgParser, $wgLang, $wgUser, $wgOut, $wgFlaggedRevs, $wgFlaggedArticle;
579579 // Get the revision
580580 $frev = $wgFlaggedRevs->getFlaggedRev( $this->page, $this->oldid, true );
581581 // Revision must exists
@@ -586,12 +586,12 @@
587587 $flags = $wgFlaggedRevs->getFlagsForRevision( $frev->fr_rev_id );
588588 $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $frev->fr_timestamp), true );
589589 // 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()">' .
593593 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 ) .
596596 '</span>';
597597 // Parse the text...
598598 $article = new Article( $this->page );
@@ -970,7 +970,7 @@
971971 }
972972
973973 function submit() {
974 - global $wgOut, $wgFlaggedRevs;
 974+ global $wgOut, $wgFlaggedRevs, $wgUser, $wgParser;
975975 # Get current config
976976 $config = $wgFlaggedRevs->getVisibilitySettings( $this->page, true );
977977
@@ -1003,7 +1003,18 @@
10041004
10051005 $log->addEntry( 'config', $this->page, $comment );
10061006 }
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...
10091020 }
10101021 }

Status & tagging log