Don't log HttpErrors in the exception log, use MWLogger
[lhc/web/wiklou.git] / maintenance / showCacheStats.php
index 1eb8d66..3d16af1 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup Maintenance
  */
 
-require_once( __DIR__ . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
 
 /**
  * Maintenance script that shows statistics from the cache.
@@ -46,17 +46,6 @@ class ShowCacheStats extends Maintenance {
                if ( get_class( $wgMemc ) == 'EmptyBagOStuff' ) {
                        $this->error( "You are running EmptyBagOStuff, I can not provide any statistics.", true );
                }
-               $session = intval( $wgMemc->get( wfMemcKey( 'stats', 'request_with_session' ) ) );
-               $noSession = intval( $wgMemc->get( wfMemcKey( 'stats', 'request_without_session' ) ) );
-               $total = $session + $noSession;
-               if ( $total == 0 ) {
-                       $this->error( "You either have no stats or the cache isn't running. Aborting.", true );
-               }
-               $this->output( "Requests\n" );
-               $this->output( sprintf( "with session:      %-10d %6.2f%%\n", $session, $session / $total * 100 ) );
-               $this->output( sprintf( "without session:   %-10d %6.2f%%\n", $noSession, $noSession / $total * 100 ) );
-               $this->output( sprintf( "total:             %-10d %6.2f%%\n", $total, 100 ) );
-
 
                $this->output( "\nParser cache\n" );
                $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_hit' ) ) );
@@ -66,8 +55,16 @@ class ShowCacheStats extends Maintenance {
                $total = $hits + $expired + $absent + $stub;
                if ( $total ) {
                        $this->output( sprintf( "hits:              %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) );
-                       $this->output( sprintf( "expired:           %-10d %6.2f%%\n", $expired, $expired / $total * 100 ) );
-                       $this->output( sprintf( "absent:            %-10d %6.2f%%\n", $absent, $absent / $total * 100 ) );
+                       $this->output( sprintf(
+                               "expired:           %-10d %6.2f%%\n",
+                               $expired,
+                               $expired / $total * 100
+                       ) );
+                       $this->output( sprintf(
+                               "absent:            %-10d %6.2f%%\n",
+                               $absent,
+                               $absent / $total * 100
+                       ) );
                        $this->output( sprintf( "stub threshold:    %-10d %6.2f%%\n", $stub, $stub / $total * 100 ) );
                        $this->output( sprintf( "total:             %-10d %6.2f%%\n", $total, 100 ) );
                } else {
@@ -81,7 +78,11 @@ class ShowCacheStats extends Maintenance {
                $total = $hits + $misses;
                if ( $total ) {
                        $this->output( sprintf( "hits:              %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) );
-                       $this->output( sprintf( "misses:            %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) );
+                       $this->output( sprintf(
+                               "misses:            %-10d %6.2f%%\n",
+                               $misses,
+                               $misses / $total * 100
+                       ) );
                        $this->output( sprintf( "updates:           %-10d\n", $updates ) );
                } else {
                        $this->output( "no statistics available\n" );
@@ -94,8 +95,16 @@ class ShowCacheStats extends Maintenance {
                $total = $hits + $misses + $uncacheable;
                if ( $total ) {
                        $this->output( sprintf( "hits:              %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) );
-                       $this->output( sprintf( "misses:            %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) );
-                       $this->output( sprintf( "uncacheable:       %-10d %6.2f%%\n", $uncacheable, $uncacheable / $total * 100 ) );
+                       $this->output( sprintf(
+                               "misses:            %-10d %6.2f%%\n",
+                               $misses,
+                               $misses / $total * 100
+                       ) );
+                       $this->output( sprintf(
+                               "uncacheable:       %-10d %6.2f%%\n",
+                               $uncacheable,
+                               $uncacheable / $total * 100
+                       ) );
                } else {
                        $this->output( "no statistics available\n" );
                }