r44714 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44713‎ | r44714 | r44715 >
Date:13:54, 17 December 2008
Author:raymond
Status:ok (Comments)
Tags:
Comment:
Fix hardcoded "last month" in statistic message for acitve users.
This is wrong because the number of active users is count in SiteStats::cacheUpdate from recentchanges table.
Default of $wgRCMaxAge is 7 days not 30 days.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialStatistics.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialStatistics.php
@@ -93,12 +93,13 @@
9494 * @param float $number a number
9595 * @param array $trExtraParams
9696 * @param string $descMsg
 97+ * @param string $descMsgParam
9798 * @return string table row in HTML format
9899 */
99 - private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '' ) {
 100+ private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) {
100101 global $wgStylePath;
101102 if( $descMsg ) {
102 - $descriptionText = wfMsg( $descMsg );
 103+ $descriptionText = wfMsgExt( $descMsg, array( 'parseinline' ), $descMsgParam );
103104 if ( !wfEmptyMsg( $descMsg, $descriptionText ) ) {
104105 $descriptionText = " ($descriptionText)";
105106 $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'),
@@ -148,7 +149,7 @@
149150 array( 'class' => 'mw-statistics-jobqueue' ) );
150151 }
151152 private function getUserStats() {
152 - global $wgLang;
 153+ global $wgLang, $wgRCMaxAge;
153154 return Xml::openElement( 'tr' ) .
154155 Xml::tags( 'th', array( 'colspan' => '2' ), wfMsg( 'statistics-header-users' ) ) .
155156 Xml::closeElement( 'tr' ) .
@@ -158,7 +159,8 @@
159160 $this->formatRow( wfMsgExt( 'statistics-users-active', array( 'parseinline' ) ),
160161 $wgLang->formatNum( $this->activeUsers ),
161162 array( 'class' => 'mw-statistics-users-active' ),
162 - 'statistics-users-active-desc' );
 163+ 'statistics-users-active-desc',
 164+ $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) ) );
163165 }
164166 private function getGroupStats() {
165167 global $wgGroupPermissions, $wgImplicitGroups, $wgLang, $wgUser;
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2028,7 +2028,7 @@
20292029 'statistics-jobqueue' => '[http://www.mediawiki.org/wiki/Manual:Job_queue Job queue] length',
20302030 'statistics-users' => 'Registered [[Special:ListUsers|users]]',
20312031 'statistics-users-active' => 'Active users',
2032 -'statistics-users-active-desc' => 'Users who have performed an action in the past month',
 2032+'statistics-users-active-desc' => 'Users who have performed an action in the last {{PLURAL:$1|day|$1 days}}',
20332033 'statistics-mostpopular' => 'Most viewed pages',
20342034 'statistics-footer' => '', # do not translate or duplicate this message to other languages
20352035

Comments

#Comment by Aaron Schulz (talk | contribs)   19:55, 17 December 2008

Is $descMsgParam used?

#Comment by Raymond (talk | contribs)   20:26, 17 December 2008

yes: + $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) ) );

#Comment by Aaron Schulz (talk | contribs)   21:57, 17 December 2008

Bah, I got lost in the parenthesis :)

Status & tagging log