Skip to content
Snippets Groups Projects
Select Git revision
  • c9b722d0c3f1268d49bcd12641dc64637bfba736
  • 11.x default protected
  • 11.2.x protected
  • 10.5.x protected
  • 10.6.x protected
  • 11.1.x protected
  • 10.4.x protected
  • 11.0.x protected
  • 10.3.x protected
  • 7.x protected
  • 10.2.x protected
  • 10.1.x protected
  • 9.5.x protected
  • 10.0.x protected
  • 9.4.x protected
  • 9.3.x protected
  • 9.2.x protected
  • 9.1.x protected
  • 8.9.x protected
  • 9.0.x protected
  • 8.8.x protected
  • 10.5.1 protected
  • 11.2.2 protected
  • 11.2.1 protected
  • 11.2.0 protected
  • 10.5.0 protected
  • 11.2.0-rc2 protected
  • 10.5.0-rc1 protected
  • 11.2.0-rc1 protected
  • 10.4.8 protected
  • 11.1.8 protected
  • 10.5.0-beta1 protected
  • 11.2.0-beta1 protected
  • 11.2.0-alpha1 protected
  • 10.4.7 protected
  • 11.1.7 protected
  • 10.4.6 protected
  • 11.1.6 protected
  • 10.3.14 protected
  • 10.4.5 protected
  • 11.0.13 protected
41 results

NormalizerTestBase.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    BootstrapConfigStorageFactory.php 1.78 KiB
    <?php
    
    namespace Drupal\Core\Config;
    
    use Drupal\Core\Database\Database;
    use Drupal\Core\Site\Settings;
    
    /**
     * Defines a factory for retrieving the config storage used pre-kernel.
     */
    class BootstrapConfigStorageFactory {
    
      /**
       * 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
       *   A configuration storage implementation.
       */
      public static function get($class_loader = NULL) {
        $bootstrap_config_storage = Settings::get('bootstrap_config_storage');
        $storage_backend = FALSE;
        if (!empty($bootstrap_config_storage) && is_callable($bootstrap_config_storage)) {
          $storage_backend = call_user_func($bootstrap_config_storage, $class_loader);
        }
        // Fallback to the DatabaseStorage.
        return $storage_backend ?: self::getDatabaseStorage();
      }
    
      /**
       * Returns a Database configuration storage implementation.
       *
       * @return \Drupal\Core\Config\DatabaseStorage
       */
      public static function getDatabaseStorage() {
        return new DatabaseStorage(Database::getConnection(), 'config');
      }
    
      /**
       * Returns a File-based configuration storage implementation.
       *
       * If there is no active configuration directory calling this method will
       * result in an error.
       *
       * @return \Drupal\Core\Config\FileStorage
       *
       * @deprecated in Drupal 8.0.x and will be removed before 9.0.0. Drupal core
       * no longer creates an active directory.
       *
       * @throws \Exception
       */
      public static function getFileStorage() {
        return new FileStorage(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY));
      }
    
    }