3 * This script reports the hostname of a slave server.
9 require_once( "Maintenance.php" );
11 class GetSlaveServer
extends Maintenance
{
12 public function __construct() {
13 parent
::__construct();
14 $this->addParam( "group", "Query group to check specifically" );
15 $this->mDescription
= "Report the hostname of a slave server";
17 public function execute() {
18 global $wgAllDBsAreLocalhost;
19 if( $wgAllDBsAreLocalhost ) {
22 if( $this->hasOption('group') ) {
23 $db = wfGetDB( DB_SLAVE
, $this->getOption('group') );
24 $host = $db->getServer();
27 $i = $lb->getReaderIndex();
28 $host = $lb->getServerName( $i );
31 $this->output( "$host\n" );
35 $maintClass = "GetSlaveServer";
36 require_once( DO_MAINTENANCE
);