Index: trunk/phase3/includes/SiteStats.php |
— | — | @@ -234,6 +234,7 @@ |
235 | 235 | } |
236 | 236 | |
237 | 237 | public static function cacheUpdate( $dbw ) { |
| 238 | + global $wgActiveUserDays; |
238 | 239 | $dbr = wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow' ) ); |
239 | 240 | # Get non-bot users than did some recent action other than making accounts. |
240 | 241 | # If account creation is included, the number gets inflated ~20+ fold on enwiki. |
— | — | @@ -243,7 +244,8 @@ |
244 | 245 | array( |
245 | 246 | 'rc_user != 0', |
246 | 247 | 'rc_bot' => 0, |
247 | | - "rc_log_type != 'newusers' OR rc_log_type IS NULL" |
| 248 | + "rc_log_type != 'newusers' OR rc_log_type IS NULL", |
| 249 | + "rc_timestamp >= '{$dbw->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 )}'", |
248 | 250 | ), |
249 | 251 | __METHOD__ |
250 | 252 | ); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2715,6 +2715,14 @@ |
2716 | 2716 | */ |
2717 | 2717 | $wgHitcounterUpdateFreq = 1; |
2718 | 2718 | |
| 2719 | +/** |
| 2720 | + * How many days user must be idle before he is considered inactive. Will affect |
| 2721 | + * the number shown on Special:Statistics and Special:ActiveUsers special page. |
| 2722 | + * You might want to leave this as the default value, to provide comparable |
| 2723 | + * numbers between different wikis. |
| 2724 | + */ |
| 2725 | +$wgActiveUserDays = 30; |
| 2726 | + |
2719 | 2727 | /** @} */ # End of statistics } |
2720 | 2728 | |
2721 | 2729 | /************************************************************************//** |
Index: trunk/phase3/includes/specials/SpecialActiveusers.php |
— | — | @@ -29,9 +29,8 @@ |
30 | 30 | class ActiveUsersPager extends UsersPager { |
31 | 31 | |
32 | 32 | function __construct( $group = null ) { |
33 | | - global $wgRequest, $wgRCMaxAge; |
34 | | - $this->RCMaxAge = ceil( $wgRCMaxAge / ( 3600 * 24 ) ); // Constant |
35 | | - |
| 33 | + global $wgRequest, $wgActiveUserDays; |
| 34 | + $this->RCMaxAge = $wgActiveUserDays; |
36 | 35 | $un = $wgRequest->getText( 'username' ); |
37 | 36 | $this->requestedUser = ''; |
38 | 37 | if ( $un != '' ) { |
— | — | @@ -72,6 +71,7 @@ |
73 | 72 | $conds = array( 'rc_user > 0' ); // Users - no anons |
74 | 73 | $conds[] = 'ipb_deleted IS NULL'; // don't show hidden names |
75 | 74 | $conds[] = "rc_log_type IS NULL OR rc_log_type != 'newusers'"; |
| 75 | + $conds[] = "rc_timestamp >= '{$dbr->timestamp( wfTimestamp( TS_UNIX ) - $this->RCMaxAge*24*3600 )}'"; |
76 | 76 | |
77 | 77 | if( $this->requestedUser != '' ) { |
78 | 78 | $conds[] = 'rc_user_text >= ' . $dbr->addQuotes( $this->requestedUser ); |
— | — | @@ -167,7 +167,7 @@ |
168 | 168 | * @param $par Mixed: parameter passed to the page or null |
169 | 169 | */ |
170 | 170 | public function execute( $par ) { |
171 | | - global $wgOut, $wgLang, $wgRCMaxAge; |
| 171 | + global $wgOut, $wgLang, $wgActiveUserDays; |
172 | 172 | |
173 | 173 | $this->setHeaders(); |
174 | 174 | $this->outputHeader(); |
— | — | @@ -177,9 +177,9 @@ |
178 | 178 | # getBody() first to check, if empty |
179 | 179 | $usersbody = $up->getBody(); |
180 | 180 | |
181 | | - $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ), |
182 | | - wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( ceil( $wgRCMaxAge / 86400 ) ) ) |
183 | | - ); |
| 181 | + $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ), |
| 182 | + wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgActiveUserDays ) ) |
| 183 | + ); |
184 | 184 | |
185 | 185 | $s .= $up->getPageHeader(); |
186 | 186 | if( $usersbody ) { |
Index: trunk/phase3/includes/specials/SpecialStatistics.php |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | } |
176 | 176 | |
177 | 177 | private function getUserStats() { |
178 | | - global $wgLang, $wgUser, $wgRCMaxAge; |
| 178 | + global $wgLang, $wgUser, $wgActiveUserDays; |
179 | 179 | $sk = $wgUser->getSkin(); |
180 | 180 | return Xml::openElement( 'tr' ) . |
181 | 181 | Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-users', array( 'parseinline' ) ) ) . |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | $wgLang->formatNum( $this->activeUsers ), |
195 | 195 | array( 'class' => 'mw-statistics-users-active' ), |
196 | 196 | 'statistics-users-active-desc', |
197 | | - $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) ) ); |
| 197 | + $wgLang->formatNum( $wgActiveUserDays ) ); |
198 | 198 | } |
199 | 199 | private function getGroupStats() { |
200 | 200 | global $wgGroupPermissions, $wgImplicitGroups, $wgLang, $wgUser; |