Postponed (maintainer needs more info)
Project:
Drupal core
Version:
main
Component:
install system
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Jul 2010 at 02:38 UTC
Updated:
1 Oct 2025 at 12:31 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
JacobSingh commentedwhoops, wrong patch.
Comment #2
JacobSingh commentedSorry, it's really late. Oddly, there was an undocumented argument to the function which wasn't used in any callsites ($prefix) removed it.
Comment #3
David_Rothstein commentedI think it makes sense to split them up, but a function called "drupal_rewrite_settings" really sounds like it should actually rewrite the settings file. How about making a separate helper function that does this? Then you get the best of both worlds: A reusable function, but no changes to the existing behavior of drupal_rewrite_settings().
Maybe drupal_get_updated_settings_file_content(), or something shorter? :)
Comment #4
effulgentsia commentedYeah, consider scenarios like aegir or any other kind of Drupal provisioning system, where the provisioning site wants to re-use the functionality of generating a settings.php file, but without overwriting the settings.php file of the provisioning site itself. But I agree with #3 that we don't want to change the API of drupal_rewrite_settings() at this stage of D7. So here's a pretty minimal patch to achieve the goal without any API change.
Comment #6
effulgentsia commentedComment #7
effulgentsia commentedComment #8
gábor hojtsyPatch looks good. Here it is rerolled with phpdoc wrapping changes.
Comment #9
damien tournoud commentedThanks for using file_put_contents() here, while we are at it.
Comment #10
JacobSingh commentedwhy aren't you using file_put_contents here?
If there is a good reason to use the more verbose fwrite() that I don't see, RTBC. Otherwise, use file_put_contents(). no big deal either way though.
-J
Comment #11
dries commentedI guess that means it is 'needs work'.
Comment #12
David_Rothstein commented#8: drupal_rewrite_settings-852352-8.patch queued for re-testing.
Comment #13
David_Rothstein commentedProbably getting a little late for this issue in D7 (given that it is marked a feature request).
However, the patch looks fine as is. Switching to file_put_contents() would be a separate issue - all this patch does is move the code around; it is not a requirement for it to try to improve the existing code at the same time as it's moving it :)
Comment #14
effulgentsia commentedThe good reason is that's how it is in HEAD, so as per #13, out of scope for this issue. Therefore, back to RTBC.
Comment #15
dries commentedThe function names don't seem 100% consistent and self-explanatory. For example, the new function has '_file' in its name but doesn't actually write to a file.
I also recommend that we document the use case for this so people better understand why these are separate functions.
Needs a bit more work, IMO.
Comment #16
ksenzeeI reviewed the function names and the best I could come up with is drupal_generate_settings_file_content(). A bit verbose, but it clarifies what the function does, and I think even manages to make it clear why we're separating the two. Generating content and writing that content to a file are two separate jobs.
This patch is a reroll that simply changes the function name (and adds a couple hyphens in the phpdoc). I think it's reasonable for backport to D7, but I'm moving it to D8 first.
Comment #17
nagba commentedrerolling the patch for Drupal 7.18
Comment #18
David_Rothstein commentedNeeds to go into Drupal 8 first.
Comment #19
David_Rothstein commentedTagging for possible backport, though...
Comment #20
David_Rothstein commented#16: 852352-16.drupal_rewrite_settings.patch queued for re-testing.
Comment #21
pwolanin commentedlooks like the tag got eaten
Comment #22
jhedstromComment #23
ankitgarg commentedNew Changes are already applied to files. Can be close.
Comment #24
jhedstromPatch in #23 only contains some comment changes.
Comment #25
piyuesh23 commentedComment #26
ayesh commentedComment #30
vijaycs85Comment #31
pk188 commentedComment #42
smustgrave commentedThank you for sharing your idea for improving Drupal.
We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!