Skip to content
Snippets Groups Projects

Issue #3274858: CoreUpdateTest should test that default.settings.php and default.services.yml can be updated

Merged Issue #3274858: CoreUpdateTest should test that default.settings.php and default.services.yml can be updated
@@ -36,43 +36,29 @@ class SiteConfigurationExcluder implements EventSubscriberInterface {
}
/**
* Excludes common paths from staging operations.
* Excludes site configuration files from staging operations.
*
* @param \Drupal\package_manager\Event\PreApplyEvent|\Drupal\package_manager\Event\PreCreateEvent $event
* The event object.
*
* @see \Drupal\package_manager\Event\ExcludedPathsTrait::excludePath()
*/
public function ignoreCommonPaths(StageEvent $event): void {
public function excludeSiteConfiguration(StageEvent $event): void {
// Site configuration files are always excluded relative to the web root.
$web = [];
$paths = [];
// Ignore site-specific settings files, which are always in the web root.
// By default, Drupal core will always try to write-protect these files.
$settings_files = [
'settings.php',
'settings.local.php',
'services.yml',
];
foreach ($settings_files as $settings_file) {
$web[] = $this->sitePath . '/' . $settings_file;
$web[] = 'sites/default/' . $settings_file;
$paths[] = $this->sitePath . '/' . $settings_file;
$paths[] = 'sites/default/' . $settings_file;
}
$this->excludeInWebRoot($event, $web);
}
/**
* Reacts before staged changes are committed the active directory.
*
* @param \Drupal\package_manager\Event\PreApplyEvent $event
* The event object.
*/
public function preApply(PreApplyEvent $event): void {
// Don't copy anything from the staging area's sites/default.
// @todo Make this a lot smarter in https://www.drupal.org/i/3228955.
$this->excludeInWebRoot($event, ['sites/default']);
$this->ignoreCommonPaths($event);
$this->excludeInWebRoot($event, $paths);
}
/**
@@ -80,8 +66,8 @@ class SiteConfigurationExcluder implements EventSubscriberInterface {
*/
public static function getSubscribedEvents() {
return [
PreCreateEvent::class => 'ignoreCommonPaths',
PreApplyEvent::class => 'preApply',
PreCreateEvent::class => 'excludeSiteConfiguration',
PreApplyEvent::class => 'excludeSiteConfiguration',
];
}
Loading