Fix for r47482: put the RELEASE-NOTES entry in the "bug fixes" section and not the...
[mediawiki.git] / maintenance / getLagTimes.php
blob0f750caf5991509e7b3aaa7900431a129c13dde1
1 <?php
2 /**
3 * @file
4 * @ingroup Maintenance
5 */
7 require 'commandLine.inc';
9 $lb = wfGetLB();
11 if( $lb->getServerCount() == 1 ) {
12 echo "This script dumps replication lag times, but you don't seem to have\n";
13 echo "a multi-host db server configuration.\n";
14 } else {
15 $lags = $lb->getLagTimes();
16 foreach( $lags as $n => $lag ) {
17 $host = $lb->getServerName( $n );
18 if( IP::isValid( $host ) ) {
19 $ip = $host;
20 $host = gethostbyaddr( $host );
21 } else {
22 $ip = gethostbyname( $host );
24 $starLen = min( intval( $lag ), 40 );
25 $stars = str_repeat( '*', $starLen );
26 printf( "%10s %20s %3d %s\n", $ip, $host, $lag, $stars );