73 foreach (array_keys(get_class_vars(__CLASS__)) as $prop) {
74 $this->{$prop} = $config->{$prop} ?? null;
86 $obj = new \stdClass();
87 foreach (array_keys(get_class_vars(__CLASS__)) as $prop) {
88 $obj->{$prop} = $config->{$prop};
91 return new self($obj);
109 return $this->db[
'split'] ??
false;
171 if (array_key_exists(
'dbhost', $this->db[$type])) {
174 'host' => $this->db[
$type][
'dbhost'],
175 'port' => $this->db[
$type][
'dbport'],
176 'user' => $this->db[
$type][
'dbuser'],
177 'password' => $this->db[
$type][
'dbpass'],
178 'database' => $this->db[
$type][
'dbname'],
183 $index = array_rand($this->db[$type]);
Database configuration service.
getGeneralConnectionConfig()
Get the read/write database connection information.
static fromElggConfig(Config $config)
Construct from an Elgg Config.
isDatabaseSplit()
Are the read and write connections separate?
$CONFIG dbencoding
The database encoding.
getConnectionConfig(string $type=self::READ_WRITE)
Get the connection configuration.
$config
Advanced site settings, debugging section.
getTablePrefix()
Get the database table prefix.
getParticularConnectionConfig(string $type)
Get connection information for reading or writing.
__construct(\stdClass $config)
Constructor.