From: Aaron Schulz Date: Mon, 12 Oct 2009 23:54:48 +0000 (+0000) Subject: * (bug 20595) Don't increment ping value right after setting it the first time (jumpi... X-Git-Tag: 1.31.0-rc.0~39299 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=cb095287f0b51217073e00f26c126a004476522d;p=lhc%2Fweb%2Fwiklou.git * (bug 20595) Don't increment ping value right after setting it the first time (jumping from 0 -> 2) * Use memc->set() rather than using add(). The later just does an existence check on the current key, which is useless here. --- diff --git a/includes/User.php b/includes/User.php index ffc0963700..29b818430c 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1283,6 +1283,7 @@ class User { list( $max, $period ) = $limit; $summary = "(limit $max in {$period}s)"; $count = $wgMemc->get( $key ); + // Already pinged? if( $count ) { if( $count > $max ) { wfDebug( __METHOD__ . ": tripped! $key at $count $summary\n" ); @@ -1293,11 +1294,11 @@ class User { } else { wfDebug( __METHOD__ . ": ok. $key at $count $summary\n" ); } + $wgMemc->incr( $key ); } else { wfDebug( __METHOD__ . ": adding record for $key $summary\n" ); - $wgMemc->add( $key, 1, intval( $period ) ); + $wgMemc->set( $key, 1, intval( $period ) ); // first ping } - $wgMemc->incr( $key ); } wfProfileOut( __METHOD__ );