On this page
function install_database_errors
install_database_errors($database, $settings_file)
Checks a database connection and returns any errors.
File
- core/includes/install.core.inc, line 1125
- API functions for installing Drupal.
Code
function install_database_errors($database, $settings_file) {
$errors = array();
// Check database type.
$database_types = drupal_get_database_types();
$driver = $database['driver'];
if (!isset($database_types[$driver])) {
$errors['driver'] = t("In your %settings_file file you have configured @drupal to use a %driver server, however your PHP installation currently does not support this database type.", array('%settings_file' => $settings_file, '@drupal' => drupal_install_profile_distribution_name(), '%driver' => $driver));
}
else {
// Run driver specific validation
$errors += $database_types[$driver]->validateDatabaseSettings($database);
if (!empty($errors)) {
// No point to try further.
return $errors;
}
// Run tasks associated with the database type. Any errors are caught in the
// calling function.
Database::addConnectionInfo('default', 'default', $database);
$errors = db_installer_object($driver)->runTasks();
}
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!includes!install.core.inc/function/install_database_errors/8.1.x