Fixes for r64708:
[lhc/web/wiklou.git] / includes / specials / SpecialStatistics.php
index ea2b5be..2e785b8 100644 (file)
@@ -23,7 +23,7 @@ class SpecialStatistics extends SpecialPage {
        }
        
        public function execute( $par ) {
-               global $wgOut, $wgRequest, $wgMessageCache;
+               global $wgOut, $wgRequest, $wgMessageCache, $wgMemc;
                global $wgDisableCounters, $wgMiserMode;
                $wgMessageCache->loadAllMessages();
                
@@ -48,8 +48,13 @@ class SpecialStatistics extends SpecialPage {
                
                # Set active user count
                if( !$wgMiserMode ) {
-                       $dbw = wfGetDB( DB_MASTER );
-                       SiteStatsUpdate::cacheUpdate( $dbw );
+                       $key = wfMemcKey( 'sitestats', 'activeusers-updated' );
+                       // Re-calculate the count if the last tally is old...
+                       if( !$wgMemc->get($key) ) {
+                               $dbw = wfGetDB( DB_MASTER );
+                               SiteStatsUpdate::cacheUpdate( $dbw );
+                               $wgMemc->set( $key, '1', 24*3600 ); // don't update for 1 day
+                       }
                }
        
                # Do raw output
@@ -156,14 +161,22 @@ class SpecialStatistics extends SpecialPage {
                                                array( 'class' => 'mw-statistics-jobqueue' ) );
        }
        private function getUserStats() {
-               global $wgLang, $wgRCMaxAge;
+               global $wgLang, $wgUser, $wgRCMaxAge;
+               $sk = $wgUser->getSkin();
                return Xml::openElement( 'tr' ) .
                        Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-users', array( 'parseinline' ) ) ) .
                        Xml::closeElement( 'tr' ) .
                                $this->formatRow( wfMsgExt( 'statistics-users', array( 'parseinline' ) ),
                                                $wgLang->formatNum( $this->users ),
                                                array( 'class' => 'mw-statistics-users' ) ) .
-                               $this->formatRow( wfMsgExt( 'statistics-users-active', array( 'parseinline' ) ),
+                               $this->formatRow( wfMsgExt( 'statistics-users-active', array( 'parseinline' ) ) . ' ' .
+                                                       $sk->link(
+                                                               SpecialPage::getTitleFor( 'Activeusers' ),
+                                                               wfMsgHtml( 'listgrouprights-members' ),
+                                                               array(),
+                                                               array(),
+                                                               'known'
+                                                       ),
                                                $wgLang->formatNum( $this->activeUsers ),
                                                array( 'class' => 'mw-statistics-users-active' ),
                                                'statistics-users-active-desc',
@@ -269,7 +282,10 @@ class SpecialStatistics extends SpecialPage {
        
        private function getOtherStats( $stats ) {
                global $wgLang;
-               
+
+               if ( !count( $stats ) )
+                       return '';
+
                $return = Xml::openElement( 'tr' ) .
                        Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-hooks', array( 'parseinline' ) ) ) .
                        Xml::closeElement( 'tr' );