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' => isset(
$params[
'trxProfiler'] ) ?
$params[
'trxProfiler'] :
null,
56 'srvCache' => isset(
$params[
'srvCache'] ) ?
$params[
'srvCache'] :
null,
57 'wanCache' => isset(
$params[
'wanCache'] ) ?
$params[
'wanCache'] : null
60 if ( isset(
$params[
'readOnlyReason'] ) ) {
61 $this->db->setLBInfo(
'readOnlyReason',
$params[
'readOnlyReason'] );
72 return new static( [
'connection' =>
$db ] +
$params );
80class_alias( LoadBalancerSingle::class,
'LoadBalancerSingle' );
Class to handle database/prefix specification for IDatabase domains.