/** * @param array $params An associative array with one member: * - connection: An IDatabase connection object */ public function __construct(array $params) { if (!isset($params['connection'])) { throw new InvalidArgumentException("Missing 'connection' argument."); } $this->db = $params['connection']; parent::__construct(['servers' => [['type' => $this->db->getType(), 'host' => $this->db->getServer(), 'dbname' => $this->db->getDBname(), 'load' => 1]], 'trxProfiler' => isset($params['trxProfiler']) ? $params['trxProfiler'] : null, 'srvCache' => isset($params['srvCache']) ? $params['srvCache'] : null, 'wanCache' => isset($params['wanCache']) ? $params['wanCache'] : null]); if (isset($params['readOnlyReason'])) { $this->db->setLBInfo('readOnlyReason', $params['readOnlyReason']); } }