diff --git a/core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php b/core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php index 1df8f07..57bea76 100644 --- a/core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php +++ b/core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Config; -use Drupal\Component\Utility\Settings; use Drupal\Core\Database\Database; /** @@ -16,19 +15,20 @@ class BootstrapConfigStorageFactory { /** - * Returns a configuration storage implementation. + * Returns a Database configuration storage implementation. * - * @return \Drupal\Core\Config\StorageInterface - * A configuration storage implementation. + * @return \Drupal\Core\Config\DatabaseStorage */ - public static function get() { - $drupal_bootstrap_config_storage = Settings::get('drupal_bootstrap_config_storage'); - if ($drupal_bootstrap_config_storage && is_callable($drupal_bootstrap_config_storage)) { - return call_user_func($drupal_bootstrap_config_storage); - } - else { - return new DatabaseStorage(Database::getConnection(), 'config'); - } + public static function getDatabaseStorage() { + return new DatabaseStorage(Database::getConnection(), 'config'); } + /** + * Returns a File-based configuration storage implementation. + * + * @return \Drupal\Core\Config\FileStorage + */ + public static function getFileStorage() { + return new FileStorage(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY)); + } } diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 8812cab..0482bc6 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -7,10 +7,9 @@ namespace Drupal\Core; +use Drupal\Component\Utility\Settings; use Drupal\Core\PhpStorage\PhpStorageFactory; -use Drupal\Core\Config\BootstrapConfigStorageFactory; use Drupal\Core\Config\NullStorage; -use Drupal\Core\CoreServiceProvider; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ServiceProviderInterface; use Drupal\Core\DependencyInjection\YamlFileLoader; @@ -649,13 +648,17 @@ protected function storage() { */ protected function getConfigStorage() { if (!isset($this->configStorage)) { + $this->configStorage = new NullStorage(); // The active configuration storage may not exist yet; e.g., in the early // installer. Catch the exception thrown by config_get_config_directory(). try { - $this->configStorage = BootstrapConfigStorageFactory::get(); + $bootstrap_config_storage = Settings::get('bootstrap_config_storage'); + if (is_callable($bootstrap_config_storage)) { + $this->configStorage = call_user_func($bootstrap_config_storage); + } } catch (\Exception $e) { - $this->configStorage = new NullStorage(); + // Use the NullStorage. } } return $this->configStorage; diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 3eac574..d9003ed 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -601,6 +601,19 @@ # $cookie_domain = '.example.com'; /** + * Active configuration settings. + * + * By default, the active configuration is stored in the database in the + * {config} table. To install Drupal with a different active configuration + * storage, you need to override the setting here, in addition to overriding + * the config.storage.active service definition in a module or profile. + * + * The 'bootstrap_config_storage' setting needs to be a callable that returns + * core.services.yml. + */ + $settings['bootstrap_config_storage'] = array('Drupal\Core\Config\BootstrapConfigStorageFactory', 'getDatabaseStorage'); + +/** * Configuration overrides. * * To globally override specific configuration values for this site,