final public static function Database::parseConnectionInfo

final public static Database::parseConnectionInfo(array $info)

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.

File

core/lib/Drupal/Core/Database/Database.php, line 207

Class

Database
Primary front-controller for the database system.

Namespace

Drupal\Core\Database

Code

final public static 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'] = array(
      'default' => '',
    );
  }
  elseif (!is_array($info['prefix'])) {
    // Transform the flat form into an array form.
    $info['prefix'] = array(
      'default' => $info['prefix'],
    );
  }
  return $info;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Database.php/function/Database::parseConnectionInfo/8.1.x