final public static function Database::parseConnectionInfo in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::parseConnectionInfo()
Process the configuration file for database information.
Parameters
array $info: The database connection information, as defined in settings.php. The structure of this array depends on the database driver it is connecting to.
1 call to Database::parseConnectionInfo()
- Database::addConnectionInfo in core/
lib/ Drupal/ Core/ Database/ Database.php - Adds database connection information for a given key/target.
File
- core/
lib/ Drupal/ Core/ Database/ Database.php, line 210
Class
- Database
- Primary front-controller for the database system.
Namespace
Drupal\Core\DatabaseCode
public static final function parseConnectionInfo(array $info) {
// If there is no "driver" property, then we assume it's an array of
// possible connections for this target. Pick one at random. That allows
// us to have, for example, multiple replica servers.
if (empty($info['driver'])) {
$info = $info[mt_rand(0, count($info) - 1)];
}
// Parse the prefix information.
if (!isset($info['prefix'])) {
// Default to an empty prefix.
$info['prefix'] = [
'default' => '',
];
}
elseif (!is_array($info['prefix'])) {
// Transform the flat form into an array form.
$info['prefix'] = [
'default' => $info['prefix'],
];
}
return $info;
}