Commit 4fb0f9d8 authored by webchick's avatar webchick
Browse files

Issue #2251113 by alexpott, damiankloip, Crell, Wim Leers, dawehner, sun: Use...

Issue #2251113 by alexpott, damiankloip, Crell, Wim Leers, dawehner, sun: Use container parameters instead of settings.
parent de5fe262
......@@ -147,26 +147,30 @@ INSTALLATION
b. Missing settings file.
Drupal will try to automatically create a settings.php configuration file,
which is normally in the directory sites/default (to avoid problems when
upgrading, Drupal is not packaged with this file). If auto-creation fails,
you will need to create this file yourself, using the file
sites/default/default.settings.php as a template.
Drupal will try to automatically create settings.php and services.yml
files, which are normally in the directory sites/default (to avoid
problems when upgrading, Drupal is not packaged with this file). If
auto-creation of either file fails, you will need to create the file
yourself. Use the template sites/default/default.settings.php or
sites/default/default.services.yml respectively.
For example, on a Unix/Linux command line, you can make a copy of the
default.settings.php file with the command:
default.settings.php and default.services.yml files with the commands:
cp sites/default/default.settings.php sites/default/settings.php
cp sites/default/default.services.yml sites/default/services.yml
Next, grant write privileges to the file to everyone (including the web
server) with the command:
chmod a+w sites/default/settings.php
chmod a+w sites/default/services.yml
Be sure to set the permissions back after the installation is finished!
Sample command:
chmod go-w sites/default/settings.php
chmod go-w sites/default/services.yml
c. Write permissions after install.
......@@ -176,6 +180,7 @@ INSTALLATION
from a Unix/Linux command line:
chmod go-w sites/default/settings.php
chmod go-w sites/default/services.yml
chmod go-w sites/default
4. Verify that the site is working.
......
parameters:
twig.config: {}
factory.keyvalue:
default: keyvalue.database
factory.keyvalue.expirable:
default: keyvalue.expirable.database
services:
cache_factory:
class: Drupal\Core\Cache\CacheFactory
......@@ -156,13 +162,13 @@ services:
arguments: ['@request_stack', '@url_generator']
keyvalue:
class: Drupal\Core\KeyValueStore\KeyValueFactory
arguments: ['@service_container', '@settings']
arguments: ['@service_container', '%factory.keyvalue%']
keyvalue.database:
class: Drupal\Core\KeyValueStore\KeyValueDatabaseFactory
arguments: ['@serialization.phpserialize', '@database']
keyvalue.expirable:
class: Drupal\Core\KeyValueStore\KeyValueExpirableFactory
arguments: ['@service_container', '@settings']
arguments: ['@service_container', '%factory.keyvalue.expirable%']
keyvalue.expirable.database:
class: Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory
arguments: ['@serialization.phpserialize', '@database']
......@@ -922,6 +928,28 @@ services:
arguments: ['@module_handler']
info_parser:
class: Drupal\Core\Extension\InfoParser
twig:
class: Drupal\Core\Template\TwigEnvironment
arguments: ['@twig.loader', '@module_handler', '@theme_handler', '%twig.config%']
tags:
- { name: service_collector, tag: 'twig.extension', call: addExtension }
twig.extension:
class: Drupal\Core\Template\TwigExtension
tags:
- { name: twig.extension, priority: 100 }
calls:
- [setGenerators, ['@url_generator']]
# @todo Figure out what to do about debugging functions.
# @see http://drupal.org/node/1804998
twig.extension.debug:
class: Twig_Extension_Debug
tags:
- { name: twig.extension }
twig.loader:
alias: twig.loader.filesystem
twig.loader.filesystem:
class: Twig_Loader_Filesystem
arguments: ['%app.root%']
element_info:
alias: plugin.manager.element_info
file.mime_type.guesser:
......
......@@ -1886,67 +1886,88 @@ function install_check_requirements($install_state) {
// Check the profile requirements.
$requirements = drupal_check_profile($profile, $install_state);
// If Drupal is not set up already, we need to create a settings file.
if (!$install_state['settings_verified']) {
if ($install_state['settings_verified']) {
return $requirements;
}
// If Drupal is not set up already, we need to try to create the default
// settings and services files.
$default_files = array();
$default_files['settings.php'] = array(
'file' => 'settings.php',
'file_default' => 'default.settings.php',
'title_default' => t('Default settings file'),
'description_default' => t('The default settings file does not exist.'),
'title' => t('Settings file'),
);
$default_files['services.yml'] = array(
'file' => 'services.yml',
'file_default' => 'default.services.yml',
'title_default' => t('Default services file'),
'description_default' => t('The default services file does not exist.'),
'title' => t('Services file'),
);
foreach ($default_files as $default_file_info) {
$readable = FALSE;
$writable = FALSE;
$conf_path = './' . conf_path(FALSE);
$settings_file = $conf_path . '/settings.php';
$default_settings_file = './sites/default/default.settings.php';
$file = $conf_path;
$file = $conf_path . "/{$default_file_info['file']}";
$default_file = "./sites/default/{$default_file_info['file_default']}";
$exists = FALSE;
// Verify that the directory exists.
if (drupal_verify_install_file($conf_path, FILE_EXIST, 'dir')) {
// Check if a settings.php file already exists.
$file = $settings_file;
if (drupal_verify_install_file($settings_file, FILE_EXIST)) {
if (drupal_verify_install_file($file, FILE_EXIST)) {
// If it does, make sure it is writable.
$readable = drupal_verify_install_file($settings_file, FILE_READABLE);
$writable = drupal_verify_install_file($settings_file, FILE_WRITABLE);
$readable = drupal_verify_install_file($file, FILE_READABLE);
$writable = drupal_verify_install_file($file, FILE_WRITABLE);
$exists = TRUE;
}
}
// If default.settings.php does not exist, or is not readable, throw an
// error.
if (!drupal_verify_install_file($default_settings_file, FILE_EXIST|FILE_READABLE)) {
$requirements['default settings file exists'] = array(
'title' => t('Default settings file'),
'value' => t('The default settings file does not exist.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The @drupal installer requires that the %default-file file not be modified in any way from the original download.', array('@drupal' => drupal_install_profile_distribution_name(), '%default-file' => $default_settings_file)),
// If the default $default_file does not exist, or is not readable,
// report an error.
if (!drupal_verify_install_file($default_file, FILE_EXIST | FILE_READABLE)) {
$requirements["default $file file exists"] = array(
'title' => $default_file_info['title_default'],
'value' => $default_file_info['description_default'],
'severity' => REQUIREMENT_ERROR,
'description' => t('The @drupal installer requires that the %default-file file not be modified in any way from the original download.', array(
'@drupal' => drupal_install_profile_distribution_name(),
'%default-file' => $default_file
)),
);
}
// Otherwise, if settings.php does not exist yet, we can try to copy
// default.settings.php to create it.
// Otherwise, if $file does not exist yet, we can try to copy
// $default_file to create it.
elseif (!$exists) {
$copied = drupal_verify_install_file($conf_path, FILE_EXIST|FILE_WRITABLE, 'dir') && @copy($default_settings_file, $settings_file);
$copied = drupal_verify_install_file($conf_path, FILE_EXIST | FILE_WRITABLE, 'dir') && @copy($default_file, $file);
if ($copied) {
// If the new settings file has the same owner as default.settings.php,
// this means default.settings.php is owned by the webserver user.
// This is an inherent security weakness because it allows a malicious
// webserver process to append arbitrary PHP code and then execute it.
// However, it is also a common configuration on shared hosting, and
// there is nothing Drupal can do to prevent it. In this situation,
// having settings.php also owned by the webserver does not introduce
// any additional security risk, so we keep the file in place.
if (fileowner($default_settings_file) === fileowner($settings_file)) {
$readable = drupal_verify_install_file($settings_file, FILE_READABLE);
$writable = drupal_verify_install_file($settings_file, FILE_WRITABLE);
// If the new $file file has the same owner as $default_file this means
// $default_file is owned by the webserver user. This is an inherent
// security weakness because it allows a malicious webserver process to
// append arbitrary PHP code and then execute it. However, it is also a
// common configuration on shared hosting, and there is nothing Drupal
// can do to prevent it. In this situation, having $file also owned by
// the webserver does not introduce any additional security risk, so we
// keep the file in place.
if (fileowner($default_file) === fileowner($file)) {
$readable = drupal_verify_install_file($file, FILE_READABLE);
$writable = drupal_verify_install_file($file, FILE_WRITABLE);
$exists = TRUE;
}
// If settings.php and default.settings.php have different owners, this
// probably means the server is set up "securely" (with the webserver
// running as its own user, distinct from the user who owns all the
// Drupal PHP files), although with either a group or world writable
// sites directory. Keeping settings.php owned by the webserver would
// therefore introduce a security risk. It would also cause a usability
// problem, since site owners who do not have root access to the file
// system would be unable to edit their settings file later on. We
// therefore must delete the file we just created and force the
// administrator to log on to the server and create it manually.
// If $file and $default_file have different owners, this probably means
// the server is set up "securely" (with the webserver running as its
// own user, distinct from the user who owns all the Drupal PHP files),
// although with either a group or world writable sites directory.
// Keeping $file owned by the webserver would therefore introduce a
// security risk. It would also cause a usability problem, since site
// owners who do not have root access to the file system would be unable
// to edit their settings file later on. We therefore must delete the
// file we just created and force the administrator to log on to the
// server and create it manually.
else {
$deleted = @drupal_unlink($settings_file);
$deleted = @drupal_unlink($file);
// We expect deleting the file to be successful (since we just
// created it ourselves above), but if it fails somehow, we set a
// variable so we can display a one-time error message to the
......@@ -1956,57 +1977,76 @@ function install_check_requirements($install_state) {
$exists = !$deleted;
if ($exists) {
$settings_file_ownership_error = TRUE;
$readable = drupal_verify_install_file($settings_file, FILE_READABLE);
$writable = drupal_verify_install_file($settings_file, FILE_WRITABLE);
$readable = drupal_verify_install_file($file, FILE_READABLE);
$writable = drupal_verify_install_file($file, FILE_WRITABLE);
}
}
}
}
// If settings.php does not exist, throw an error.
// If the $file does not exist, throw an error.
if (!$exists) {
$requirements['settings file exists'] = array(
'title' => t('Settings file'),
'value' => t('The settings file does not exist.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The @drupal installer requires that you create a settings file as part of the installation process. Copy the %default_file file to %file. More details about installing Drupal are available in <a href="@install_txt">INSTALL.txt</a>.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '%default_file' => $default_settings_file, '@install_txt' => base_path() . 'core/INSTALL.txt')),
$requirements["$file file exists"] = array(
'title' => $default_file_info['title'],
'value' => t('The %file does not exist.', array('%file' => $default_file_info['title'])),
'severity' => REQUIREMENT_ERROR,
'description' => t('The @drupal installer requires that you create a %file as part of the installation process. Copy the %default_file file to %file. More details about installing Drupal are available in <a href="@install_txt">INSTALL.txt</a>.', array(
'@drupal' => drupal_install_profile_distribution_name(),
'%file' => $file,
'%default_file' => $default_file,
'@install_txt' => base_path() . 'core/INSTALL.txt'
)),
);
}
else {
$requirements['settings file exists'] = array(
'title' => t('Settings file'),
'value' => t('The %file file exists.', array('%file' => $file)),
$requirements["$file file exists"] = array(
'title' => $default_file_info['title'],
'value' => t('The %file exists.', array('%file' => $file)),
);
// If settings.php is not readable, throw an error.
// If the $file is not readable, throw an error.
if (!$readable) {
$requirements['settings file readable'] = array(
'title' => t('Settings file'),
'value' => t('The settings file is not readable.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('@drupal requires read permissions to %file at all times. If you are unsure how to grant file permissions, consult the <a href="@handbook_url">online handbook</a>.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')),
$requirements["$file file readable"] = array(
'title' => $default_file_info['title'],
'value' => t('The %file is not readable.', array('%file' => $default_file_info['title'])),
'severity' => REQUIREMENT_ERROR,
'description' => t('@drupal requires read permissions to %file at all times. If you are unsure how to grant file permissions, consult the <a href="@handbook_url">online handbook</a>.', array(
'@drupal' => drupal_install_profile_distribution_name(),
'%file' => $file,
'@handbook_url' => 'http://drupal.org/server-permissions'
)),
);
}
// If settings.php is not writable, throw an error.
// If the $file is not writable, throw an error.
if (!$writable) {
$requirements['settings file writable'] = array(
'title' => t('Settings file'),
'value' => t('The settings file is not writable.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The @drupal installer requires write permissions to %file during the installation process. If you are unsure how to grant file permissions, consult the <a href="@handbook_url">online handbook</a>.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')),
$requirements["$file file writeable"] = array(
'title' => $default_file_info['title'],
'value' => t('The %file is not writable.', array('%file' => $default_file_info['title'])),
'severity' => REQUIREMENT_ERROR,
'description' => t('The @drupal installer requires write permissions to %file during the installation process. If you are unsure how to grant file permissions, consult the <a href="@handbook_url">online handbook</a>.', array(
'@drupal' => drupal_install_profile_distribution_name(),
'%file' => $file,
'@handbook_url' => 'http://drupal.org/server-permissions'
)),
);
}
else {
$requirements['settings file'] = array(
'title' => t('Settings file'),
'value' => t('The settings file is writable.'),
$requirements["$file file"] = array(
'title' => $default_file_info['title'],
'value' => t('The @file is writable.', array('@file' => $default_file_info['title'])),
);
}
if (!empty($settings_file_ownership_error)) {
$requirements['settings file ownership'] = array(
'title' => t('Settings file'),
'value' => t('The settings file is owned by the web server.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The @drupal installer failed to create a settings file with proper file ownership. Log on to your web server, remove the existing %file file, and create a new one by copying the %default_file file to %file. More details about installing Drupal are available in <a href="@install_txt">INSTALL.txt</a>. If you have problems with the file permissions on your server, consult the <a href="@handbook_url">online handbook</a>.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '%default_file' => $default_settings_file, '@install_txt' => base_path() . 'core/INSTALL.txt', '@handbook_url' => 'http://drupal.org/server-permissions')),
$requirements["$file file ownership"] = array(
'title' => $default_file_info['title'],
'value' => t('The @file is owned by the web server.', array('@file' => $default_file_info['title'])),
'severity' => REQUIREMENT_ERROR,
'description' => t('The @drupal installer failed to create a %file file with proper file ownership. Log on to your web server, remove the existing %file file, and create a new one by copying the %default_file file to %file. More details about installing Drupal are available in <a href="@install_txt">INSTALL.txt</a>. If you have problems with the file permissions on your server, consult the <a href="@handbook_url">online handbook</a>.', array(
'@drupal' => drupal_install_profile_distribution_name(),
'%file' => $file,
'%default_file' => $default_file,
'@install_txt' => base_path() . 'core/INSTALL.txt',
'@handbook_url' => 'http://drupal.org/server-permissions'
)),
);
}
}
......
......@@ -18,10 +18,6 @@
use Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass;
use Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass;
use Drupal\Core\Plugin\PluginManagerPass;
use Drupal\Core\Site\Settings;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
/**
......@@ -42,7 +38,8 @@ class CoreServiceProvider implements ServiceProviderInterface {
* {@inheritdoc}
*/
public function register(ContainerBuilder $container) {
$this->registerTwig($container);
$container->setParameter('app.root', DRUPAL_ROOT);
$this->registerUuid($container);
$this->registerTest($container);
......@@ -72,44 +69,6 @@ public function register(ContainerBuilder $container) {
$container->addCompilerPass(new PluginManagerPass());
}
/**
* Registers Twig services.
*
* This method is public and static so that it can be reused in the installer.
*/
public static function registerTwig(ContainerBuilder $container) {
$container->register('twig.loader.filesystem', 'Twig_Loader_Filesystem')
->addArgument(DRUPAL_ROOT);
$container->setAlias('twig.loader', 'twig.loader.filesystem');
$twig_extension = new Definition('Drupal\Core\Template\TwigExtension');
$twig_extension->addMethodCall('setGenerators', array(new Reference('url_generator')));
$container->register('twig', 'Drupal\Core\Template\TwigEnvironment')
->addArgument(new Reference('twig.loader'))
->addArgument(array(
// This is saved / loaded via drupal_php_storage().
// All files can be refreshed by clearing caches.
// @todo ensure garbage collection of expired files.
// When in the installer, twig_cache must be FALSE until we know the
// files folder is writable.
'cache' => drupal_installation_attempted() ? FALSE : Settings::get('twig_cache', TRUE),
'autoescape' => TRUE,
'debug' => Settings::get('twig_debug', FALSE),
'auto_reload' => Settings::get('twig_auto_reload', NULL),
))
->addArgument(new Reference('module_handler'))
->addArgument(new Reference('theme_handler'))
->addMethodCall('addExtension', array($twig_extension))
// @todo Figure out what to do about debugging functions.
// @see http://drupal.org/node/1804998
->addMethodCall('addExtension', array(new Definition('Twig_Extension_Debug')))
->addTag('service_collector', array(
'tag' => 'twig.extension',
'call' => 'addExtension',
));
}
/**
* Determines and registers the UUID service.
*
......
......@@ -52,6 +52,14 @@ public function __construct(ContainerBuilder $container)
$this->container = $container;
}
/**
* Resets the internal cache. This method is mostly useful for tests.
*/
public static function reset()
{
static::$yaml = array();
}
/**
* Loads a Yaml file.
*
......
......@@ -529,7 +529,8 @@ public function discoverServiceProviders() {
if ($container_yamls = Settings::get('container_yamls')) {
$this->serviceYamls['site'] = $container_yamls;
}
if (file_exists($site_services_yml = $this->getSitePath() . '/services.yml')) {
$site_services_yml = $this->getSitePath() . '/services.yml';
if (file_exists($site_services_yml) && is_readable($site_services_yml)) {
$this->serviceYamls['site'][] = $site_services_yml;
}
}
......
......@@ -60,6 +60,11 @@ public function register(ContainerBuilder $container) {
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
// Disable Twig cache (php storage does not exist yet).
$twig_config = $container->getParameter('twig.config');
$twig_config['cache'] = FALSE;
$container->setParameter('twig.config', $twig_config);
// Disable configuration overrides.
// ConfigFactory would to try to load language overrides and InstallStorage
// throws an exception upon trying to load a non-existing file.
......
......@@ -7,7 +7,6 @@
namespace Drupal\Core\KeyValueStore;
use Drupal\Core\Site\Settings;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -29,7 +28,7 @@ class KeyValueFactory implements KeyValueFactoryInterface {
* This is a setting name that will be used if the specific setting does not
* exist. The setting value will be the id of a service.
*/
const DEFAULT_SETTING = 'keyvalue_default';
const DEFAULT_SETTING = 'default';
/**
* The default service id.
......@@ -50,22 +49,15 @@ class KeyValueFactory implements KeyValueFactoryInterface {
*/
protected $container;
/**
* The read-only settings container.
*
* @var \Drupal\Core\Site\Settings
*/
protected $settings;
/**
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* The service container.
* @param \Drupal\Core\Site\Settings $settings
* The read-only settings container.
* @param array $options
* (optional) Collection-specific storage override options.
*/
function __construct(ContainerInterface $container, Settings $settings) {
function __construct(ContainerInterface $container, array $options = array()) {
$this->container = $container;
$this->settings = $settings;
$this->options = $options;
}
/**
......@@ -73,14 +65,16 @@ function __construct(ContainerInterface $container, Settings $settings) {
*/
public function get($collection) {
if (!isset($this->stores[$collection])) {
if ($service_name = $this->settings->get(static::SPECIFIC_PREFIX . $collection)) {
if (isset($this->options[$collection])) {
$service_id = $this->options[$collection];
}
elseif ($service_name = $this->settings->get(static::DEFAULT_SETTING)) {
elseif (isset($this->options[static::DEFAULT_SETTING])) {
$service_id = $this->options[static::DEFAULT_SETTING];
}
else {
$service_name = static::DEFAULT_SERVICE;
$service_id = static::DEFAULT_SERVICE;
}
$this->stores[$collection] = $this->container->get($service_name)->get($collection);
$this->stores[$collection] = $this->container->get($service_id)->get($collection);
}
return $this->stores[$collection];
}
......
......@@ -41,7 +41,7 @@ class TwigEnvironment extends \Twig_Environment {
* Constructs a TwigEnvironment object and stores cache and storage
* internally.
*/
public function __construct(\Twig_LoaderInterface $loader = NULL, $options = array(), ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler) {
public function __construct(\Twig_LoaderInterface $loader = NULL, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, $options = array()) {
// @todo Pass as arguments from the DIC.
$this->cache_object = \Drupal::cache();
......@@ -68,6 +68,16 @@ public function __construct(\Twig_LoaderInterface $loader = NULL, $options = arr
$this->templateClasses = array();
$this->stringLoader = new \Twig_Loader_String();
$options += array(
// @todo Ensure garbage collection of expired files.
'cache' => TRUE,
// @todo Remove this.
// @see http://drupal.org/node/1712444
'autoescape' => FALSE,
'debug' => FALSE,
'auto_reload' => NULL,
);
parent::__construct($loader, $options);
}
......
......@@ -15,6 +15,7 @@
use Drupal\Core\Language\Language;
use Drupal\Core\Site\Settings;
use Drupal\Core\Entity\Schema\EntitySchemaProviderInterface;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpFoundation\Request;
......@@ -260,7 +261,9 @@ public function containerBuild(ContainerBuilder $container) {
->addArgument(Database::getConnection())
->addArgument('config');
$this->settingsSet('keyvalue_default', 'keyvalue.memory');
$keyvalue_options = $container->getParameter('factory.keyvalue') ?: array();
$keyvalue_options['default'] = 'keyvalue.memory';
$container->setParameter('factory.keyvalue', $keyvalue_options);
$container->set('keyvalue.memory', $this->keyValueFactory);
if (!$container->has('keyvalue')) {
// TestBase::setUp puts a completely empty container in
......@@ -280,7 +283,7 @@ public function containerBuild(ContainerBuilder $container) {
$container
->register('keyvalue', 'Drupal\Core\KeyValueStore\KeyValueFactory')
->addArgument(new Reference('service_container'))
->addArgument(new Reference('settings'));
->addArgument(new Parameter('factory.keyvalue'));
$container->register('state', 'Drupal\Core\State\State')
->addArgument(new Reference('keyvalue'));
......
......@@ -8,9 +8,11 @@
namespace Drupal\simpletest;
use Drupal\Component\Serialization\Json;
use Drupal\Component\Serialization\Yaml;
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\String;
use Drupal\Core\DependencyInjection\YamlFileLoader;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\ConnectionNotDefinedException;
......@@ -812,6 +814,7 @@ protected function setUp() {
// Not using File API; a potential error must trigger a PHP warning.
$directory = DRUPAL_ROOT . '/' . $this->siteDirectory;
copy(DRUPAL_ROOT . '/sites/default/default.settings.php', $directory . '/settings.php');
copy(DRUPAL_ROOT . '/sites/default/default.services.yml', $directory . '/services.yml');
// All file system paths are created by System module during installation.
// @see system_requirements()
......@@ -1018,6 +1021,26 @@ protected function writeSettings(array $settings) {
drupal_rewrite_settings($settings, $filename);
}
/**
* Changes parameters in the services.yml file.
*
* @param $name
* The name of the parameter.
* @param $value
* The value of the parameter.
*/
protected function setContainerParameter($name, $value) {
$filename = $this->siteDirectory . '/services.yml';
chmod($filename, 0666);
$services = Yaml::decode(file_get_contents($filename));
$services['parameters'][$name] = $value;