Maintenance::finalSetup: Make sure we re-create LBFactory
authorMarius Hoch <hoo@online.de>
Tue, 19 Jun 2018 17:46:01 +0000 (19:46 +0200)
committerMarius Hoch <hoo@online.de>
Tue, 19 Jun 2018 17:46:01 +0000 (19:46 +0200)
This seems to work anyway (as no connections are needed at
this time), but I guess it's more robust to explicitly
destroy any existing instances.

Bug: T147169
Change-Id: Id56a62d1830fc1464a80dd4420ffddd797bf8b51

maintenance/Maintenance.php

index 39f8c2a..245bb47 100644 (file)
@@ -1143,6 +1143,8 @@ abstract class Maintenance {
                }
                if ( $this->hasOption( 'dbgroupdefault' ) ) {
                        $wgDBDefaultGroup = $this->getOption( 'dbgroupdefault', null );
+
+                       MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->destroy();
                }
 
                if ( $this->getDbType() == self::DB_ADMIN && isset( $wgDBadminuser ) ) {