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;
}
/**
- * 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__))));
}
* 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
* 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
* '<port>.<domain>.<path>' => '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:
// 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')) {
// 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);
*/
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.