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;
}
doc_Drupal
2016-10-29 08:59:32
Comments
Leave a Comment

Please login to continue.