Revert merge of DismissableSiteNotice into the core (r41679 and subsequent edits...
[lhc/web/wiklou.git] / maintenance / getSlaveServer.php
index 9aca104..2525826 100644 (file)
@@ -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";