Moved file deletion code to a more abstract FileDeleteForm::doDelete
[lhc/web/wiklou.git] / maintenance / getLagTimes.php
1 <?php
2
3 require 'commandLine.inc';
4
5 $lb = wfGetLB();
6
7 if( $lb->getServerCount() == 1 ) {
8 echo "This script dumps replication lag times, but you don't seem to have\n";
9 echo "a multi-host db server configuration.\n";
10 } else {
11 $lags = $lb->getLagTimes();
12 foreach( $lags as $n => $lag ) {
13 $host = $lb->getServerName( $n );
14 if( IP::isValid( $host ) ) {
15 $ip = $host;
16 $host = gethostbyaddr( $host );
17 } else {
18 $ip = gethostbyname( $host );
19 }
20 $starLen = min( intval( $lag ), 40 );
21 $stars = str_repeat( '*', $starLen );
22 printf( "%10s %20s %3d %s\n", $ip, $host, $lag, $stars );
23 }
24 }
25