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 ...@@ -158,30 +158,26 @@ INSTALLATION
b. Missing settings file. b. Missing settings file.
Drupal will try to automatically create settings.php and services.yml Drupal will try to automatically create a settings.php configuration file,
files, which are normally in the directory sites/default (to avoid which is normally in the directory sites/default (to avoid problems when
problems when upgrading, Drupal is not packaged with this file). If upgrading, Drupal is not packaged with this file). If auto-creation fails,
auto-creation of either file fails, you will need to create the file you will need to create this file yourself, using the file
yourself. Use the template sites/default/default.settings.php or sites/default/default.settings.php as a template.
sites/default/default.services.yml respectively.
For example, on a Unix/Linux command line, you can make a copy of the 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.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 Next, grant write privileges to the file to everyone (including the web
server) with the command: server) with the command:
chmod a+w sites/default/settings.php 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! Be sure to set the permissions back after the installation is finished!
Sample command: Sample command:
chmod go-w sites/default/settings.php chmod go-w sites/default/settings.php
chmod go-w sites/default/services.yml
c. Write permissions after install. c. Write permissions after install.
...@@ -191,7 +187,6 @@ INSTALLATION ...@@ -191,7 +187,6 @@ INSTALLATION
from a Unix/Linux command line: from a Unix/Linux command line:
chmod go-w sites/default/settings.php chmod go-w sites/default/settings.php
chmod go-w sites/default/services.yml
chmod go-w sites/default chmod go-w sites/default
4. Verify that the site is working. 4. Verify that the site is working.
......
parameters: parameters:
session.storage.options: {} session.storage.options:
twig.config: {} gc_probability: 1
gc_divisor: 100
gc_maxlifetime: 200000
cookie_lifetime: 2000000
twig.config:
debug: false
auto_reload: null
cache: true
renderer.config: renderer.config:
required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions'] required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions']
auto_placeholder_conditions: auto_placeholder_conditions:
......
...@@ -2092,13 +2092,6 @@ function install_check_requirements($install_state) { ...@@ -2092,13 +2092,6 @@ function install_check_requirements($install_state) {
'description_default' => t('The default settings file does not exist.'), 'description_default' => t('The default settings file does not exist.'),
'title' => t('Settings file'), '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) { foreach ($default_files as $default_file_info) {
$readable = FALSE; $readable = FALSE;
......
...@@ -538,9 +538,7 @@ public function discoverServiceProviders() { ...@@ -538,9 +538,7 @@ public function discoverServiceProviders() {
} }
} }
} }
if (!$this->addServiceFiles(Settings::get('container_yamls'))) { $this->addServiceFiles(Settings::get('container_yamls', []));
throw new \Exception('The container_yamls setting is missing from settings.php');
}
} }
/** /**
...@@ -1445,17 +1443,10 @@ protected static function setupTrustedHosts(Request $request, $host_patterns) { ...@@ -1445,17 +1443,10 @@ protected static function setupTrustedHosts(Request $request, $host_patterns) {
/** /**
* Add service files. * Add service files.
* *
* @param $service_yamls * @param string[] $service_yamls
* A list of service files. * A list of service files.
*
* @return bool
* TRUE if the list was an array, FALSE otherwise.
*/ */
protected function addServiceFiles($service_yamls) { protected function addServiceFiles(array $service_yamls) {
if (is_array($service_yamls)) { $this->serviceYamls['site'] = array_filter($service_yamls, 'file_exists');
$this->serviceYamls['site'] = array_filter($service_yamls, 'file_exists');
return TRUE;
}
return FALSE;
} }
} }
...@@ -38,11 +38,4 @@ public function resetConfigStorage() { ...@@ -38,11 +38,4 @@ public function resetConfigStorage() {
$this->configStorage = NULL; $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() { ...@@ -842,7 +842,6 @@ public function installDrupal() {
// Not using File API; a potential error must trigger a PHP warning. // Not using File API; a potential error must trigger a PHP warning.
$directory = DRUPAL_ROOT . '/' . $this->siteDirectory; $directory = DRUPAL_ROOT . '/' . $this->siteDirectory;
copy(DRUPAL_ROOT . '/sites/default/default.settings.php', $directory . '/settings.php'); 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. // All file system paths are created by System module during installation.
// @see system_requirements() // @see system_requirements()
......
...@@ -711,7 +711,6 @@ protected function prepareSettings() { ...@@ -711,7 +711,6 @@ protected function prepareSettings() {
// Not using File API; a potential error must trigger a PHP warning. // Not using File API; a potential error must trigger a PHP warning.
$directory = DRUPAL_ROOT . '/' . $this->siteDirectory; $directory = DRUPAL_ROOT . '/' . $this->siteDirectory;
copy(DRUPAL_ROOT . '/sites/default/default.settings.php', $directory . '/settings.php'); 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. // All file system paths are created by System module during installation.
// @see system_requirements() // @see system_requirements()
...@@ -753,10 +752,12 @@ protected function prepareSettings() { ...@@ -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); 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'; $settings_services_file = DRUPAL_ROOT . '/' . $this->originalSite . '/testing.services.yml';
if (file_exists($settings_services_file)) { if (!file_exists($settings_services_file)) {
// Copy the testing-specific service overrides in place. // Otherwise, use the default services as a starting point for overrides.
copy($settings_services_file, $directory . '/services.yml'); $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) { if ($this->strictConfigSchema) {
// Add a listener to validate configuration schema on save. // Add a listener to validate configuration schema on save.
$yaml = new \Symfony\Component\Yaml\Yaml(); $yaml = new \Symfony\Component\Yaml\Yaml();
......
...@@ -46,14 +46,20 @@ public function testDiscoverServiceCustom() { ...@@ -46,14 +46,20 @@ public function testDiscoverServiceCustom() {
/** /**
* Tests the exception when container_yamls is not set. * Tests the exception when container_yamls is not set.
*
* @covers ::discoverServiceProviders
* @expectedException \Exception
*/ */
public function testDiscoverServiceNoContainerYamls() { public function testDiscoverServiceNoContainerYamls() {
new Settings([]); new Settings([]);
$kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader()); $kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
$kernel->discoverServiceProviders(); $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