Index: trunk/extensions/FlaggedRevs/dataclasses/FRUserActivity.php |
— | — | @@ -3,8 +3,8 @@ |
4 | 4 | * Class of utility functions for getting/tracking user activity |
5 | 5 | */ |
6 | 6 | 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 |
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Get number of active users watching a page |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | */ |
79 | 79 | public static function setUserReviewingPage( User $user, $pageId ) { |
80 | 80 | $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 ); |
82 | 82 | } |
83 | 83 | |
84 | 84 | /* |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | */ |
91 | 91 | public static function clearUserReviewingPage( User $user, $pageId ) { |
92 | 92 | $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 ); |
94 | 94 | } |
95 | 95 | |
96 | 96 | /* |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | */ |
141 | 141 | public static function setUserReviewingDiff( User $user, $oldId, $newId ) { |
142 | 142 | $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 ); |
144 | 144 | } |
145 | 145 | |
146 | 146 | /* |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | */ |
154 | 154 | public static function clearUserReviewingDiff( User $user, $oldId, $newId ) { |
155 | 155 | $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 ); |
157 | 157 | } |
158 | 158 | |
159 | 159 | /* |
— | — | @@ -167,7 +167,7 @@ |
168 | 168 | $wgMemc->delete( $key ); |
169 | 169 | } |
170 | 170 | |
171 | | - protected static function incUserReviewingItem( $key, User $user, $ttlMs ) { |
| 171 | + protected static function incUserReviewingItem( $key, User $user, $ttlSec ) { |
172 | 172 | global $wgMemc; |
173 | 173 | $wasSet = false; // was changed? |
174 | 174 | |
— | — | @@ -177,12 +177,12 @@ |
178 | 178 | list( $u, $ts, $cnt ) = $oldVal; |
179 | 179 | if ( $u === $user->getName() ) { // by this user |
180 | 180 | $newVal = array( $u, $ts, $cnt+1 ); // inc counter |
181 | | - $wgMemc->set( $key, $newVal, $ttlMs ); |
| 181 | + $wgMemc->set( $key, $newVal, $ttlSec ); |
182 | 182 | $wasSet = true; |
183 | 183 | } |
184 | 184 | } else { // no flag set |
185 | 185 | $newVal = array( $user->getName(), wfTimestampNow(), 1 ); |
186 | | - $wgMemc->set( $key, $newVal, $ttlMs ); |
| 186 | + $wgMemc->set( $key, $newVal, $ttlSec ); |
187 | 187 | $wasSet = true; |
188 | 188 | } |
189 | 189 | $wgMemc->unlock( $key ); |
— | — | @@ -190,7 +190,7 @@ |
191 | 191 | return $wasSet; |
192 | 192 | } |
193 | 193 | |
194 | | - protected static function decUserReviewingItem( $key, User $user, $ttlMs ) { |
| 194 | + protected static function decUserReviewingItem( $key, User $user, $ttlSec ) { |
195 | 195 | global $wgMemc; |
196 | 196 | $wasSet = false; // was changed? |
197 | 197 | |