Problem/Motivation
I had a problem with config_installer trying to modify settings.php when I installed site on Acquia hosting (read-only files system).
After I committed settings.php with
$settings['install_profile'] = 'config_installer';
profile still tried to rewrite this config with the exactly same value.
See http://cgit.drupalcode.org/config_installer/tree/src/Form/SiteConfigureF.... I am not sure why it is needed. Maybe we can safely remove it as standard installation step install_write_profile takes care of this.
Proposed resolution
Ideally the config_installer would not be a profile because the install profile should be determined via configuration and can influence what modules are discovered. The switching of profiles during the installation is extremely flaky and this is why this functionality belongs in core. However given #2156401: Write install_profile value to configuration and only to settings.php if it is writeable we can limit the cases where we have to write to settings.php.
The fix cannot be tested via an automated test cause file perms. The patch must be manually tested.
Remaining tasks
User interface changes
The config sync directory setting is disable if it can not be set.
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 2819385-5.patch | 2.43 KB | alexpott |
| #2 | site_installer-2819385-avoid-writing-settings-php.patch | 1.18 KB | ygerasimov |
Comments
Comment #2
ygerasimov commentedIn attached patch I simply removed the code adding changes to settings.php
Comment #3
heddnIs this a duplicate and solved in #2729243: config_installer_install_uninstalled_profile_dependencies() assumes too much in combination with #2723499: drupal_rewrite_settings called in SiteConfigurationForm?
Comment #4
alexpottIn 8.3.x we no longer need to write to settings.php for the install profile. So this is fixable - see #2855953: Incompatible with 8.3.x before that this one is a little tricky to fix. We definitely need to ensure that the install profile in the incoming config is used at some point and we need to maintain the fact we're using the config_installer during the install. This is precisely what makes this profile so tricky.
Comment #5
alexpottHere's a patch that allows settings.php to be read-only and only writes if truly necessary - this might fix a few situations pre 8.3.0 and it will fix all situation post 8.3.0 because of #2156401: Write install_profile value to configuration and only to settings.php if it is writeable
This is can't be tested with an automated test because unfortunately you can't really make the settings.php read-only in the tests it'll just do weird things.
Tests with the patch
There's no before and after because there is no test added by the patch. Also the tests where performed with 8.3.x as the 8.2.x path has not really changed. (I did you tests with 8.2.x and they were similarly all green - but would be just duplicating by copying and pasting that here.
Comment #6
xanoWe've been successfully using the patch in #5 for two months now. Thanks! :)
(I don't have the time to be more useful and research if this is indeed the right solution, so unfortunately I cannot RTBC)
Comment #7
drupalninja99 commentedOn Pantheon I still get this:
Comment #8
liam mcdermott commentedThe patch in #5 worked excellently for us (we were having this problem with a site hosted on Platform.sh). The fix in the patch is well documented and it works, so am marking RTBC.
Regarding #7 the patch isn't meant to handle the case where the installed profile name is different than what's in settings.php, so this seems like a different issue.
Comment #9
joelstein commentedPatch in #5 worked for me, too. Thanks!
Comment #10
xanoJust want to pop in and confirm that after six months this patch is still doing well :)
Comment #11
alexpottCrediting @Xano and @Liam McDermott for testing this patch in production and reporting success.
Comment #13
alexpottComment #14
schnitzel commentedepic, thanks everybody that worked on that! Just tested that on the amazee.io hosting system that is read only and it works perfectly.
Can we get a release? :)
Comment #15
alexpott@Schnitzel done