De-Wikimedified lag.php script and merged to trunk. Still not 100% sure what the...
[lhc/web/wiklou.git] / maintenance / lag.php
1 <?php
2
3 $wgUseNormalUser = true;
4 require_once('commandLine.inc');
5
6 if ( isset( $options['r'] ) ) {
7 $lb = wfGetLB();
8 print 'time ';
9 for( $i = 0; $i < $lb->getServerCount(); $i++ ) {
10 $hostname = $lb->getServerName( $i );
11 printf("%-12s ", $hostname );
12 }
13 print("\n");
14
15 while( 1 ) {
16 $lags = $lb->getLagTimes();
17 unset( $lags[0] );
18 print( gmdate( 'H:i:s' ) . ' ' );
19 foreach( $lags as $i => $lag ) {
20 printf("%-12s " , $lag === false ? 'false' : $lag );
21 }
22 print("\n");
23 sleep(5);
24 }
25 } else {
26 $lb = wfGetLB();
27 $lags = $lb->getLagTimes();
28 foreach( $lags as $i => $lag ) {
29 $name = $lb->getServerName( $i );
30 printf("%-20s %s\n" , $name, $lag === false ? 'false' : $lag );
31 }
32 }
33 ?>