Add ACTIVEUSERS magic-word, complement to NUMBEROFUSERS.

This commit is contained in:
Andrew Garrett 2009-02-04 22:16:35 +00:00
parent 18eb32ec29
commit 802c88e188
4 changed files with 9 additions and 0 deletions

View file

@ -90,6 +90,7 @@ class MagicWord {
'subjectpagename',
'subjectpagenamee',
'numberofusers',
'activeusers',
'newsectionlink',
'numberofpages',
'currentversion',
@ -141,6 +142,7 @@ class MagicWord {
'localweek' => 3600,
'localdow' => 3600,
'numberofusers' => 3600,
'activeusers' => 3600,
'numberofpages' => 3600,
'currentversion' => 86400,
'currenttimestamp' => 3600,

View file

@ -31,6 +31,7 @@ class CoreParserFunctions {
$parser->setFunctionHook( 'plural', array( __CLASS__, 'plural' ), SFH_NO_HASH );
$parser->setFunctionHook( 'numberofpages', array( __CLASS__, 'numberofpages' ), SFH_NO_HASH );
$parser->setFunctionHook( 'numberofusers', array( __CLASS__, 'numberofusers' ), SFH_NO_HASH );
$parser->setFunctionHook( 'activeusers', array( __CLASS__, 'activeusers' ), SFH_NO_HASH );
$parser->setFunctionHook( 'numberofarticles', array( __CLASS__, 'numberofarticles' ), SFH_NO_HASH );
$parser->setFunctionHook( 'numberoffiles', array( __CLASS__, 'numberoffiles' ), SFH_NO_HASH );
$parser->setFunctionHook( 'numberofadmins', array( __CLASS__, 'numberofadmins' ), SFH_NO_HASH );
@ -244,6 +245,9 @@ class CoreParserFunctions {
static function numberofusers( $parser, $raw = null ) {
return self::formatRaw( SiteStats::users(), $raw );
}
static function activeusers( $parser, $raw = null ) {
return self::formatRaw( SiteStats::activeUsers(), $raw );
}
static function numberofarticles( $parser, $raw = null ) {
return self::formatRaw( SiteStats::articles(), $raw );
}

View file

@ -2492,6 +2492,8 @@ class Parser
return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::images() );
case 'numberofusers':
return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::users() );
case 'activeusers':
return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::activeUsers() );
case 'numberofpages':
return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::pages() );
case 'numberofadmins':

View file

@ -232,6 +232,7 @@ $magicWords = array(
'numberofarticles' => array( 1, 'NUMBEROFARTICLES' ),
'numberoffiles' => array( 1, 'NUMBEROFFILES' ),
'numberofusers' => array( 1, 'NUMBEROFUSERS' ),
'activeusers' => array( 1, 'ACTIVEUSERS' ),
'numberofedits' => array( 1, 'NUMBEROFEDITS' ),
'numberofviews' => array( 1, 'NUMBEROFVIEWS' ),
'pagename' => array( 1, 'PAGENAME' ),