r97970 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97969‎ | r97970 | r97971 >
Date:22:56, 23 September 2011
Author:aaron
Status:ok
Tags:
Comment:
Renamed some confusing vars
Modified paths:
  • /trunk/extensions/FlaggedRevs/dataclasses/FRUserActivity.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/dataclasses/FRUserActivity.php
@@ -3,8 +3,8 @@
44 * Class of utility functions for getting/tracking user activity
55 */
66 class FRUserActivity {
7 - const PAGE_REVIEW_MS = 1200; // 20*60
8 - const CHANGE_REVIEW_MS = 360; // 6*60
 7+ const PAGE_REVIEW_SEC = 1200; // 20*60
 8+ const CHANGE_REVIEW_SEC = 360; // 6*60
99
1010 /**
1111 * Get number of active users watching a page
@@ -77,7 +77,7 @@
7878 */
7979 public static function setUserReviewingPage( User $user, $pageId ) {
8080 $key = wfMemcKey( 'flaggedrevs', 'userReviewingPage', $pageId );
81 - return self::incUserReviewingItem( $key, $user, self::PAGE_REVIEW_MS );
 81+ return self::incUserReviewingItem( $key, $user, self::PAGE_REVIEW_SEC );
8282 }
8383
8484 /*
@@ -89,7 +89,7 @@
9090 */
9191 public static function clearUserReviewingPage( User $user, $pageId ) {
9292 $key = wfMemcKey( 'flaggedrevs', 'userReviewingPage', $pageId );
93 - return self::decUserReviewingItem( $key, $user, self::PAGE_REVIEW_MS );
 93+ return self::decUserReviewingItem( $key, $user, self::PAGE_REVIEW_SEC );
9494 }
9595
9696 /*
@@ -139,7 +139,7 @@
140140 */
141141 public static function setUserReviewingDiff( User $user, $oldId, $newId ) {
142142 $key = wfMemcKey( 'flaggedrevs', 'userReviewingDiff', $oldId, $newId );
143 - return self::incUserReviewingItem( $key, $user, self::CHANGE_REVIEW_MS );
 143+ return self::incUserReviewingItem( $key, $user, self::CHANGE_REVIEW_SEC );
144144 }
145145
146146 /*
@@ -152,7 +152,7 @@
153153 */
154154 public static function clearUserReviewingDiff( User $user, $oldId, $newId ) {
155155 $key = wfMemcKey( 'flaggedrevs', 'userReviewingDiff', $oldId, $newId );
156 - return self::decUserReviewingItem( $key, $user, self::CHANGE_REVIEW_MS );
 156+ return self::decUserReviewingItem( $key, $user, self::CHANGE_REVIEW_SEC );
157157 }
158158
159159 /*
@@ -167,7 +167,7 @@
168168 $wgMemc->delete( $key );
169169 }
170170
171 - protected static function incUserReviewingItem( $key, User $user, $ttlMs ) {
 171+ protected static function incUserReviewingItem( $key, User $user, $ttlSec ) {
172172 global $wgMemc;
173173 $wasSet = false; // was changed?
174174
@@ -177,12 +177,12 @@
178178 list( $u, $ts, $cnt ) = $oldVal;
179179 if ( $u === $user->getName() ) { // by this user
180180 $newVal = array( $u, $ts, $cnt+1 ); // inc counter
181 - $wgMemc->set( $key, $newVal, $ttlMs );
 181+ $wgMemc->set( $key, $newVal, $ttlSec );
182182 $wasSet = true;
183183 }
184184 } else { // no flag set
185185 $newVal = array( $user->getName(), wfTimestampNow(), 1 );
186 - $wgMemc->set( $key, $newVal, $ttlMs );
 186+ $wgMemc->set( $key, $newVal, $ttlSec );
187187 $wasSet = true;
188188 }
189189 $wgMemc->unlock( $key );
@@ -190,7 +190,7 @@
191191 return $wasSet;
192192 }
193193
194 - protected static function decUserReviewingItem( $key, User $user, $ttlMs ) {
 194+ protected static function decUserReviewingItem( $key, User $user, $ttlSec ) {
195195 global $wgMemc;
196196 $wasSet = false; // was changed?
197197

Status & tagging log