function Settings::initialize

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::initialize()
  2. 10 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::initialize()
  3. 9 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::initialize()
  4. 8.9.x core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::initialize()

Bootstraps settings.php and the Settings singleton.

Parameters

string $app_root: The app root.

string $site_path: The current site path.

\Composer\Autoload\ClassLoader|null $class_loader: The class loader that is used for this request. Passed by reference and exposed to the local scope of settings.php, so as to allow it to be decorated.

See also

default.settings.php

18 calls to Settings::initialize()
BootableCommandTrait::boot in core/lib/Drupal/Core/Command/BootableCommandTrait.php
Boots up a Drupal environment.
CacheRebuildCommand::__invoke in core/lib/Drupal/Core/Command/CacheRebuildCommand.php
Rebuild all caches.
db-tools.php in core/scripts/db-tools.php
A command line application to import a database generation script.
DrupalApplication::bootstrap in core/lib/Drupal/Core/Command/DrupalApplication.php
Bootstraps Drupal in a way that is appropriate for console commands.
DrupalKernel::initializeSettings in core/lib/Drupal/Core/DrupalKernel.php
Locate site path and initialize settings singleton.

... See full list

File

core/lib/Drupal/Core/Site/Settings.php, line 134

Class

Settings
Read only settings that are initialized with the class.

Namespace

Drupal\Core\Site

Code

public static function initialize($app_root, $site_path, &$class_loader) {
  // Export these settings.php variables to the global namespace.
  global $config;
  $settings = [];
  $config = [];
  $databases = [];
  if (is_readable($app_root . '/' . $site_path . '/settings.php')) {
    require $app_root . '/' . $site_path . '/settings.php';
  }
  self::handleDeprecations($settings);
  // Initialize databases.
  Database::setMultipleConnectionInfo($databases, $class_loader, $app_root);
  // Initialize Settings.
  new Settings($settings);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.