r13916 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13915‎ | r13916 | r13917 >
Date:01:58, 29 April 2006
Author:robchurch
Status:old
Tags:
Comment:
(bug 5741) Introduce {{NUMBEROFUSERS}} magic word
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -2148,6 +2148,8 @@
21492149 return $varCache[$index] = $wgContLang->formatNum( wfNumberOfArticles() );
21502150 case MAG_NUMBEROFFILES:
21512151 return $varCache[$index] = $wgContLang->formatNum( wfNumberOfFiles() );
 2152+ case MAG_NUMBEROFUSERS:
 2153+ return $varCache[$index] = $wgContLang->formatNum( wfNumberOfUsers() );
21522154 case MAG_SITENAME:
21532155 return $wgSitename;
21542156 case MAG_SERVER:
@@ -4254,6 +4256,18 @@
42554257 }
42564258
42574259 /**
 4260+ * Return the number of user accounts
 4261+ * @return integer
 4262+ */
 4263+function wfNumberOfUsers() {
 4264+ wfProfileIn( 'wfNumberOfUsers' );
 4265+ $dbr =& wfGetDB( DB_SLAVE );
 4266+ $count = $dbr->selectField( 'site_stats', 'ss_users', array(), 'wfNumberOfUsers' );
 4267+ wfProfileOut( 'wfNumberOfUsers' );
 4268+ return (int)$count;
 4269+}
 4270+
 4271+/**
42584272 * Get various statistics from the database
42594273 * @private
42604274 */
Index: trunk/phase3/includes/MagicWord.php
@@ -81,6 +81,7 @@
8282 'MAG_TALKPAGENAMEE',
8383 'MAG_SUBJECTPAGENAME',
8484 'MAG_SUBJECTPAGENAMEE',
 85+ 'MAG_NUMBEROFUSERS',
8586 );
8687 if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
8788 wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) );
@@ -124,6 +125,7 @@
125126 MAG_TALKPAGENAMEE,
126127 MAG_SUBJECTPAGENAME,
127128 MAG_SUBJECTPAGENAMEE,
 129+ MAG_NUMBEROFUSERS,
128130 );
129131 if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
130132 wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) );
Index: trunk/phase3/RELEASE-NOTES
@@ -135,6 +135,7 @@
136136 * Remove unneeded extra whitespace at top of Special:Categories
137137 * (bug 5679): format number on timeanddate() calls for fa: hi: bn:.
138138 * (bug 5751) Updates to Portuguese localisation files
 139+* (bug 5741) Introduce {{NUMBEROFUSERS}} magic word
139140
140141 == Compatibility ==
141142
Index: trunk/phase3/languages/Language.php
@@ -228,6 +228,7 @@
229229 MAG_CURRENTTIME => array( 1, 'CURRENTTIME' ),
230230 MAG_NUMBEROFARTICLES => array( 1, 'NUMBEROFARTICLES' ),
231231 MAG_NUMBEROFFILES => array( 1, 'NUMBEROFFILES' ),
 232+ MAG_NUMBEROFUSERS => array( 1, 'NUMBEROFUSERS' ),
232233 MAG_PAGENAME => array( 1, 'PAGENAME' ),
233234 MAG_PAGENAMEE => array( 1, 'PAGENAMEE' ),
234235 MAG_NAMESPACE => array( 1, 'NAMESPACE' ),

Status & tagging log