function system_post_update_enable_provider_database_driver
Enable the modules that are providing the listed database drivers.
File
-
core/
modules/ system/ system.post_update.php, line 246
Code
function system_post_update_enable_provider_database_driver() {
$modules_to_install = [];
foreach (Database::getAllConnectionInfo() as $targets) {
foreach ($targets as $target) {
// Provider determination taken from Connection::getProvider().
[
$first,
$second,
] = explode('\\', $target['namespace'] ?? '', 3);
$provider = $first === 'Drupal' && strtolower($second) === $second ? $second : 'core';
if ($provider !== 'core' && !\Drupal::moduleHandler()->moduleExists($provider)) {
$autoload = $target['autoload'] ?? '';
// We are only enabling the module for database drivers that are
// provided by a module.
if (str_contains($autoload, 'src/Driver/Database/')) {
$modules_to_install[$provider] = TRUE;
}
}
}
}
if ($modules_to_install !== []) {
\Drupal::service('module_installer')->install(array_keys($modules_to_install));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.