From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/specials/SpecialStatistics.php | 37 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'includes/specials/SpecialStatistics.php') diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index ee768263..f26d1a60 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -53,18 +53,18 @@ class SpecialStatistics extends SpecialPage { # Staticic - views $viewsStats = ''; - if( !$wgDisableCounters ) { + if ( !$wgDisableCounters ) { $viewsStats = $this->getViewsStats(); } # Set active user count - if( !$wgMiserMode ) { + if ( !$wgMiserMode ) { $key = wfMemcKey( 'sitestats', 'activeusers-updated' ); // Re-calculate the count if the last tally is old... - if( !$wgMemc->get( $key ) ) { + if ( !$wgMemc->get( $key ) ) { $dbw = wfGetDB( DB_MASTER ); SiteStatsUpdate::cacheUpdate( $dbw ); - $wgMemc->set( $key, '1', 24*3600 ); // don't update for 1 day + $wgMemc->set( $key, '1', 24 * 3600 ); // don't update for 1 day } } @@ -84,13 +84,13 @@ class SpecialStatistics extends SpecialPage { $text .= $viewsStats; # Statistic - popular pages - if( !$wgDisableCounters && !$wgMiserMode ) { + if ( !$wgDisableCounters && !$wgMiserMode ) { $text .= $this->getMostViewedPages(); } # Statistic - other $extraStats = array(); - if( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) { + if ( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) { $text .= $this->getOtherStats( $extraStats ); } @@ -111,15 +111,15 @@ class SpecialStatistics extends SpecialPage { * @param $number Float: a statistical number * @param $trExtraParams Array: params to table row, see Html::elememt * @param $descMsg String: message key - * @param $descMsgParam Array: message params + * @param array|string $descMsgParam Message parameters * @return string table row in HTML format */ private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) { - if( $descMsg ) { + if ( $descMsg ) { $msg = $this->msg( $descMsg, $descMsgParam ); if ( $msg->exists() ) { $descriptionText = $this->msg( 'parentheses' )->rawParams( $msg->parse() )->escaped(); - $text .= "
" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'), + $text .= "
" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc' ), " $descriptionText" ); } } @@ -185,7 +185,7 @@ class SpecialStatistics extends SpecialPage { private function getGroupStats() { global $wgGroupPermissions, $wgImplicitGroups; $text = ''; - foreach( $wgGroupPermissions as $group => $permissions ) { + foreach ( $wgGroupPermissions as $group => $permissions ) { # Skip generic * and implicit groups if ( in_array( $group, $wgImplicitGroups ) || $group == '*' ) { continue; @@ -217,7 +217,7 @@ class SpecialStatistics extends SpecialPage { # Add a class when a usergroup contains no members to allow hiding these rows $classZero = ''; $countUsers = SiteStats::numberingroup( $groupname ); - if( $countUsers == 0 ) { + if ( $countUsers == 0 ) { $classZero = ' statistics-group-zero'; } $text .= $this->formatRow( $grouppage . ' ' . $grouplink, @@ -233,11 +233,11 @@ class SpecialStatistics extends SpecialPage { Xml::closeElement( 'tr' ) . $this->formatRow( $this->msg( 'statistics-views-total' )->parse(), $this->getLanguage()->formatNum( $this->views ), - array ( 'class' => 'mw-statistics-views-total' ), 'statistics-views-total-desc' ) . + array( 'class' => 'mw-statistics-views-total' ), 'statistics-views-total-desc' ) . $this->formatRow( $this->msg( 'statistics-views-peredit' )->parse(), $this->getLanguage()->formatNum( sprintf( '%.2f', $this->edits ? $this->views / $this->edits : 0 ) ), - array ( 'class' => 'mw-statistics-views-peredit' ) ); + array( 'class' => 'mw-statistics-views-peredit' ) ); } private function getMostViewedPages() { @@ -260,13 +260,13 @@ class SpecialStatistics extends SpecialPage { 'LIMIT' => 10, ) ); - if( $res->numRows() > 0 ) { + if ( $res->numRows() > 0 ) { $text .= Xml::openElement( 'tr' ); $text .= Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-mostpopular' )->parse() ); $text .= Xml::closeElement( 'tr' ); foreach ( $res as $row ) { $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); - if( $title instanceof Title ) { + if ( $title instanceof Title ) { $text .= $this->formatRow( Linker::link( $title ), $this->getLanguage()->formatNum( $row->page_counter ) ); @@ -287,8 +287,7 @@ class SpecialStatistics extends SpecialPage { private function getOtherStats( array $stats ) { $return = ''; - foreach( $stats as $header => $items ) { - + foreach ( $stats as $header => $items ) { // Identify the structure used if ( is_array( $items ) ) { @@ -298,11 +297,11 @@ class SpecialStatistics extends SpecialPage { } // Collect all items that belong to the same header - foreach( $items as $key => $value ) { + foreach ( $items as $key => $value ) { $name = $this->msg( $key )->parse(); $number = htmlspecialchars( $value ); - $return .= $this->formatRow( $name, $this->getLanguage()->formatNum( $number ), array( 'class' => 'mw-statistics-hook' ) ); + $return .= $this->formatRow( $name, $this->getLanguage()->formatNum( $number ), array( 'class' => 'mw-statistics-hook', 'id' => 'mw-' . $key ) ); } } else { // Create the legacy header only once -- cgit v1.2.2