Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -1322,6 +1322,17 @@ |
1323 | 1323 | wfMsgExt($msg,array('parseinline'),$st,$row->rev_id,$user) . "]</span>"; |
1324 | 1324 | return array($link,$css); |
1325 | 1325 | } |
| 1326 | + |
| 1327 | + /** |
| 1328 | + * Clear FlaggedRevs tracking tables for this page |
| 1329 | + * @param int $pageId |
| 1330 | + */ |
| 1331 | + public static function clearTrackingRows( $pageId ) { |
| 1332 | + $dbw = wfGetDB( DB_MASTER ); |
| 1333 | + $dbw->delete( 'flaggedpages', array('fp_page_id' => $pageId), __METHOD__ ); |
| 1334 | + $dbw->delete( 'flaggedrevs_tracking', array('ftr_from' => $pageId), __METHOD__ ); |
| 1335 | + $dbw->delete( 'flaggedpage_pending', array('fpp_page_id' => $pageId), __METHOD__ ); |
| 1336 | + } |
1326 | 1337 | |
1327 | 1338 | /** |
1328 | 1339 | * Get params for a user |
— | — | @@ -1486,16 +1497,19 @@ |
1487 | 1498 | if( $sv && $sv->getRevId() == $rev->getId() ) { |
1488 | 1499 | # Update stable cache |
1489 | 1500 | self::updatePageCache( $article, $user, $poutput ); |
1490 | | - # Update page fields |
| 1501 | + # Update page tracking fields |
1491 | 1502 | self::updateStableVersion( $article, $rev, $rev->getId() ); |
1492 | 1503 | # We can set the sync cache key already. |
1493 | 1504 | global $wgParserCacheExpireTime; |
1494 | 1505 | $key = wfMemcKey( 'flaggedrevs', 'includesSynced', $article->getId() ); |
1495 | 1506 | $data = FlaggedRevs::makeMemcObj( "true" ); |
1496 | 1507 | $wgMemc->set( $key, $data, $wgParserCacheExpireTime ); |
1497 | | - } else { |
| 1508 | + } else if( $sv ) { |
1498 | 1509 | # Update tracking table |
1499 | 1510 | self::updatePendingList( $article, $rev->getId() ); |
| 1511 | + } else { |
| 1512 | + # Weird case: autoreview when flaggedrevs is deactivated for page |
| 1513 | + self::clearTrackingRows( $article->getId() ); |
1500 | 1514 | } |
1501 | 1515 | wfProfileOut( __METHOD__ ); |
1502 | 1516 | return true; |
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php |
— | — | @@ -523,8 +523,9 @@ |
524 | 524 | // Try to autoreview to this level... |
525 | 525 | if( $this->reviewThis && RevisionReview::userCanSetFlags($flags) ) { |
526 | 526 | $text = $nullRevision->getText(); |
527 | | - FlaggedRevs::autoReviewEdit( $article, $wgUser, $text, $nullRevision, $flags, true ); |
528 | | - $invalidate = false; // already done with auto-review |
| 527 | + // Invalidate cache if not already done with auto-review |
| 528 | + $invalidate = !FlaggedRevs::autoReviewEdit( $article, $wgUser, $text, |
| 529 | + $nullRevision, $flags, true ); |
529 | 530 | } |
530 | 531 | } |
531 | 532 | # Update the links tables as the stable version may now be the default page... |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -178,7 +178,7 @@ |
179 | 179 | return true; // nothing to do |
180 | 180 | } |
181 | 181 | } |
182 | | - self::clearDeadLinks( $pageId ); |
| 182 | + FlaggedRevs::clearTrackingRows( $pageId ); |
183 | 183 | return true; |
184 | 184 | } |
185 | 185 | |
— | — | @@ -201,7 +201,8 @@ |
202 | 202 | } |
203 | 203 | # Empty flagged revs data for this page if there is no stable version |
204 | 204 | if( !$sv ) { |
205 | | - return self::clearDeadLinks( $pageId ); |
| 205 | + FlaggedRevs::clearTrackingRows( $pageId ); |
| 206 | + return true; |
206 | 207 | } |
207 | 208 | # Try the process cache... |
208 | 209 | $article = new Article( $linksUpdate->mTitle ); |
— | — | @@ -294,14 +295,6 @@ |
295 | 296 | return true; |
296 | 297 | } |
297 | 298 | |
298 | | - protected static function clearDeadLinks( $pageId ) { |
299 | | - $dbw = wfGetDB( DB_MASTER ); |
300 | | - $dbw->delete( 'flaggedpages', array('fp_page_id' => $pageId), __METHOD__ ); |
301 | | - $dbw->delete( 'flaggedrevs_tracking', array('ftr_from' => $pageId), __METHOD__ ); |
302 | | - $dbw->delete( 'flaggedpage_pending', array('fpp_page_id' => $pageId), __METHOD__ ); |
303 | | - return true; |
304 | | - } |
305 | | - |
306 | 299 | protected static function addLink( &$links, $ns, $dbKey ) { |
307 | 300 | if( !isset($links[$ns]) ) { |
308 | 301 | $links[$ns] = array(); |