r14199 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14198‎ | r14199 | r14200 >
Date:17:30, 13 May 2006
Author:robchurch
Status:old
Tags:
Comment:
* Introduce NUMBEROFPAGES magic word
* (bug 5833) Introduce CURRENTVERSION 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
@@ -2150,6 +2150,11 @@
21512151 return $varCache[$index] = $wgContLang->formatNum( wfNumberOfFiles() );
21522152 case MAG_NUMBEROFUSERS:
21532153 return $varCache[$index] = $wgContLang->formatNum( wfNumberOfUsers() );
 2154+ case MAG_NUMBEROFPAGES:
 2155+ return $varCache[$index] = $wgContLang->formatNum( wfNumberOfPages() );
 2156+ case MAG_CURRENTVERSION:
 2157+ global $wgVersion;
 2158+ return $wgVersion;
21542159 case MAG_SITENAME:
21552160 return $wgSitename;
21562161 case MAG_SERVER:
@@ -2664,9 +2669,12 @@
26652670 }
26662671 }
26672672
2668 - # NUMBEROFUSERS, NUMBEROFARTICLES, and NUMBEROFFILES
 2673+ # NUMBEROFPAGES, NUMBEROFUSERS, NUMBEROFARTICLES, and NUMBEROFFILES
26692674 if( !$found ) {
2670 - $mwWordsToCheck = array( MAG_NUMBEROFUSERS => 'wfNumberOfUsers', MAG_NUMBEROFARTICLES => 'wfNumberOfArticles', MAG_NUMBEROFFILES => 'wfNumberOfFiles' );
 2675+ $mwWordsToCheck = array( MAG_NUMBEROFPAGES => 'wfNumberOfPages',
 2676+ MAG_NUMBEROFUSERS => 'wfNumberOfUsers',
 2677+ MAG_NUMBEROFARTICLES => 'wfNumberOfArticles',
 2678+ MAG_NUMBEROFFILES => 'wfNumberOfFiles' );
26712679 foreach( $mwWordsToCheck as $word => $func ) {
26722680 $mwCurrentWord =& MagicWord::get( $word );
26732681 if( $mwCurrentWord->matchStartAndRemove( $part1 ) ) {
@@ -4318,6 +4326,18 @@
43194327 }
43204328
43214329 /**
 4330+ * Return the total number of pages
 4331+ * @return integer
 4332+ */
 4333+function wfNumberOfPages() {
 4334+ wfProfileIn( 'wfNumberOfPages' );
 4335+ $dbr =& wfGetDB( DB_SLAVE );
 4336+ $count = $dbr->selectField( 'site_stats', 'ss_total_pages', array(), 'wfNumberOfPages' );
 4337+ wfProfileOut( 'wfNumberOfPages' );
 4338+ return (int)$count;
 4339+}
 4340+
 4341+/**
43224342 * Get various statistics from the database
43234343 * @private
43244344 */
Index: trunk/phase3/includes/MagicWord.php
@@ -84,6 +84,8 @@
8585 'MAG_NUMBEROFUSERS',
8686 'MAG_RAWSUFFIX',
8787 'MAG_NEWSECTIONLINK',
 88+ 'MAG_NUMBEROFPAGES',
 89+ 'MAG_CURRENTVERSION',
8890 );
8991 if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
9092 wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) );
@@ -130,6 +132,8 @@
131133 MAG_NUMBEROFUSERS,
132134 MAG_RAWSUFFIX,
133135 MAG_NEWSECTIONLINK,
 136+ MAG_NUMBEROFPAGES,
 137+ MAG_CURRENTVERSION,
134138 );
135139 if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
136140 wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) );
Index: trunk/phase3/RELEASE-NOTES
@@ -253,6 +253,8 @@
254254 * (bug 5806) {{plural:}} support instead of "twin" MediaWiki messages
255255 * (bug 5931) Update for Polish language (pl)
256256 * Ignore the user and user talk namespaces on Special:Wantedpages
 257+* Introduce NUMBEROFPAGES magic word
 258+* (bug 5833) Introduce CURRENTVERSION magic word
257259
258260 == Compatibility ==
259261
Index: trunk/phase3/languages/Language.php
@@ -226,6 +226,7 @@
227227 MAG_CURRENTDAYNAME => array( 1, 'CURRENTDAYNAME' ),
228228 MAG_CURRENTYEAR => array( 1, 'CURRENTYEAR' ),
229229 MAG_CURRENTTIME => array( 1, 'CURRENTTIME' ),
 230+ MAG_NUMBEROFPAGES => array( 1, 'NUMBEROFPAGES' ),
230231 MAG_NUMBEROFARTICLES => array( 1, 'NUMBEROFARTICLES' ),
231232 MAG_NUMBEROFFILES => array( 1, 'NUMBEROFFILES' ),
232233 MAG_NUMBEROFUSERS => array( 1, 'NUMBEROFUSERS' ),
@@ -282,6 +283,7 @@
283284 MAG_DISPLAYTITLE => array( 1, 'DISPLAYTITLE' ),
284285 MAG_RAWSUFFIX => array( 1, 'R' ),
285286 MAG_NEWSECTIONLINK => array( 1, '__NEWSECTIONLINK__' ),
 287+ MAG_CURRENTVERSION => array( 1, 'CURRENTVERSION' ),
286288 );
287289
288290 if (!$wgCachedMessageArrays) {

Status & tagging log