Make sure DBLoadBalancerFactory service is not disabled

After b873e929, when the CLI installation failed, the script will throw
a ServiceDisabledException.
This is because the installer disables DBLoadBalancerFactory service
during instantiation and throws the exception because the installation
failed to restore the service.
So I check if the service is enabled before try commit
the master changes.

Bug: T229601
Change-Id: Ia7589d14ee55bcb03a64856b6dd2c81d8bda783c
This commit is contained in:
RazeSoldier 2019-09-25 22:54:13 +08:00
parent 570c19f1f5
commit eadde762b0

View file

@ -118,7 +118,10 @@ try {
// Potentially debug globals
$maintenance->globals();
if ( $maintenance->getDbType() !== Maintenance::DB_NONE ) {
if ( $maintenance->getDbType() !== Maintenance::DB_NONE &&
// Service might be disabled, e.g. when running install.php
!MediaWikiServices::getInstance()->isServiceDisabled( 'DBLoadBalancerFactory' )
) {
// Perform deferred updates.
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$lbFactory->commitMasterChanges( $maintClass );