Fix 12384 : comment on maintenance/*php files
[lhc/web/wiklou.git] / maintenance / getSlaveServer.php
1 <?php
2 /**
3 * This script report 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