Commit 0506d2cb authored by alexpott's avatar alexpott

Issue #2370733 by chx: Fixed Contrib can not provide config storage.

parent 338c7914
...@@ -18,16 +18,22 @@ class BootstrapConfigStorageFactory { ...@@ -18,16 +18,22 @@ class BootstrapConfigStorageFactory {
/** /**
* Returns a configuration storage implementation. * Returns a configuration storage implementation.
* *
* @param $class_loader
* The class loader. Normally Composer's ClassLoader, as included by the
* front controller, but may also be decorated; e.g.,
* \Symfony\Component\ClassLoader\ApcClassLoader.
*
* @return \Drupal\Core\Config\StorageInterface * @return \Drupal\Core\Config\StorageInterface
* A configuration storage implementation. * A configuration storage implementation.
*/ */
public static function get() { public static function get($class_loader = NULL) {
$bootstrap_config_storage = Settings::get('bootstrap_config_storage'); $bootstrap_config_storage = Settings::get('bootstrap_config_storage');
$storage_backend = FALSE;
if (!empty($bootstrap_config_storage) && is_callable($bootstrap_config_storage)) { if (!empty($bootstrap_config_storage) && is_callable($bootstrap_config_storage)) {
return call_user_func($bootstrap_config_storage); $storage_backend = call_user_func($bootstrap_config_storage, $class_loader);
} }
// Fallback to the DatabaseStorage. // Fallback to the DatabaseStorage.
return self::getDatabaseStorage(); return $storage_backend ?: self::getDatabaseStorage();
} }
/** /**
......
...@@ -1171,7 +1171,7 @@ protected function getConfigStorage() { ...@@ -1171,7 +1171,7 @@ protected function getConfigStorage() {
// The active configuration storage may not exist yet; e.g., in the early // The active configuration storage may not exist yet; e.g., in the early
// installer. Catch the exception thrown by config_get_config_directory(). // installer. Catch the exception thrown by config_get_config_directory().
try { try {
$this->configStorage = BootstrapConfigStorageFactory::get(); $this->configStorage = BootstrapConfigStorageFactory::get($this->classLoader);
} }
catch (\Exception $e) { catch (\Exception $e) {
$this->configStorage = new NullStorage(); $this->configStorage = new NullStorage();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment