From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- includes/specials/SpecialStatistics.php | 92 +++++++++++++++------------------ 1 file changed, 42 insertions(+), 50 deletions(-) (limited to 'includes/specials/SpecialStatistics.php') diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 2e785b8b..b0d0246e 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -1,31 +1,44 @@ loadAllMessages(); $this->setHeaders(); @@ -37,7 +50,6 @@ class SpecialStatistics extends SpecialPage { $this->users = SiteStats::users(); $this->activeUsers = SiteStats::activeUsers(); $this->admins = SiteStats::numberingroup('sysop'); - $this->numJobs = SiteStats::jobs(); $this->hook = ''; # Staticic - views @@ -56,11 +68,6 @@ class SpecialStatistics extends SpecialPage { $wgMemc->set( $key, '1', 24*3600 ); // don't update for 1 day } } - - # Do raw output - if( $wgRequest->getVal( 'action' ) == 'raw' ) { - $this->doRawOutput(); - } $text = Xml::openElement( 'table', array( 'class' => 'wikitable mw-statistics-table' ) ); @@ -101,15 +108,14 @@ class SpecialStatistics extends SpecialPage { /** * Format a row - * @param string $text description of the row - * @param float $number a number - * @param array $trExtraParams - * @param string $descMsg - * @param string $descMsgParam + * @param $text String: description of the row + * @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 * @return string table row in HTML format */ private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) { - global $wgStylePath; if( $descMsg ) { $descriptionText = wfMsgExt( $descMsg, array( 'parseinline' ), $descMsgParam ); if ( !wfEmptyMsg( $descMsg, $descriptionText ) ) { @@ -118,10 +124,11 @@ class SpecialStatistics extends SpecialPage { $descriptionText ); } } - return Xml::openElement( 'tr', $trExtraParams ) . - Xml::openElement( 'td' ) . $text . Xml::closeElement( 'td' ) . - Xml::openElement( 'td', array( 'class' => 'mw-statistics-numbers' ) ) . $number . Xml::closeElement( 'td' ) . - Xml::closeElement( 'tr' ); + return + Html::rawElement( 'tr', $trExtraParams, + Html::rawElement( 'td', array(), $text ) . + Html::rawElement( 'td', array( 'class' => 'mw-statistics-numbers' ), $number ) + ); } /** @@ -155,13 +162,11 @@ class SpecialStatistics extends SpecialPage { array( 'class' => 'mw-statistics-edits' ) ) . $this->formatRow( wfMsgExt( 'statistics-edits-average', array( 'parseinline' ) ), $wgLang->formatNum( sprintf( '%.2f', $this->total ? $this->edits / $this->total : 0 ) ), - array( 'class' => 'mw-statistics-edits-average' ) ) . - $this->formatRow( wfMsgExt( 'statistics-jobqueue', array( 'parseinline' ) ), - $wgLang->formatNum( $this->numJobs ), - array( 'class' => 'mw-statistics-jobqueue' ) ); + array( 'class' => 'mw-statistics-edits-average' ) ); } + private function getUserStats() { - global $wgLang, $wgUser, $wgRCMaxAge; + global $wgLang, $wgUser, $wgActiveUserDays; $sk = $wgUser->getSkin(); return Xml::openElement( 'tr' ) . Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-users', array( 'parseinline' ) ) ) . @@ -180,8 +185,9 @@ class SpecialStatistics extends SpecialPage { $wgLang->formatNum( $this->activeUsers ), array( 'class' => 'mw-statistics-users-active' ), 'statistics-users-active-desc', - $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) ) ); + $wgLang->formatNum( $wgActiveUserDays ) ); } + private function getGroupStats() { global $wgGroupPermissions, $wgImplicitGroups, $wgLang, $wgUser; $sk = $wgUser->getSkin(); @@ -228,6 +234,7 @@ class SpecialStatistics extends SpecialPage { } return $text; } + private function getViewsStats() { global $wgLang; return Xml::openElement( 'tr' ) . @@ -235,12 +242,13 @@ class SpecialStatistics extends SpecialPage { Xml::closeElement( 'tr' ) . $this->formatRow( wfMsgExt( 'statistics-views-total', array( 'parseinline' ) ), $wgLang->formatNum( $this->views ), - array ( 'class' => 'mw-statistics-views-total' ) ) . + array ( 'class' => 'mw-statistics-views-total' ), 'statistics-views-total-desc' ) . $this->formatRow( wfMsgExt( 'statistics-views-peredit', array( 'parseinline' ) ), $wgLang->formatNum( sprintf( '%.2f', $this->edits ? $this->views / $this->edits : 0 ) ), array ( 'class' => 'mw-statistics-views-peredit' ) ); } + private function getMostViewedPages() { global $wgLang, $wgUser; $text = ''; @@ -267,7 +275,7 @@ class SpecialStatistics extends SpecialPage { $text .= Xml::openElement( 'tr' ); $text .= Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-mostpopular', array( 'parseinline' ) ) ); $text .= Xml::closeElement( 'tr' ); - while( $row = $res->fetchObject() ) { + foreach ( $res as $row ) { $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); if( $title instanceof Title ) { $text .= $this->formatRow( $sk->link( $title ), @@ -279,7 +287,7 @@ class SpecialStatistics extends SpecialPage { } return $text; } - + private function getOtherStats( $stats ) { global $wgLang; @@ -299,20 +307,4 @@ class SpecialStatistics extends SpecialPage { return $return; } - - /** - * Do the action=raw output for this page. Legacy, but we support - * it for backwards compatibility - * http://lists.wikimedia.org/pipermail/wikitech-l/2008-August/039202.html - */ - private function doRawOutput() { - global $wgOut; - $wgOut->disable(); - header( 'Pragma: nocache' ); - echo "total=" . $this->total . ";good=" . $this->good . ";views=" . - $this->views . ";edits=" . $this->edits . ";users=" . $this->users . ";"; - echo "activeusers=" . $this->activeUsers . ";admins=" . $this->admins . - ";images=" . $this->images . ";jobs=" . $this->numJobs . "\n"; - return; - } -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf