Loading core/includes/install.core.inc +33 −1 Original line number Diff line number Diff line Loading @@ -1582,6 +1582,10 @@ function install_profile_modules(&$install_state) { install_core_entity_type_definitions(); $modules = $install_state['profile_info']['install']; $database_module = _install_get_database_module_name(); if ($database_module !== NULL) { array_unshift($modules, $database_module); } // Extra module support is only implemented by the testing framework, to // reduce the number of container rebuilds during test runs. Loading Loading @@ -2548,8 +2552,10 @@ function install_recipe_required_modules(array $install_state) { // Always install required modules first. $required = []; $database_module = _install_get_database_module_name(); foreach ($files as $module => $extension) { if (!empty($extension->info['required'])) { if (!empty($extension->info['required']) || $module === $database_module) { $required[$module] = $extension->sort; } } Loading Loading @@ -2589,3 +2595,29 @@ function install_recipe_batch(&$install_state) { return $batch_builder->toArray(); } /** * Gets the database driver module name. * * The database driver is provided by a module. That module must be * installed before any other module, as it must be able to override any call * to hook_schema() or any "backend_overridable" service. In edge cases, a * driver module may extend from another driver module. In order for the * extended classes to be autoloadable, the extending module should list the * extended module in its dependencies. * * @return ?string * The database driver module or NULL if none is found. */ function _install_get_database_module_name(): ?string { $connection = Database::getConnection(); $provider = $connection->getProvider(); $database_module = NULL; if ($provider !== 'core') { $autoload = $connection->getConnectionOptions()['autoload'] ?? ''; if (str_contains($autoload, 'src/Driver/Database/')) { $database_module = $provider; } } return $database_module; } core/includes/install.inc +0 −18 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Database\Database; use Drupal\Core\Extension\Dependency; use Drupal\Core\Extension\Extension; use Drupal\Core\Extension\ExtensionDiscovery; Loading Loading @@ -224,23 +223,6 @@ function drupal_install_system($install_state): void { $config->set('profile', $install_state['parameters']['profile']); } $config->save(); $connection = Database::getConnection(); $provider = $connection->getProvider(); // When the database driver is provided by a module, then install that module. // This module must be installed before any other module, as it must be able // to override any call to hook_schema() or any "backend_overridable" service. // In edge cases, a driver module may extend from another driver module (for // instance, a module to provide backward compatibility with a database // version no longer supported by core). In order for the extended classes to // be autoloadable, the extending module should list the extended module in // its dependencies, and here the dependencies will be installed as well. if ($provider !== 'core') { $autoload = $connection->getConnectionOptions()['autoload'] ?? ''; if (str_contains($autoload, 'src/Driver/Database/')) { $kernel->getContainer()->get('module_installer')->install([$provider], TRUE); } } } /** Loading core/modules/pgsql/pgsql.info.yml +1 −0 Original line number Diff line number Diff line Loading @@ -3,3 +3,4 @@ type: module description: 'Provides the PostgreSQL database driver.' package: Core version: VERSION container_rebuild_required: true Loading
core/includes/install.core.inc +33 −1 Original line number Diff line number Diff line Loading @@ -1582,6 +1582,10 @@ function install_profile_modules(&$install_state) { install_core_entity_type_definitions(); $modules = $install_state['profile_info']['install']; $database_module = _install_get_database_module_name(); if ($database_module !== NULL) { array_unshift($modules, $database_module); } // Extra module support is only implemented by the testing framework, to // reduce the number of container rebuilds during test runs. Loading Loading @@ -2548,8 +2552,10 @@ function install_recipe_required_modules(array $install_state) { // Always install required modules first. $required = []; $database_module = _install_get_database_module_name(); foreach ($files as $module => $extension) { if (!empty($extension->info['required'])) { if (!empty($extension->info['required']) || $module === $database_module) { $required[$module] = $extension->sort; } } Loading Loading @@ -2589,3 +2595,29 @@ function install_recipe_batch(&$install_state) { return $batch_builder->toArray(); } /** * Gets the database driver module name. * * The database driver is provided by a module. That module must be * installed before any other module, as it must be able to override any call * to hook_schema() or any "backend_overridable" service. In edge cases, a * driver module may extend from another driver module. In order for the * extended classes to be autoloadable, the extending module should list the * extended module in its dependencies. * * @return ?string * The database driver module or NULL if none is found. */ function _install_get_database_module_name(): ?string { $connection = Database::getConnection(); $provider = $connection->getProvider(); $database_module = NULL; if ($provider !== 'core') { $autoload = $connection->getConnectionOptions()['autoload'] ?? ''; if (str_contains($autoload, 'src/Driver/Database/')) { $database_module = $provider; } } return $database_module; }
core/includes/install.inc +0 −18 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Database\Database; use Drupal\Core\Extension\Dependency; use Drupal\Core\Extension\Extension; use Drupal\Core\Extension\ExtensionDiscovery; Loading Loading @@ -224,23 +223,6 @@ function drupal_install_system($install_state): void { $config->set('profile', $install_state['parameters']['profile']); } $config->save(); $connection = Database::getConnection(); $provider = $connection->getProvider(); // When the database driver is provided by a module, then install that module. // This module must be installed before any other module, as it must be able // to override any call to hook_schema() or any "backend_overridable" service. // In edge cases, a driver module may extend from another driver module (for // instance, a module to provide backward compatibility with a database // version no longer supported by core). In order for the extended classes to // be autoloadable, the extending module should list the extended module in // its dependencies, and here the dependencies will be installed as well. if ($provider !== 'core') { $autoload = $connection->getConnectionOptions()['autoload'] ?? ''; if (str_contains($autoload, 'src/Driver/Database/')) { $kernel->getContainer()->get('module_installer')->install([$provider], TRUE); } } } /** Loading
core/modules/pgsql/pgsql.info.yml +1 −0 Original line number Diff line number Diff line Loading @@ -3,3 +3,4 @@ type: module description: 'Provides the PostgreSQL database driver.' package: Core version: VERSION container_rebuild_required: true