- // Get a DB handle (with this wiki's DB selected) from the appropriate load balancer
- $db = $lb->getConnection( $index, array(), $wiki );
- if ( $this->hasOption( 'slave' ) && $db->getLBInfo( 'master' ) !== null ) {
- $this->error( "The server selected ({$db->getServer()}) is not a slave.", 1 );
+
+ /** @var IDatabase $db DB handle for the appropriate cluster/wiki */
+ $db = $lb->getConnection( $index, [], $wiki );
+ if ( $replicaDB != '' && $db->getLBInfo( 'master' ) !== null ) {
+ $this->fatalError( "The server selected ({$db->getServer()}) is not a replica DB." );
+ }
+
+ if ( $index === DB_MASTER ) {
+ $updater = DatabaseUpdater::newForDB( $db, true, $this );
+ $db->setSchemaVars( $updater->getSchemaVars() );