(bug 11330) Improper use of WebRequest::getIntOrNull()
[mediawiki.git] / maintenance / getSlaveServer.php
blob25258267e25a1e5e9d3c168cc547eb2384d9bf85
1 <?php
2 /**
3 * This script reports the hostname of a slave server.
5 * @file
6 * @ingroup Maintenance
7 */
9 require_once( dirname(__FILE__).'/commandLine.inc' );
11 if ( $wgAllDBsAreLocalhost ) {
12 # Can't fool the backup script
13 print "localhost\n";
14 exit;
17 if( isset( $options['group'] ) ) {
18 $db = wfGetDB( DB_SLAVE, $options['group'] );
19 $host = $db->getServer();
20 } else {
21 $lb = wfGetLB();
22 $i = $lb->getReaderIndex();
23 $host = $lb->getServerName( $i );
26 print "$host\n";