summaryrefslogtreecommitdiff
path: root/maintenance/getSlaveServer.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
commit370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch)
tree491674f4c242e4d6ba0d04eafa305174c35a3391 /maintenance/getSlaveServer.php
parentf4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff)
Update auf 1.13.0
Diffstat (limited to 'maintenance/getSlaveServer.php')
-rw-r--r--maintenance/getSlaveServer.php19
1 files changed, 16 insertions, 3 deletions
diff --git a/maintenance/getSlaveServer.php b/maintenance/getSlaveServer.php
index 9aca1043..25258267 100644
--- a/maintenance/getSlaveServer.php
+++ b/maintenance/getSlaveServer.php
@@ -1,13 +1,26 @@
<?php
+/**
+ * This script reports the hostname of a slave server.
+ *
+ * @file
+ * @ingroup Maintenance
+ */
require_once( dirname(__FILE__).'/commandLine.inc' );
+if ( $wgAllDBsAreLocalhost ) {
+ # Can't fool the backup script
+ print "localhost\n";
+ exit;
+}
+
if( isset( $options['group'] ) ) {
$db = wfGetDB( DB_SLAVE, $options['group'] );
- $host = $db->getProperty( 'mServer' );
+ $host = $db->getServer();
} else {
- $i = $wgLoadBalancer->getReaderIndex();
- $host = $wgDBservers[$i]['host'];
+ $lb = wfGetLB();
+ $i = $lb->getReaderIndex();
+ $host = $lb->getServerName( $i );
}
print "$host\n";