r36000 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35999‎ | r36000 | r36001 >
Date:19:19, 7 June 2008
Author:aaron
Status:old
Tags:
Comment:
Don't use cache when updating
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -485,6 +485,7 @@
486486 * Get number of revs since a certain revision
487487 */
488488 public static function getRevCountSince( $article, $revId, $forUpdate=false ) {
 489+ global $wgMemc;
489490 # Check if the count is zero by using $article->getLatest().
490491 # I don't trust using memcache and PHP for values like '0'
491492 # as it may confuse "expired" with "0".
@@ -492,10 +493,13 @@
493494 if( $latest == $revId ) {
494495 return 0;
495496 }
496 - global $wgMemc;
497497 # Try the cache
 498+ $count = null;
498499 $key = wfMemcKey( 'flaggedrevs', 'unreviewedrevs', $article->getId() );
499 - if( !$count = intval($wgMemc->get($key)) ) {
 500+ if( !$forUpdate ) {
 501+ $count = intval($wgMemc->get($key));
 502+ }
 503+ if( !$count ) {
500504 $db = $forUpdate ? wfGetDB( DB_MASTER) : wfGetDB( DB_SLAVE );
501505 $count = $db->selectField( 'revision', 'COUNT(*)',
502506 array('rev_page' => $article->getId(), "rev_id > " . intval($revId) ),

Status & tagging log