De-Wikimedified lag.php script and merged to trunk. Still not 100% sure what the...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 15 Sep 2009 00:24:24 +0000 (00:24 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 15 Sep 2009 00:24:24 +0000 (00:24 +0000)
maintenance/lag.php [new file with mode: 0644]

diff --git a/maintenance/lag.php b/maintenance/lag.php
new file mode 100644 (file)
index 0000000..6d0e76e
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+$wgUseNormalUser = true;
+require_once('commandLine.inc');
+
+if ( isset( $options['r'] ) ) {
+       $lb = wfGetLB();
+       print 'time     ';
+       for( $i = 0; $i < $lb->getServerCount(); $i++ ) {
+               $hostname = $lb->getServerName( $i );
+               printf("%-12s ", $hostname );
+       }
+       print("\n");
+       
+       while( 1 ) {
+               $lags = $lb->getLagTimes();
+               unset( $lags[0] );
+               print( gmdate( 'H:i:s' ) . ' ' );
+               foreach( $lags as $i => $lag ) {
+                       printf("%-12s " , $lag === false ? 'false' : $lag );
+               }
+               print("\n");
+               sleep(5);
+       }
+} else {
+       $lb = wfGetLB();
+       $lags = $lb->getLagTimes();
+       foreach( $lags as $i => $lag ) {
+               $name = $lb->getServerName( $i );
+               printf("%-20s %s\n" , $name, $lag === false ? 'false' : $lag );
+       }
+}
+?>