summaryrefslogtreecommitdiff
path: root/maintenance/getSlaveServer.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/getSlaveServer.php')
-rw-r--r--maintenance/getSlaveServer.php14
1 files changed, 6 insertions, 8 deletions
diff --git a/maintenance/getSlaveServer.php b/maintenance/getSlaveServer.php
index a9d93f1d..3d13bc4e 100644
--- a/maintenance/getSlaveServer.php
+++ b/maintenance/getSlaveServer.php
@@ -32,15 +32,13 @@ class GetSlaveServer extends Maintenance {
global $wgAllDBsAreLocalhost;
if ( $wgAllDBsAreLocalhost ) {
$host = 'localhost';
+ } elseif ( $this->hasOption( 'group' ) ) {
+ $db = wfGetDB( DB_SLAVE, $this->getOption( 'group' ) );
+ $host = $db->getServer();
} else {
- if ( $this->hasOption( 'group' ) ) {
- $db = wfGetDB( DB_SLAVE, $this->getOption( 'group' ) );
- $host = $db->getServer();
- } else {
- $lb = wfGetLB();
- $i = $lb->getReaderIndex();
- $host = $lb->getServerName( $i );
- }
+ $lb = wfGetLB();
+ $i = $lb->getReaderIndex();
+ $host = $lb->getServerName( $i );
}
$this->output( "$host\n" );
}