Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings files_exists check. #1765

Merged
merged 2 commits into from
Jul 6, 2017
Merged

Settings files_exists check. #1765

merged 2 commits into from
Jul 6, 2017

Conversation

dpagini
Copy link
Contributor

@dpagini dpagini commented Jul 6, 2017

Changes proposed:

  • Adds a check for docroot/sites/$multisite/default.settings.php exists before it tries to copy that file to docroot/sites/$multisite/settings.php

Reasoning...
In my multisite, I like to keep a single copy of Drupal's default.settings.php file. We keep it in docroot/sites/all/ and have it copied there via composer and drupal-scaffold (see below). I think this means we will be responsible for generating a new settings file if we set up a new multi-site, but I think that's a fair trade-off. This really just stops this function from throwing an error for me that the file does not exist.
Maybe in a perfect world, this could optionally read the drupal-scaffold setting, if it exists, from composer.json, and then use that value, but that felt a little too optimistic to me. Figured I'd see where this one goes first.

in composer.json

drupal-scaffold: {
  initial: {
    sites/default/default.services.yml: "sites/default/services.yml",
    sites/default/default.settings.php: "sites/default/settings.php"
  },
  excludes: [
    "web.config",
    "sites/development.services.yml"
  ]
}

$blt_local_settings_file => $default_local_settings_file,
$default_local_settings_file => $project_local_settings_file,
$blt_local_drush_file => $default_local_drush_file,
$default_local_drush_file => $project_local_drush_file,
];

// Only add the settings file if the default exists.
if (file_exists($project_default_settings_file)) {
$copy_map[] = [
Copy link
Contributor

@grasmash grasmash Jul 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want $copy_map[$project_default_settings_file] = $project_settings_file;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thanks!

@grasmash grasmash added the Enhancement A feature or feature request label Jul 6, 2017
@grasmash grasmash merged commit 809bfde into acquia:8.x Jul 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A feature or feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants