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

Don't overwrite local config files #210

Merged
merged 3 commits into from
Aug 3, 2016
Merged

Conversation

gapple
Copy link
Contributor

@gapple gapple commented Jul 6, 2016

The copy task overwrite option defaults to false, and means that files will be overwritten if the timestamp of the source file is newer (https://www.phing.info/docs/guide/trunk/CopyTask.html). This results in local changes being destroyed if any changes are made upstream.

This pull request adds a conditional based on the existence of the project.local.yml file, so that the files are only copied the first time setup is run.

@grasmash
Copy link
Contributor

grasmash commented Jul 6, 2016

Should we also be checking for the existence of local.settings.php and local.drushrc.php before copying those files as well?

@gapple
Copy link
Contributor Author

gapple commented Jul 6, 2016

Each could be split into separate conditions, but I was making the assumption that a user would run setup:drupal:settings (or another task that depends on it), rather than individually copying the example files manually.

I think it's okay to assume that if a user does a manual copy of the project.yml file, they know to copy the other example files when needed as well.

@gapple
Copy link
Contributor Author

gapple commented Jul 6, 2016

I found that properties.xml also contains a command to copy the default.local.settings.php file. I'm not completely sure why, but in case something is expecting that behaviour I wrapped it in the same conditional.

I then tried making the setup:drupal:settings task only copy files if all of them were missing:

<if>
  <not>
    <or>
     <available />
     <available />
     <available />
    </or>
  </not>
  <then>
</if>

but that will always fail if the local.settings.php file is created by properties.xml.

Which lead me to break out each file into a separate check + action, which is more verbose, but more understandable:

<if>
  <not>
    <available />
  </not>
  <then />
</if>
<if>
  <not>
    <available />
  </not>
  <then />
</if>

@grasmash grasmash merged commit 0ea3b13 into acquia:8.x Aug 3, 2016
@gapple gapple deleted the local-config-files branch August 3, 2016 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants