"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "maintenance/getReplicaServer.php" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

getReplicaServer.php  (mediawiki-1.31.1):getReplicaServer.php  (mediawiki-1.32.0)
skipping to change at line 26 skipping to change at line 26
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html * http://www.gnu.org/copyleft/gpl.html
* *
* @file * @file
* @ingroup Maintenance * @ingroup Maintenance
*/ */
require_once __DIR__ . '/Maintenance.php'; require_once __DIR__ . '/Maintenance.php';
use MediaWiki\MediaWikiServices;
/** /**
* Maintenance script that reports the hostname of a replica DB server. * Maintenance script that reports the hostname of a replica DB server.
* *
* @ingroup Maintenance * @ingroup Maintenance
*/ */
class GetSlaveServer extends Maintenance { class GetReplicaServer extends Maintenance {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->addOption( "group", "Query group to check specifically" ); $this->addOption( "group", "Query group to check specifically" );
$this->addDescription( 'Report the hostname of a replica DB serve r' ); $this->addDescription( 'Report the hostname of a replica DB serve r' );
} }
public function execute() { public function execute() {
global $wgAllDBsAreLocalhost; global $wgAllDBsAreLocalhost;
if ( $wgAllDBsAreLocalhost ) { if ( $wgAllDBsAreLocalhost ) {
$host = 'localhost'; $host = 'localhost';
} elseif ( $this->hasOption( 'group' ) ) { } elseif ( $this->hasOption( 'group' ) ) {
$db = $this->getDB( DB_REPLICA, $this->getOption( 'group' ) ); $db = $this->getDB( DB_REPLICA, $this->getOption( 'group' ) );
$host = $db->getServer(); $host = $db->getServer();
} else { } else {
$lb = wfGetLB(); $lb = MediaWikiServices::getInstance()->getDBLoadBalancer ();
$i = $lb->getReaderIndex(); $i = $lb->getReaderIndex();
$host = $lb->getServerName( $i ); $host = $lb->getServerName( $i );
} }
$this->output( "$host\n" ); $this->output( "$host\n" );
} }
} }
$maintClass = GetSlaveServer::class; $maintClass = GetReplicaServer::class;
require_once RUN_MAINTENANCE_IF_MAIN; require_once RUN_MAINTENANCE_IF_MAIN;
 End of changes. 4 change blocks. 
3 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)