summaryrefslogtreecommitdiff
path: root/maintenance/getLagTimes.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/getLagTimes.php')
-rw-r--r--maintenance/getLagTimes.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/maintenance/getLagTimes.php b/maintenance/getLagTimes.php
new file mode 100644
index 00000000..f2c06f6a
--- /dev/null
+++ b/maintenance/getLagTimes.php
@@ -0,0 +1,23 @@
+<?php
+
+require 'commandLine.inc';
+
+if( empty( $wgDBservers ) ) {
+ echo "This script dumps replication lag times, but you don't seem to have\n";
+ echo "a multi-host db server configuration.\n";
+} else {
+ $lags = $wgLoadBalancer->getLagTimes();
+ foreach( $lags as $n => $lag ) {
+ $host = $wgDBservers[$n]["host"];
+ if( IP::isValid( $host ) ) {
+ $ip = $host;
+ $host = gethostbyaddr( $host );
+ } else {
+ $ip = gethostbyname( $host );
+ }
+ $stars = str_repeat( '*', intval( $lag ) );
+ printf( "%10s %20s %3d %s\n", $ip, $host, $lag, $stars );
+ }
+}
+
+?> \ No newline at end of file