Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently there is a template for settings.php but it would be better and more flexible to dynamically generate this in the same way we generate the drush aliases file. This would be more flexibele if had a set of defaults that could be extended and if we generated
- ini_sets
- conf variable
- database variable
- current environment variable
- an array of `require()`'s (used for including a site-settings.php file if one exists)
Comments
Comment #1
tizzo CreditAttribution: tizzo commentedDidn't mean to mark this as a bug report, it's really a task.
Comment #2
greg.1.anderson CreditAttribution: greg.1.anderson commentedIf you want to generate settings.php from scratch, see #1368242: drush generate-profile. It contains a fairly slick set of routines for programatically describing data structures, and then emitting them to a file (like Drupal render arrays for .info files, et.al.). This could be applied to the settings.php file as well. I am planning on getting back to this, and hope to get it committed to Drush core soon.
See also related issue #1331924: Setting certain configuration values in settings.php (e.g. conf=1) can make Site-install fail. Skip the part at the top, start reading at #12.
Comment #3
tizzo CreditAttribution: tizzo commentedGiven that the issue greg mentions seems to have died with the move to github, I recreated this functionality in fetcher.
Comment #4
greg.1.anderson CreditAttribution: greg.1.anderson commentedSorry, I did not intend #2 to come off as "don't do it"; rather, I merely wanted to point out some resources I thought might be useful to you. Might have been helpful to fetcher if Drush had put something into site-install to support this, but #1331924: Setting certain configuration values in settings.php (e.g. conf=1) can make Site-install fail was marked "won't fix" for reasons unrelated to the move to github.
I might return to #1368242: drush generate-profile someday, but at the moment I am more interested in seeing if we can replace
drush make
with composer; c.f. Command ecosystem. This discussion is still in its early stages.In any event, it's good that fetcher has this capability now; this tool provides a useful service. Thanks for maintaining it.