26use InvalidArgumentException;
40 if ( !isset( $params[
'connection'] ) ) {
41 throw new InvalidArgumentException(
"Missing 'connection' argument." );
44 $this->db = $params[
'connection'];
46 parent::__construct( [
49 'type' => $this->db->getType(),
50 'host' => $this->db->getServer(),
51 'dbname' => $this->db->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,
62 if ( isset( $params[
'readOnlyReason'] ) ) {
63 $this->db->setLBInfo(
'readOnlyReason', $params[
'readOnlyReason'] );
74 return new static( array_merge(
77 [
'connection' =>
$db ]
93class_alias( LoadBalancerSingle::class,
'LoadBalancerSingle' );
Class to handle database/schema/prefix specifications for IDatabase.