Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -485,6 +485,7 @@ |
486 | 486 | * Get number of revs since a certain revision |
487 | 487 | */ |
488 | 488 | public static function getRevCountSince( $article, $revId, $forUpdate=false ) { |
| 489 | + global $wgMemc; |
489 | 490 | # Check if the count is zero by using $article->getLatest(). |
490 | 491 | # I don't trust using memcache and PHP for values like '0' |
491 | 492 | # as it may confuse "expired" with "0". |
— | — | @@ -492,10 +493,13 @@ |
493 | 494 | if( $latest == $revId ) { |
494 | 495 | return 0; |
495 | 496 | } |
496 | | - global $wgMemc; |
497 | 497 | # Try the cache |
| 498 | + $count = null; |
498 | 499 | $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 ) { |
500 | 504 | $db = $forUpdate ? wfGetDB( DB_MASTER) : wfGetDB( DB_SLAVE ); |
501 | 505 | $count = $db->selectField( 'revision', 'COUNT(*)', |
502 | 506 | array('rev_page' => $article->getId(), "rev_id > " . intval($revId) ), |