Introduced wgActiveUserDays, which defaults to 30 days as used on wmf.
This way the number can be more easily compared between wikis.
We no longer lie to users if the actual rc length is longer than the limit.
*/
$wgHitcounterUpdateFreq = 1;
+/**
+ * How many days user must be idle before he is considered inactive. Will affect
+ * the number shown on Special:Statistics and Special:ActiveUsers special page.
+ * You might want to leave this as the default value, to provide comparable
+ * numbers between different wikis.
+ */
+$wgActiveUserDays = 30;
+
/** @} */ # End of statistics }
/************************************************************************//**
}
public static function cacheUpdate( $dbw ) {
+ global $wgActiveUserDays;
$dbr = wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow' ) );
# Get non-bot users than did some recent action other than making accounts.
# If account creation is included, the number gets inflated ~20+ fold on enwiki.
array(
'rc_user != 0',
'rc_bot' => 0,
- "rc_log_type != 'newusers' OR rc_log_type IS NULL"
+ "rc_log_type != 'newusers' OR rc_log_type IS NULL",
+ "rc_timestamp >= '{$dbw->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 )}'",
),
__METHOD__
);
class ActiveUsersPager extends UsersPager {
function __construct( $group = null ) {
- global $wgRequest, $wgRCMaxAge;
- $this->RCMaxAge = ceil( $wgRCMaxAge / ( 3600 * 24 ) ); // Constant
-
+ global $wgRequest, $wgActiveUserDays;
+ $this->RCMaxAge = $wgActiveUserDays;
$un = $wgRequest->getText( 'username' );
$this->requestedUser = '';
if ( $un != '' ) {
$conds = array( 'rc_user > 0' ); // Users - no anons
$conds[] = 'ipb_deleted IS NULL'; // don't show hidden names
$conds[] = "rc_log_type IS NULL OR rc_log_type != 'newusers'";
+ $conds[] = "rc_timestamp >= '{$dbr->timestamp( wfTimestamp( TS_UNIX ) - $this->RCMaxAge*24*3600 )}'";
if( $this->requestedUser != '' ) {
$conds[] = 'rc_user_text >= ' . $dbr->addQuotes( $this->requestedUser );
* @param $par Mixed: parameter passed to the page or null
*/
public function execute( $par ) {
- global $wgOut, $wgLang, $wgRCMaxAge;
+ global $wgOut, $wgLang, $wgActiveUserDays;
$this->setHeaders();
$this->outputHeader();
# getBody() first to check, if empty
$usersbody = $up->getBody();
- $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ),
- wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( ceil( $wgRCMaxAge / 86400 ) ) )
- );
+ $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ),
+ wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgActiveUserDays ) )
+ );
$s .= $up->getPageHeader();
if( $usersbody ) {
}
private function getUserStats() {
- global $wgLang, $wgUser, $wgRCMaxAge;
+ global $wgLang, $wgUser, $wgActiveUserDays;
$sk = $wgUser->getSkin();
return Xml::openElement( 'tr' ) .
Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-users', array( 'parseinline' ) ) ) .
$wgLang->formatNum( $this->activeUsers ),
array( 'class' => 'mw-statistics-users-active' ),
'statistics-users-active-desc',
- $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) ) );
+ $wgLang->formatNum( $wgActiveUserDays ) );
}
private function getGroupStats() {
global $wgGroupPermissions, $wgImplicitGroups, $wgLang, $wgUser;