Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -1236,11 +1236,10 @@ |
1237 | 1237 | # Check the page sync value cache... |
1238 | 1238 | $key = wfMemcKey( 'flaggedrevs', 'includesSynced', $this->article->getId() ); |
1239 | 1239 | $value = FlaggedRevs::getMemcValue( $wgMemc->get( $key ), $this->article ); |
1240 | | - # Default sync val as false to trigger query |
1241 | | - $synced = ( $value === "true" ) ? true : false; |
1242 | 1240 | |
1243 | 1241 | $changeList = array(); |
1244 | | - if ( !$synced ) { |
| 1242 | + # Trigger queries if sync cache value is not 'true' |
| 1243 | + if ( $value !== "true" ) { |
1245 | 1244 | # Add a list of links to each changed template... |
1246 | 1245 | $changeList = array_merge( $changeList, $this->fetchTemplateChanges( $frev ) ); |
1247 | 1246 | # Add a list of links to each changed file... |
— | — | @@ -1249,48 +1248,49 @@ |
1250 | 1249 | |
1251 | 1250 | # Some important information about include version selection... |
1252 | 1251 | $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 ); |
1261 | 1259 | } |
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 ) ) { |
1269 | 1263 | // 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... |
1275 | 1277 | } else { |
1276 | | - $msg = 'revreview-update-edited'; // just couldn't autoreview |
| 1278 | + $msg = 'revreview-update'; // generic "Please review" notice... |
1277 | 1279 | } |
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 | + ' ' . 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 ); |
1280 | 1294 | } |
1281 | | - $changeDiv = wfMsgExt( $msg, 'parse' ); |
1282 | | - if ( count( $changeList ) ) { |
1283 | | - # Add include change list... |
1284 | | - $changeDiv .= '<p>' . |
1285 | | - wfMsgExt( 'revreview-update-includes', 'parseinline' ) . |
1286 | | - ' ' . 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 ); |
1295 | 1295 | } |
1296 | 1296 | # Add a link to diff from stable to current as needed |
1297 | 1297 | if ( $frev ) { |