Add ACTIVEUSERS magic-word, complement to NUMBEROFUSERS.
authorAndrew Garrett <werdna@users.mediawiki.org>
Wed, 4 Feb 2009 22:16:35 +0000 (22:16 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Wed, 4 Feb 2009 22:16:35 +0000 (22:16 +0000)
includes/MagicWord.php
includes/parser/CoreParserFunctions.php
includes/parser/Parser.php
languages/messages/MessagesEn.php

index 5b5b77f..f53fdda 100644 (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,
index e12930b..5a0c1b4 100644 (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 );
        }
index da41348..b662cdc 100644 (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':
index f7ad203..fdc0bf8 100644 (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'               ),