r68111 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68110‎ | r68111 | r68112 >
Date:00:51, 16 June 2010
Author:aaron
Status:ok
Tags:
Comment:
addToDiffView() changes:
* Replaced invalidateCache() call with a simple cache correction call
* Show review prompt only on diffs when there is something to review
* Removed inclusionSetting() check, already handled by findPendingTemplateChanges()/findFileTemplateChanges()
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -1236,11 +1236,10 @@
12371237 # Check the page sync value cache...
12381238 $key = wfMemcKey( 'flaggedrevs', 'includesSynced', $this->article->getId() );
12391239 $value = FlaggedRevs::getMemcValue( $wgMemc->get( $key ), $this->article );
1240 - # Default sync val as false to trigger query
1241 - $synced = ( $value === "true" ) ? true : false;
12421240
12431241 $changeList = array();
1244 - if ( !$synced ) {
 1242+ # Trigger queries if sync cache value is not 'true'
 1243+ if ( $value !== "true" ) {
12451244 # Add a list of links to each changed template...
12461245 $changeList = array_merge( $changeList, $this->fetchTemplateChanges( $frev ) );
12471246 # Add a list of links to each changed file...
@@ -1249,48 +1248,49 @@
12501249
12511250 # Some important information about include version selection...
12521251 $notice = '';
1253 - if ( count( $changeList ) > 0 ) {
1254 - # We use the stable version of includes, unless set otherwise
1255 - if ( FlaggedRevs::inclusionSetting() != FR_INCLUDES_CURRENT ) {
1256 - $notice = wfMsgExt( 'revreview-update-use', 'parse' );
1257 - }
1258 - } elseif ( !$synced ) {
1259 - # Bad cache said they were not synced
1260 - $this->article->getTitle()->invalidateCache();
 1252+ if ( count( $changeList ) ) {
 1253+ $notice = wfMsgExt( 'revreview-update-use', 'parse' );
 1254+ } elseif ( $value === "false" ) {
 1255+ global $wgParserCacheExpireTime;
 1256+ # Correct bad cache which said they were not synced
 1257+ $data = FlaggedRevs::makeMemcObj( "true" );
 1258+ $wgMemc->set( $key, $data, $wgParserCacheExpireTime );
12611259 }
1262 -
1263 - # If the user is allowed to review, prompt them!
1264 - # Only those if there is something to actually review.
1265 - if ( $wgRequest->getInt( 'shownotice' )
1266 - && $newRev->isCurrent()
1267 - && $newRev->getRawUserText() == $wgUser->getName() )
1268 - {
 1260+ # If there are pending revs or templates/files changes,
 1261+ # notify the user and prompt them to review them...
 1262+ if ( $this->article->revsArePending() || count( $changeList ) ) {
12691263 // Reviewer just edited...
1270 - $title = $this->article->getTitle(); // convenience
1271 - // @TODO: make diff class cache this
1272 - $n = $title->countRevisionsBetween( $oldRev->getId(), $newRev->getId() );
1273 - if ( $n ) {
1274 - $msg = 'revreview-update-edited-prev'; // previous pending edits
 1264+ if ( $wgRequest->getInt( 'shownotice' )
 1265+ && $newRev->isCurrent()
 1266+ && $newRev->getRawUserText() == $wgUser->getName() )
 1267+ {
 1268+ $title = $this->article->getTitle(); // convenience
 1269+ // @TODO: make diff class cache this
 1270+ $n = $title->countRevisionsBetween( $oldRev->getId(), $newRev->getId() );
 1271+ if ( $n ) {
 1272+ $msg = 'revreview-update-edited-prev'; // previous pending edits
 1273+ } else {
 1274+ $msg = 'revreview-update-edited'; // just couldn't autoreview
 1275+ }
 1276+ // All other cases...
12751277 } else {
1276 - $msg = 'revreview-update-edited'; // just couldn't autoreview
 1278+ $msg = 'revreview-update'; // generic "Please review" notice...
12771279 }
1278 - } else {
1279 - $msg = 'revreview-update'; // generic "Please review" notice...
 1280+ $changeDiv = wfMsgExt( $msg, 'parse' );
 1281+ if ( count( $changeList ) ) {
 1282+ # Add include change list...
 1283+ $changeDiv .= '<p>' .
 1284+ wfMsgExt( 'revreview-update-includes', 'parseinline' ) .
 1285+ '&#160;' . implode( ', ', $changeList ) . '</p>';
 1286+ # Add include usage notice...
 1287+ $changeDiv .= $notice;
 1288+ }
 1289+ $css = 'flaggedrevs_diffnotice plainlinks';
 1290+ $form .= "<div id='mw-fr-difftostable' class='$css'>$changeDiv</div>\n";
 1291+
 1292+ # Set a key to note that someone is viewing this
 1293+ $this->markDiffUnderReview( $oldRev, $newRev );
12801294 }
1281 - $changeDiv = wfMsgExt( $msg, 'parse' );
1282 - if ( count( $changeList ) ) {
1283 - # Add include change list...
1284 - $changeDiv .= '<p>' .
1285 - wfMsgExt( 'revreview-update-includes', 'parseinline' ) .
1286 - '&#160;' . implode( ', ', $changeList ) . '</p>';
1287 - # Add include usage notice...
1288 - $changeDiv .= $notice;
1289 - }
1290 - $css = 'flaggedrevs_diffnotice plainlinks';
1291 - $form .= "<div id='mw-fr-difftostable' class='$css'>$changeDiv</div>\n";
1292 -
1293 - # Set a key to note that someone is viewing this
1294 - $this->markDiffUnderReview( $oldRev, $newRev );
12951295 }
12961296 # Add a link to diff from stable to current as needed
12971297 if ( $frev ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r68112MFT r68111aaron00:57, 16 June 2010

Status & tagging log