]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - maintenance/getSlaveServer.php
MediaWiki 1.14.0-scripts
[autoinstalls/mediawiki.git] / maintenance / getSlaveServer.php
1 <?php
2 /**
3  * This script reports the hostname of a slave server.
4  *
5  * @file
6  * @ingroup Maintenance
7  */
8
9 require_once( dirname(__FILE__).'/commandLine.inc' );
10
11 if ( $wgAllDBsAreLocalhost ) {
12         # Can't fool the backup script
13         print "localhost\n";
14         exit;
15 }
16
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 );
24 }
25
26 print "$host\n";
27
28