X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialStatistics.php;h=b0d0246e370587e21f7198ad743cc20ead079a8d;hb=128f33aa5edc924db3249ccfcb8246bbc40b692a;hp=6afba129c793b05b433ec80d973b1b9b4239b853;hpb=261fd55032dba1be9b8ce30c0408e56183c6944e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 6afba129c7..b0d0246e37 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -1,27 +1,43 @@ setHeaders(); @@ -34,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 @@ -53,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' ) ); @@ -106,7 +116,6 @@ class SpecialStatistics extends SpecialPage { * @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 ) ) { @@ -157,7 +166,7 @@ class SpecialStatistics extends SpecialPage { } 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' ) ) ) . @@ -176,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(); @@ -224,6 +234,7 @@ class SpecialStatistics extends SpecialPage { } return $text; } + private function getViewsStats() { global $wgLang; return Xml::openElement( 'tr' ) . @@ -231,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 = ''; @@ -263,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 ), @@ -275,7 +287,7 @@ class SpecialStatistics extends SpecialPage { } return $text; } - + private function getOtherStats( $stats ) { global $wgLang; @@ -295,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 +}