getConfigVar( 'EchoCluster' ); if ( !$cluster ) { // This case is adequately handled by LoadExtensionSchemaUpdates return Status::newGood(); } // Get the load balancer $lbFactory = $this->getServices()->getDBLoadBalancerFactory(); $databaseCreator = $this->getDatabaseCreator(); $domainId = $lbFactory->getLocalDomainID(); $database = DatabaseDomain::newFromId( $domainId )->getDatabase(); $echoLB = $lbFactory->getExternalLB( $cluster ); // Create database if ( !$databaseCreator->existsInLoadBalancer( $echoLB, $database ) ) { $databaseCreator->createInLoadBalancer( $echoLB, $database ); } // Create tables $dbw = $echoLB->getMaintenanceConnectionRef( DB_PRIMARY ); $dbw->setSchemaVars( $this->getContext()->getSchemaVars() ); return $this->applySourceFile( $dbw, 'tables-generated.sql' ); } }