r34298 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34297‎ | r34298 | r34299 >
Date:05:25, 6 May 2008
Author:aaron
Status:old
Tags:
Comment:
Fix typo and slave lag issue
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -1180,6 +1180,7 @@
11811181 'rc_timestamp' => $dbw->timestamp( $rev->getTimestamp() ) ),
11821182 __METHOD__,
11831183 array( 'LIMIT' => 1 ) );
 1184+ # Done!
11841185 $dbw->commit();
11851186
11861187 # Update the article review log
@@ -1192,7 +1193,7 @@
11931194 # Update stable cache
11941195 FlaggedRevs::updatePageCache( $article, $poutput );
11951196 # Update page fields
1196 - self::updateArticleOn( $article, $rev->getID() );
 1197+ self::updateArticleOn( $article, $rev->getId(), $rev->getId() );
11971198 # Purge squid for this page only
11981199 $article->getTitle()->purgeSquid();
11991200 }
@@ -1205,13 +1206,15 @@
12061207 /**
12071208 * @param Article $article
12081209 * @param Integer $rev_id, the stable version rev_id
 1210+ * @param mixed $latest, the latest rev ID (optional)
12091211 * Updates the fp_stable and fp_reviewed fields
12101212 */
1211 - public static function updateArticleOn( $article, $rev_id ) {
 1213+ public static function updateArticleOn( $article, $rev_id, $latest=NULL ) {
12121214 global $wgMemc;
1213 -
12141215 wfProfileIn( __METHOD__ );
12151216
 1217+ $lastID = $latest ? $latest : $article->getLatest();
 1218+
12161219 $dbw = wfGetDB( DB_MASTER );
12171220 # Get the highest quality revision (not necessarily this one).
12181221 $maxQuality = $dbw->selectField( array('flaggedrevs','revision'),
@@ -1224,9 +1227,9 @@
12251228 $maxQuality = $maxQuality===false ? null : $maxQuality;
12261229 # Alter table metadata
12271230 $dbw->replace( 'flaggedpages',
1228 - array( 'pf_page_id' ),
 1231+ array( 'fp_page_id' ),
12291232 array( 'fp_stable' => $rev_id,
1230 - 'fp_reviewed' => ($article->getLatest() == $rev_id) ? 1 : 0,
 1233+ 'fp_reviewed' => ($lastID == $rev_id) ? 1 : 0,
12311234 'fp_quality' => $maxQuality,
12321235 'fp_page_id' => $article->getId() ),
12331236 __METHOD__ );

Status & tagging log