Commit ba2268f0 authored by alexpott's avatar alexpott

Issue #2547447 by Wim Leers, dawehner: Stop creating services.yml by default

parent c7ca868d
......@@ -158,30 +158,26 @@ INSTALLATION
b. Missing settings file.
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.
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.
For example, on a Unix/Linux command line, you can make a copy of the
default.settings.php and default.services.yml files with the commands:
default.settings.php file with the command:
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.
......@@ -191,7 +187,6 @@ 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:
session.storage.options: {}
twig.config: {}
session.storage.options:
gc_probability: 1
gc_divisor: 100
gc_maxlifetime: 200000
cookie_lifetime: 2000000
twig.config:
debug: false
auto_reload: null
cache: true
renderer.config:
required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions']
auto_placeholder_conditions:
......
......@@ -2092,13 +2092,6 @@ function install_check_requirements($install_state) {
'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;
......
......@@ -538,9 +538,7 @@ public function discoverServiceProviders() {
}
}
}
if (!$this->addServiceFiles(Settings::get('container_yamls'))) {
throw new \Exception('The container_yamls setting is missing from settings.php');
}
$this->addServiceFiles(Settings::get('container_yamls', []));
}
/**
......@@ -1445,17 +1443,10 @@ protected static function setupTrustedHosts(Request $request, $host_patterns) {
/**
* Add service files.
*
* @param $service_yamls
* @param string[] $service_yamls
* A list of service files.
*
* @return bool
* TRUE if the list was an array, FALSE otherwise.
*/
protected function addServiceFiles($service_yamls) {
if (is_array($service_yamls)) {
protected function addServiceFiles(array $service_yamls) {
$this->serviceYamls['site'] = array_filter($service_yamls, 'file_exists');
return TRUE;
}
return FALSE;
}
}
......@@ -38,11 +38,4 @@ public function resetConfigStorage() {
$this->configStorage = NULL;
}
/**
* {@inheritdoc}
*/
protected function addServiceFiles($service_yamls) {
// In the beginning there is no settings.php and no service YAMLs.
return parent::addServiceFiles($service_yamls ?: []);
}
}
......@@ -842,7 +842,6 @@ public function installDrupal() {
// 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()
......
......@@ -711,7 +711,6 @@ protected function prepareSettings() {
// 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()
......@@ -753,10 +752,12 @@ protected function prepareSettings() {
file_put_contents($directory . '/settings.php', "\n\$test_class = '" . get_class($this) ."';\n" . 'include DRUPAL_ROOT . \'/\' . $site_path . \'/settings.testing.php\';' ."\n", FILE_APPEND);
}
$settings_services_file = DRUPAL_ROOT . '/' . $this->originalSite . '/testing.services.yml';
if (file_exists($settings_services_file)) {
if (!file_exists($settings_services_file)) {
// Otherwise, use the default services as a starting point for overrides.
$settings_services_file = DRUPAL_ROOT . '/sites/default/default.services.yml';
}
// Copy the testing-specific service overrides in place.
copy($settings_services_file, $directory . '/services.yml');
}
if ($this->strictConfigSchema) {
// Add a listener to validate configuration schema on save.
$yaml = new \Symfony\Component\Yaml\Yaml();
......
......@@ -46,14 +46,20 @@ public function testDiscoverServiceCustom() {
/**
* Tests the exception when container_yamls is not set.
*
* @covers ::discoverServiceProviders
* @expectedException \Exception
*/
public function testDiscoverServiceNoContainerYamls() {
new Settings([]);
$kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
$kernel->discoverServiceProviders();
$expect = [
'app' => [
'core' => 'core/core.services.yml',
],
'site' => [
],
];
$this->assertAttributeSame($expect, 'serviceYamls', $kernel);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment