]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - maintenance/stats.php
MediaWiki 1.14.0
[autoinstallsdev/mediawiki.git] / maintenance / stats.php
index dc8d4b05c8f57f79eee6f95b38ed2b448be494ba..00f79ded817266b82a02af61580c62506746ba4e 100644 (file)
@@ -1,14 +1,23 @@
 <?php
+/**
+ * Show statistics from memcached
+ *
+ * @file
+ * @ingroup Maintenance
+ */
+
 require_once('commandLine.inc');
 
 if( get_class( $wgMemc ) == 'FakeMemCachedClient' ) {
        die("You are running FakeMemCachedClient, I can not provide any statistics.\n");
 }
-
-print "Requests\n";
 $session = intval($wgMemc->get(wfMemcKey('stats','request_with_session')));
 $noSession = intval($wgMemc->get(wfMemcKey('stats','request_without_session')));
 $total = $session + $noSession;
+if ( $total == 0 ) {
+       die("You either have no stats or memcached isn't running. Aborting.\n");
+}
+print "Requests\n";
 printf( "with session:      %-10d %6.2f%%\n", $session, $session/$total*100 );
 printf( "without session:   %-10d %6.2f%%\n", $noSession, $noSession/$total*100 );
 printf( "total:             %-10d %6.2f%%\n", $total, 100 );