Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -1180,6 +1180,7 @@ |
1181 | 1181 | 'rc_timestamp' => $dbw->timestamp( $rev->getTimestamp() ) ), |
1182 | 1182 | __METHOD__, |
1183 | 1183 | array( 'LIMIT' => 1 ) ); |
| 1184 | + # Done! |
1184 | 1185 | $dbw->commit(); |
1185 | 1186 | |
1186 | 1187 | # Update the article review log |
— | — | @@ -1192,7 +1193,7 @@ |
1193 | 1194 | # Update stable cache |
1194 | 1195 | FlaggedRevs::updatePageCache( $article, $poutput ); |
1195 | 1196 | # Update page fields |
1196 | | - self::updateArticleOn( $article, $rev->getID() ); |
| 1197 | + self::updateArticleOn( $article, $rev->getId(), $rev->getId() ); |
1197 | 1198 | # Purge squid for this page only |
1198 | 1199 | $article->getTitle()->purgeSquid(); |
1199 | 1200 | } |
— | — | @@ -1205,13 +1206,15 @@ |
1206 | 1207 | /** |
1207 | 1208 | * @param Article $article |
1208 | 1209 | * @param Integer $rev_id, the stable version rev_id |
| 1210 | + * @param mixed $latest, the latest rev ID (optional) |
1209 | 1211 | * Updates the fp_stable and fp_reviewed fields |
1210 | 1212 | */ |
1211 | | - public static function updateArticleOn( $article, $rev_id ) { |
| 1213 | + public static function updateArticleOn( $article, $rev_id, $latest=NULL ) { |
1212 | 1214 | global $wgMemc; |
1213 | | - |
1214 | 1215 | wfProfileIn( __METHOD__ ); |
1215 | 1216 | |
| 1217 | + $lastID = $latest ? $latest : $article->getLatest(); |
| 1218 | + |
1216 | 1219 | $dbw = wfGetDB( DB_MASTER ); |
1217 | 1220 | # Get the highest quality revision (not necessarily this one). |
1218 | 1221 | $maxQuality = $dbw->selectField( array('flaggedrevs','revision'), |
— | — | @@ -1224,9 +1227,9 @@ |
1225 | 1228 | $maxQuality = $maxQuality===false ? null : $maxQuality; |
1226 | 1229 | # Alter table metadata |
1227 | 1230 | $dbw->replace( 'flaggedpages', |
1228 | | - array( 'pf_page_id' ), |
| 1231 | + array( 'fp_page_id' ), |
1229 | 1232 | array( 'fp_stable' => $rev_id, |
1230 | | - 'fp_reviewed' => ($article->getLatest() == $rev_id) ? 1 : 0, |
| 1233 | + 'fp_reviewed' => ($lastID == $rev_id) ? 1 : 0, |
1231 | 1234 | 'fp_quality' => $maxQuality, |
1232 | 1235 | 'fp_page_id' => $article->getId() ), |
1233 | 1236 | __METHOD__ ); |