r46822 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46821‎ | r46822 | r46823 >
Date:22:16, 4 February 2009
Author:werdna
Status:resolved (Comments)
Tags:
Comment:
Add ACTIVEUSERS magic-word, complement to NUMBEROFUSERS.
Modified paths:
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/parser/CoreParserFunctions.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -232,6 +232,7 @@
233233 'numberofarticles' => array( 1, 'NUMBEROFARTICLES' ),
234234 'numberoffiles' => array( 1, 'NUMBEROFFILES' ),
235235 'numberofusers' => array( 1, 'NUMBEROFUSERS' ),
 236+ 'activeusers' => array( 1, 'ACTIVEUSERS' ),
236237 'numberofedits' => array( 1, 'NUMBEROFEDITS' ),
237238 'numberofviews' => array( 1, 'NUMBEROFVIEWS' ),
238239 'pagename' => array( 1, 'PAGENAME' ),
Index: trunk/phase3/includes/parser/Parser.php
@@ -2492,6 +2492,8 @@
24932493 return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::images() );
24942494 case 'numberofusers':
24952495 return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::users() );
 2496+ case 'activeusers':
 2497+ return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::activeUsers() );
24962498 case 'numberofpages':
24972499 return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::pages() );
24982500 case 'numberofadmins':
Index: trunk/phase3/includes/parser/CoreParserFunctions.php
@@ -31,6 +31,7 @@
3232 $parser->setFunctionHook( 'plural', array( __CLASS__, 'plural' ), SFH_NO_HASH );
3333 $parser->setFunctionHook( 'numberofpages', array( __CLASS__, 'numberofpages' ), SFH_NO_HASH );
3434 $parser->setFunctionHook( 'numberofusers', array( __CLASS__, 'numberofusers' ), SFH_NO_HASH );
 35+ $parser->setFunctionHook( 'activeusers', array( __CLASS__, 'activeusers' ), SFH_NO_HASH );
3536 $parser->setFunctionHook( 'numberofarticles', array( __CLASS__, 'numberofarticles' ), SFH_NO_HASH );
3637 $parser->setFunctionHook( 'numberoffiles', array( __CLASS__, 'numberoffiles' ), SFH_NO_HASH );
3738 $parser->setFunctionHook( 'numberofadmins', array( __CLASS__, 'numberofadmins' ), SFH_NO_HASH );
@@ -244,6 +245,9 @@
245246 static function numberofusers( $parser, $raw = null ) {
246247 return self::formatRaw( SiteStats::users(), $raw );
247248 }
 249+ static function activeusers( $parser, $raw = null ) {
 250+ return self::formatRaw( SiteStats::activeUsers(), $raw );
 251+ }
248252 static function numberofarticles( $parser, $raw = null ) {
249253 return self::formatRaw( SiteStats::articles(), $raw );
250254 }
Index: trunk/phase3/includes/MagicWord.php
@@ -90,6 +90,7 @@
9191 'subjectpagename',
9292 'subjectpagenamee',
9393 'numberofusers',
 94+ 'activeusers',
9495 'newsectionlink',
9596 'numberofpages',
9697 'currentversion',
@@ -141,6 +142,7 @@
142143 'localweek' => 3600,
143144 'localdow' => 3600,
144145 'numberofusers' => 3600,
 146+ 'activeusers' => 3600,
145147 'numberofpages' => 3600,
146148 'currentversion' => 86400,
147149 'currenttimestamp' => 3600,

Follow-up revisions

RevisionCommit summaryAuthorDate
r47170RELEASE-NOTES and alias NUMBEROFACTIVEUSERS for magic word ACTIVEUSERS introd...werdna23:44, 11 February 2009

Comments

#Comment by Aaron Schulz (talk | contribs)   04:44, 5 February 2009

Should be 'numberofactiveusers'

#Comment by Werdna (talk | contribs)   04:50, 5 February 2009

Too long, and our naming of magic words is far from consistent anyway.

We have NUMBEROFARTICLES and NUMBEROFUSERS, but PAGESINCATEGORY.

#Comment by Aaron Schulz (talk | contribs)   05:03, 5 February 2009

Is it really that long? Anyway, I'd rather not justify crapiness by the existence of other crapiness :)

#Comment by Gurch (talk | contribs)   14:48, 5 February 2009

If it matters, make "numberofactiveusers" an alias (that can be done with magic words I assume?)

#Comment by Remember the dot (talk | contribs)   02:04, 6 February 2009

I'd also prefer the more accurate "numberofactiveusers"...if a wiki community really finds this too long then they could make an ACTIVEUSERS template to alias NUMBEROFACTIVEUSERS.

#Comment by Werdna (talk | contribs)   23:44, 11 February 2009

Added RELEASE-NOTES and alias NUMBEROFACTIVEUSERS in r47170.

No need to change the canonical name of the magic word, as that would break existing localisation.

#Comment by Remember the dot (talk | contribs)   06:52, 12 February 2009

This magic word has been translated into a grand total of two languages: Persian and Hebrew. Furthermore, the code has not yet been deployed, so the number of uses of the extra alias "ACTIVEUSERS" and its two translations is zero or close to it. The unnecessary alias can and should be eliminated to prevent confusion and remove the need to make two translations per language for one magic word.

#Comment by Werdna (talk | contribs)   17:36, 12 February 2009

I don't think it's hurting anything to have an extra alias.

If people don't like the extra 'unnecessary' alias, they're welcome to, you know, use the other one.

#Comment by Remember the dot (talk | contribs)   18:47, 12 February 2009

Doubling the number of aliases doubles the amount of translation work that will have to be done. It will also have editors scratching their heads wondering what the difference between ACTIVEUSERS and NUMBEROFACTIVEUSERS is.

#Comment by Aaron Schulz (talk | contribs)   19:10, 12 February 2009

I'd say that ACTIVEUSERS should just be removed. Not worth the hassle.

Status & tagging log