From: Kunal Mehta Date: Wed, 6 Aug 2014 15:01:02 +0000 (+0100) Subject: SpecialStatistics: Use Config instead of globals X-Git-Tag: 1.31.0-rc.0~14558^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=b0b0d400dee3ef211a8b1798c7355f55c37172fb;p=lhc%2Fweb%2Fwiklou.git SpecialStatistics: Use Config instead of globals Change-Id: I2192d351a9e5398ffc8d02eaa7d26c11298537ea --- diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 371e5eac38..67c96a77b6 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -36,7 +36,10 @@ class SpecialStatistics extends SpecialPage { } public function execute( $par ) { - global $wgMemc, $wgDisableCounters, $wgMiserMode; + global $wgMemc; + + $disableCounters = $this->getConfig()->get( 'DisableCounters' ); + $miserMode = $this->getConfig()->get( 'MiserMode' ); $this->setHeaders(); $this->getOutput()->addModuleStyles( 'mediawiki.special' ); @@ -52,12 +55,12 @@ class SpecialStatistics extends SpecialPage { # Staticic - views $viewsStats = ''; - if ( !$wgDisableCounters ) { + if ( !$disableCounters ) { $viewsStats = $this->getViewsStats(); } # Set active user count - if ( !$wgMiserMode ) { + if ( !$miserMode ) { $key = wfMemcKey( 'sitestats', 'activeusers-updated' ); // Re-calculate the count if the last tally is old... if ( !$wgMemc->get( $key ) ) { @@ -83,7 +86,7 @@ class SpecialStatistics extends SpecialPage { $text .= $viewsStats; # Statistic - popular pages - if ( !$wgDisableCounters && !$wgMiserMode ) { + if ( !$disableCounters && !$miserMode ) { $text .= $this->getMostViewedPages(); } @@ -170,8 +173,6 @@ class SpecialStatistics extends SpecialPage { } private function getUserStats() { - global $wgActiveUserDays; - return Xml::openElement( 'tr' ) . Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-users' )->parse() ) . Xml::closeElement( 'tr' ) . @@ -187,16 +188,15 @@ class SpecialStatistics extends SpecialPage { $this->getLanguage()->formatNum( $this->activeUsers ), array( 'class' => 'mw-statistics-users-active' ), 'statistics-users-active-desc', - $this->getLanguage()->formatNum( $wgActiveUserDays ) + $this->getLanguage()->formatNum( $this->getConfig()->get( 'ActiveUserDays' ) ) ); } private function getGroupStats() { - global $wgGroupPermissions, $wgImplicitGroups; $text = ''; - foreach ( $wgGroupPermissions as $group => $permissions ) { + foreach ( $this->getConfig()->get( 'GroupPermissions' ) as $group => $permissions ) { # Skip generic * and implicit groups - if ( in_array( $group, $wgImplicitGroups ) || $group == '*' ) { + if ( in_array( $group, $this->getConfig()->get( 'ImplicitGroups' ) ) || $group == '*' ) { continue; } $groupname = htmlspecialchars( $group );