r60211 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60210‎ | r60211 | r60212 >
Date:18:42, 18 December 2009
Author:aaron
Status:ok
Tags:
Comment:
* Fixed special case tracking row bugs
* Moved and renamed clearDeadLinks
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -1322,6 +1322,17 @@
13231323 wfMsgExt($msg,array('parseinline'),$st,$row->rev_id,$user) . "]</span>";
13241324 return array($link,$css);
13251325 }
 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+ }
13261337
13271338 /**
13281339 * Get params for a user
@@ -1486,16 +1497,19 @@
14871498 if( $sv && $sv->getRevId() == $rev->getId() ) {
14881499 # Update stable cache
14891500 self::updatePageCache( $article, $user, $poutput );
1490 - # Update page fields
 1501+ # Update page tracking fields
14911502 self::updateStableVersion( $article, $rev, $rev->getId() );
14921503 # We can set the sync cache key already.
14931504 global $wgParserCacheExpireTime;
14941505 $key = wfMemcKey( 'flaggedrevs', 'includesSynced', $article->getId() );
14951506 $data = FlaggedRevs::makeMemcObj( "true" );
14961507 $wgMemc->set( $key, $data, $wgParserCacheExpireTime );
1497 - } else {
 1508+ } else if( $sv ) {
14981509 # Update tracking table
14991510 self::updatePendingList( $article, $rev->getId() );
 1511+ } else {
 1512+ # Weird case: autoreview when flaggedrevs is deactivated for page
 1513+ self::clearTrackingRows( $article->getId() );
15001514 }
15011515 wfProfileOut( __METHOD__ );
15021516 return true;
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -523,8 +523,9 @@
524524 // Try to autoreview to this level...
525525 if( $this->reviewThis && RevisionReview::userCanSetFlags($flags) ) {
526526 $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 );
529530 }
530531 }
531532 # 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 @@
179179 return true; // nothing to do
180180 }
181181 }
182 - self::clearDeadLinks( $pageId );
 182+ FlaggedRevs::clearTrackingRows( $pageId );
183183 return true;
184184 }
185185
@@ -201,7 +201,8 @@
202202 }
203203 # Empty flagged revs data for this page if there is no stable version
204204 if( !$sv ) {
205 - return self::clearDeadLinks( $pageId );
 205+ FlaggedRevs::clearTrackingRows( $pageId );
 206+ return true;
206207 }
207208 # Try the process cache...
208209 $article = new Article( $linksUpdate->mTitle );
@@ -294,14 +295,6 @@
295296 return true;
296297 }
297298
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 -
306299 protected static function addLink( &$links, $ns, $dbKey ) {
307300 if( !isset($links[$ns]) ) {
308301 $links[$ns] = array();

Status & tagging log