- $activeUsers = $dbr->selectField( 'recentchanges', 'COUNT( DISTINCT rc_user_text )',
- array( 'rc_user != 0', 'rc_bot' => 0, "rc_log_type != 'newusers' OR rc_log_type IS NULL" ),
- __METHOD__ );
- $dbw->update( 'site_stats',
- array( 'ss_active_users' => intval($activeUsers) ),
- array( 'ss_row_id' => 1 ), __METHOD__
+ $activeUsers = $dbr->selectField(
+ 'recentchanges',
+ 'COUNT( DISTINCT rc_user_text )',
+ array(
+ 'rc_user != 0',
+ 'rc_bot' => 0,
+ "rc_log_type != 'newusers' OR rc_log_type IS NULL",
+ "rc_timestamp >= '{$dbw->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 )}'",
+ ),
+ __METHOD__
+ );
+ $dbw->update(
+ 'site_stats',
+ array( 'ss_active_users' => intval( $activeUsers ) ),
+ array( 'ss_row_id' => 1 ),
+ __METHOD__