function install_database_errors
Same name in other branches
- 7.x includes/install.core.inc \install_database_errors()
- 9 core/includes/install.core.inc \install_database_errors()
- 8.9.x core/includes/install.core.inc \install_database_errors()
- 11.x core/includes/install.core.inc \install_database_errors()
Checks a database connection and returns any errors.
3 calls to install_database_errors()
- install_check_requirements in core/
includes/ install.core.inc - Checks installation requirements and reports any errors.
- install_verify_database_settings in core/
includes/ install.core.inc - Verifies that settings.php specifies a valid database connection.
- SiteSettingsForm::getDatabaseErrors in core/
lib/ Drupal/ Core/ Installer/ Form/ SiteSettingsForm.php - Get any database errors and links them to a form element.
File
-
core/
includes/ install.core.inc, line 1212
Code
function install_database_errors($database, $settings_file) {
$errors = [];
try {
$driverExtension = Database::getDriverList()->get($database['namespace']);
// Run driver specific validation
$errors = $driverExtension->getInstallTasks()
->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 = $driverExtension->getInstallTasks()
->runTasks();
} catch (UnknownExtensionException $e) {
$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.", [
'%settings_file' => $settings_file,
'@drupal' => drupal_install_profile_distribution_name(),
'%driver' => $database['driver'],
]);
}
return $errors;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.