X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FDrupalKernel.php;h=a099327c99ad5654f854ffc6e996dc2bf4bd83a0;hb=refs%2Fheads%2Fd864;hp=fec1be9ad3a6163744a6cfde69965417b3121608;hpb=7b0cd87f0ae102b7185cb38e64b8e0ebf904ecb8;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/DrupalKernel.php b/web/core/lib/Drupal/Core/DrupalKernel.php index fec1be9ad..a099327c9 100644 --- a/web/core/lib/Drupal/Core/DrupalKernel.php +++ b/web/core/lib/Drupal/Core/DrupalKernel.php @@ -5,7 +5,6 @@ namespace Drupal\Core; use Composer\Autoload\ClassLoader; use Drupal\Component\Assertion\Handle; use Drupal\Component\FileCache\FileCacheFactory; -use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Cache\DatabaseBackend; use Drupal\Core\Config\BootstrapConfigStorageFactory; @@ -299,12 +298,16 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { } /** - * Determine the application root directory based on assumptions. + * Determine the application root directory based on this file's location. * * @return string * The application root. */ protected static function guessApplicationRoot() { + // Determine the application root by: + // - Removing the namespace directories from the path. + // - Getting the path to the directory two levels up from the path + // determined in the previous step. return dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)))); } @@ -318,6 +321,9 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { * for bootstrap level configuration, file configuration stores, public file * storage and site specific modules and themes. * + * A file named sites.php must be present in the sites directory for + * multisite. If it doesn't exist, then 'sites/default' will be used. + * * Finds a matching site directory file by stripping the website's hostname * from left to right and pathname from right to left. By default, the * directory must contain a 'settings.php' file for it to match. If the @@ -328,9 +334,8 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { * default.settings.php for examples on how the URL is converted to a * directory. * - * If a file named sites.php is present in the sites directory, it will be - * loaded prior to scanning for directories. That file can define aliases in - * an associative array named $sites. The array is written in the format + * The sites.php file in the sites directory can define aliases in an + * associative array named $sites. The array is written in the format * '..' => 'directory'. As an example, to create a * directory alias for https://www.drupal.org:8080/mysite/test whose * configuration file is in sites/example.com, the array should be defined as: @@ -981,23 +986,26 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { // sites/default/default.settings.php contains more runtime settings. // The .htaccess file contains settings that cannot be changed at runtime. - // Use session cookies, not transparent sessions that puts the session id in - // the query string. - ini_set('session.use_cookies', '1'); - ini_set('session.use_only_cookies', '1'); - ini_set('session.use_trans_sid', '0'); - // Don't send HTTP headers using PHP's session handler. - // Send an empty string to disable the cache limiter. - ini_set('session.cache_limiter', ''); - // Use httponly session cookies. - ini_set('session.cookie_httponly', '1'); + if (PHP_SAPI !== 'cli') { + // Use session cookies, not transparent sessions that puts the session id + // in the query string. + ini_set('session.use_cookies', '1'); + ini_set('session.use_only_cookies', '1'); + ini_set('session.use_trans_sid', '0'); + // Don't send HTTP headers using PHP's session handler. + // Send an empty string to disable the cache limiter. + ini_set('session.cache_limiter', ''); + // Use httponly session cookies. + ini_set('session.cookie_httponly', '1'); + } // Set sane locale settings, to ensure consistent string, dates, times and // numbers handling. setlocale(LC_ALL, 'C'); - // Detect string handling method. - Unicode::check(); + // Set appropriate configuration for multi-byte strings. + mb_internal_encoding('utf-8'); + mb_language('uni'); // Indicate that code is operating in a test child site. if (!defined('DRUPAL_TEST_IN_CHILD_SITE')) { @@ -1087,7 +1095,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { // misses. $old_loader = $this->classLoader; $this->classLoader = $loader; - // Our class loaders are preprended to ensure they come first like the + // Our class loaders are prepended to ensure they come first like the // class loader they are replacing. $old_loader->register(TRUE); $loader->register(TRUE); @@ -1600,13 +1608,14 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { */ protected function getInstallProfile() { $config = $this->getConfigStorage()->read('core.extension'); - if (!empty($config['profile'])) { + if (isset($config['profile'])) { $install_profile = $config['profile']; } // @todo https://www.drupal.org/node/2831065 remove the BC layer. else { // If system_update_8300() has not yet run fallback to using settings. - $install_profile = Settings::get('install_profile'); + $settings = Settings::getAll(); + $install_profile = isset($settings['install_profile']) ? $settings['install_profile'] : NULL; } // Normalize an empty string to a NULL value.