Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
GetCentralAuthDBInfo
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3$IP = getenv( 'MW_INSTALL_PATH' );
4if ( $IP === false ) {
5    $IP = __DIR__ . '/../../..';
6}
7require_once "$IP/maintenance/Maintenance.php";
8
9use MediaWiki\Extension\CentralAuth\CentralAuthServices;
10
11class GetCentralAuthDBInfo extends Maintenance {
12    public function __construct() {
13        parent::__construct();
14        $this->requireExtension( 'CentralAuth' );
15        $this->addDescription( 'Display info for replica server hosting the CentralAuth database' );
16    }
17
18    public function execute() {
19        $db = CentralAuthServices::getDatabaseManager()->getCentralReplicaDB();
20        $host = $db->getServer();
21        $this->output( "$host\n" );
22    }
23}
24
25$maintClass = GetCentralAuthDBInfo::class;
26require_once RUN_MAINTENANCE_IF_MAIN;