42 foreach (array_keys(get_class_vars(__CLASS__)) as $prop) {
43 $this->{$prop} = isset($config->{$prop}) ? $config->{$prop} : null;
55 $obj = new \stdClass();
56 foreach (array_keys(get_class_vars(__CLASS__)) as $prop) {
57 $obj->{$prop} = $config->{$prop};
59 return new self($obj);
77 if (isset($this->db[
'split'])) {
78 return $this->db[
'split'];
82 if (isset($this->db->split)) {
83 elgg_deprecated_notice(
'Database configuration should be updated to an array. Check the settings.example.php',
'4.3');
85 return $this->db->split;
148 if (is_object($this->db[
$type])) {
149 elgg_deprecated_notice(
'Database configuration should be updated to an array. Check the settings.example.php',
'4.3');
153 'host' => $this->db[
$type]->dbhost,
154 'port' => $this->db[
$type]->dbport,
155 'user' => $this->db[
$type]->dbuser,
156 'password' => $this->db[
$type]->dbpass,
157 'database' => $this->db[
$type]->dbname,
159 }
else if (array_key_exists(
'dbhost', $this->db[$type])) {
162 'host' => $this->db[
$type][
'dbhost'],
163 'port' => $this->db[
$type][
'dbport'],
164 'user' => $this->db[
$type][
'dbuser'],
165 'password' => $this->db[
$type][
'dbpass'],
166 'database' => $this->db[
$type][
'dbname'],
168 }
else if (is_object(current($this->db[$type]))) {
169 elgg_deprecated_notice(
'Database configuration should be updated to an array. Check the settings.example.php',
'4.3');
172 $index = array_rand($this->db[$type]);
182 $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.
elgg_deprecated_notice(string $msg, string $dep_version)
Log a notice about deprecated use of a function, view, etc.
getConnectionConfig($type=self::READ_WRITE)
Get the connection configuration.
getParticularConnectionConfig($type)
Get connection information for reading or writing.
isDatabaseSplit()
Are the read and write connections separate?
$CONFIG dbencoding
The database encoding.
$config
Advanced site settings, debugging section.
getTablePrefix()
Get the database table prefix.
__construct(\stdClass $config)
Constructor.