r63583 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63582‎ | r63583 | r63584 >
Date:04:19, 11 March 2010
Author:aaron
Status:ok
Tags:
Comment:
* Made getRevCountSince() not cache 0-valued results
* Removed $revSince check from pendingEditNotice - caller's job
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -917,15 +917,18 @@
918918 $key = wfMemcKey( 'flaggedrevs', 'unreviewedrevs', $article->getId() );
919919 if ( !$forUpdate ) {
920920 $val = $wgMemc->get( $key );
921 - $count = is_integer( $val ) ? $val : null;
 921+ if( is_integer($val) ) $count = $val;
922922 }
 923+ # Otherwise, fetch from DB as needed
923924 if ( is_null( $count ) ) {
924925 $db = $forUpdate ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
925926 $count = (int)$db->selectField( 'revision', 'COUNT(*)',
926927 array( 'rev_page' => $article->getId(), "rev_id > " . intval( $revId ) ),
927928 __METHOD__ );
928 - # Save to cache
929 - $wgMemc->set( $key, $count, $wgParserCacheExpireTime );
 929+ # Save to cache if there are such edits
 930+ if( $count ) {
 931+ $wgMemc->set( $key, $count, $wgParserCacheExpireTime );
 932+ }
930933 }
931934 return $count;
932935 }
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -483,9 +483,6 @@
484484 */
485485 public static function pendingEditNotice( $flaggedArticle, $frev, $revsSince ) {
486486 global $wgLang;
487 - if( $revsSince < 1 ) {
488 - return ''; // only for pending edits
489 - }
490487 $flags = $frev->getTags();
491488 $time = $wgLang->date( $frev->getTimestamp(), true );
492489 # Add message text for pending edits

Status & tagging log