22use InvalidArgumentException;
41 $conn = $params[
'connection'] ??
null;
43 throw new InvalidArgumentException(
"Missing 'connection' argument." );
48 parent::__construct( [
50 'type' => $conn->getType(),
51 'host' => $conn->getServer(),
52 'dbname' => $conn->getDBname(),
55 'trxProfiler' => $params[
'trxProfiler'] ??
null,
56 'srvCache' => $params[
'srvCache'] ??
null,
57 'wanCache' => $params[
'wanCache'] ??
null,
58 'localDomain' => $params[
'localDomain'] ?? $this->db->getDomainID(),
59 'readOnlyReason' => $params[
'readOnlyReason'] ??
false,
60 'clusterName' => $params[
'clusterName'] ??
null,
63 if ( isset( $params[
'readOnlyReason'] ) ) {
64 $conn->setLBInfo( $conn::LB_READ_ONLY_REASON, $params[
'readOnlyReason'] );
75 return new static( array_merge(
78 [
'connection' => $db ]
94class_alias( LoadBalancerSingle::class,
'LoadBalancerSingle' );
Class to handle database/schema/prefix specifications for IDatabase.