After upgrading to Provision version 7.x-3.9 from 6.x-2.4, we found that newly-created websites are now provided with an empty 'local.settings.php' file which is included by the site 'settings.php' file, if present. This isn't a behavior that is useful for our installation, because our users are in the habit of using a pull from a Git repository to supply a 'local.settings.php' file, if needed. This empty file would interfere with our workflow. Thus, I've patched the 'provision/Provision/Config/Drupal/Settings.php' file to suppress the creation of this file if a new Drush variable called 'provision_create_local_settings_file' is set to FALSE. The default behavior of creating the file is left unchanged. Thus, for our installation, we set this variable in the '/var/aegir/.drush/local.drushrc.php' file to FALSE.
Comment | File | Size | Author |
---|---|---|---|
#2 | suppress_local_settings_file-issue_#2879243-v1.patch | 2.6 KB | kfolsom |
Comments
Comment #2
kfolsom CreditAttribution: kfolsom commentedComment #3
colanLooks like this is being handled by #2877650: Site Git Repos? The file name is different, but would that be sufficient?
Feel free to comment on or review what's going on over there. It would be good to finalize that new documentation page.
Comment #4
kfolsom CreditAttribution: kfolsom commentedThanks for the response. I read the information at the link you provided. It indicates that the recommended Git repo structure includes a .gitignore file that contains 'local.settings.php', telling Git to ignore this file. But rather than having Git ignore that file, we want it to be in the repo and pulled down by Git. That's why having Provision create an empty 'local.settings.php' file is problematic; if Provision creates this file and a web site maintainer then creates their own within the Git repo, the empty file will get in the way of the user's Git-controlled file. Thus the need for the patch I submitted above, allowing us to set a variable to over-ride the default Provision behavior.
Another option is to change Provision so that it never creates the empty 'local.settings.php' file. I'm not clear on why this is needed or what the use case is for it.
Thanks again,
Keith
Comment #5
colanComment #6
colanComment #7
c_archer CreditAttribution: c_archer as a volunteer and commentedHi Keith,
I agree not having 'local.settings.php' in Git is frustrating. The way I've got round it without patching is as per https://www.drupal.org/node/2877650#comment-12081846
It does mean I have to SSH in and add the include to 'local.settings.php' which is not ideal. As per your initial comment having an option to turn this off would be useful. Preferably having this is as a tickbox in the UI under admin/hosting/settings or if a site is built from Git then it's disabled.
Thanks,
Chris
Comment #8
kfolsom CreditAttribution: kfolsom commentedHi, Chris,
Thanks for the information on how you are handling the 'local.settings.php' file. Our website maintainers don't have access to their site files via SSH, so Git becomes the only way for them to add files or configuration settings to their site. So managing the 'local.settings.php' file via Git is very useful.
Can you explain why Provision is manipulating the 'local.settings.php' file at all, beyond possibly setting proper permissions on it? I haven't been able to understand why it is even being created if not found, given that the created file just contains an opening PHP tag.
I agree that a UI option for configuring this behavior would be ideal, if the behavior is needed at all. I made it a Drush option variable because that seemed simple and sufficient, somewhat analogous to the other existing options such as 'provision_verify_platforms_before_migrate' and 'provision_backup_suffix'.
Thanks again for your feedback,
Keith
Comment #9
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedHere is some background on why and when it was introduced:
#1066000: Local.settings.php can stop working due to file ownership/permissions
Comment #10
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedThanks, the patch looks sane.
Creating the file was mainly done to help users discover the possibilities of it, but I can see how it gets in the way when you don't ignore it in Git.
Patches for UI elements are welcome.
Comment #11
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commented