db = $params['connection']; parent::__construct( [ 'servers' => [ [ 'type' => $this->db->getType(), 'host' => $this->db->getServer(), 'dbname' => $this->db->getDBname(), 'load' => 1, ] ], 'trxProfiler' => $params['trxProfiler'] ?? null, 'srvCache' => $params['srvCache'] ?? null, 'wanCache' => $params['wanCache'] ?? null, 'localDomain' => $params['localDomain'] ?? $this->db->getDomainID(), 'readOnlyReason' => $params['readOnlyReason'] ?? false, ] ); if ( isset( $params['readOnlyReason'] ) ) { $this->db->setLBInfo( 'readOnlyReason', $params['readOnlyReason'] ); } } /** * @param IDatabase $db Live connection handle * @param array $params Parameter map to LoadBalancerSingle::__constructs() * @return LoadBalancerSingle * @since 1.28 */ public static function newFromConnection( IDatabase $db, array $params = [] ) { return new static( array_merge( [ 'localDomain' => $db->getDomainID() ], $params, [ 'connection' => $db ] ) ); } protected function reallyOpenConnection( array $server, DatabaseDomain $domain ) { return $this->db; } } /** * @deprecated since 1.29 */ class_alias( LoadBalancerSingle::class, 'LoadBalancerSingle' );