public function Tasks::validateDatabaseSettings

public Tasks::validateDatabaseSettings($database)

Validates driver specific configuration settings.

Checks to ensure correct basic database settings and that a proper connection to the database can be established.

Parameters

$database: An array of driver specific configuration options.

Return value

An array of driver configuration errors, keyed by form element name.

File

core/lib/Drupal/Core/Database/Install/Tasks.php, line 289

Class

Tasks
Database installer structure.

Namespace

Drupal\Core\Database\Install

Code

public function validateDatabaseSettings($database) {
  $errors = array();

  // Verify the table prefix.
  if (!empty($database['prefix']) && is_string($database['prefix']) && !preg_match('/^[A-Za-z0-9_.]+$/', $database['prefix'])) {
    $errors[$database['driver'] . '][prefix'] = t('The database table prefix you have entered, %prefix, is invalid. The table prefix can only contain alphanumeric characters, periods, or underscores.', array('%prefix' => $database['prefix']));
  }

  return $errors;
}

© 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!Install!Tasks.php/function/Tasks::validateDatabaseSettings/8.1.x