Needs work
Project:
Drupal core
Version:
main
Component:
configuration system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 Jan 2014 at 15:28 UTC
Updated:
13 Dec 2022 at 18:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sunA proper singleton that can't be futzed with at regular/non-test runtime (as opposed to current Settings) requires #2171683: Remove all Simpletest overrides and rely on native multi-site functionality instead
The parent issue contained an initial prototype, but I advanced that into a 100% secure singleton in #1757536: Move settings.php to /settings directory, fold sites.php into settings.php
Comment #2
andypostComment #3
mgiffordComment #4
alexpottHere's a patch that removes the global $config by adding it to the Settings object which I think makes sense since this object corresponds to settings.php and is a singleton already.
Comment #5
alexpottActually I don't think this needs a change record. Existing contrib should not be setting the global. I'd be surprised if even using this in tests was common.
Comment #6
alexpottComment #7
alexpottComment #8
berdirThat's actually the opposite of what we're doing in #2443351: Ensure that settings can't be serialized by not injecting them / replace stuff with container parameters..
Comment #9
dawehnerNeeds some quick docs, but the name describes things really well already.
Is there a reason you used ake() instead of the isset() calls in other current code?
Does that mean for consisteny we should have Settings::getAllConfigOverrides() ?
Comment #10
alexpottRe #8 I'm not sure that that issue will pass our beta evaluation.
Comment #11
bill richardson commentedPatch requires re- roll -- setting to needs work.
Comment #12
dawehnerJust some minor adjustment
Comment #14
joshi.rohit100I am wondering if I change username/password of my db in settings.php, I see "The website encountered an unexpected error. Please try again later." error not "PDOException".
Comment #15
dawehnerWell, we hide exceptions by default. It is as simple as that, but we provide tools (see settings.local.php) to show the entire exception.
Comment #16
xjmUnfortunately we can no longer change this safely in 8.x, so postponing to 9.x per discussion with cilefen and alexpott.
Comment #17
dawehnerWhat about a BC layer?
Comment #18
alexpottI'm not sure a BC layer is possible because with a global anything can add to it at any point - yes it is fragile but if you set a config override before that specific configuration object has been loaded then it'd work. :( globals--
Comment #19
catchI don't think #18 constitutes an API break, so moving this back to a minor version for now.
Comment #20
catchWe could also add support for a new key, that's not a global, and deprecate $config.
Comment #21
alexpottI was thinking that we could make global access to $config and $config_directories @internal and document that the only supported way of setting these is in settings.php.
Comment #22
catch#2550249-45: [meta] Document @internal APIs both explicitly in phpdoc and implicitly in d.o documentation proposing we make #21 part of the docs.
Comment #23
alexpottI think that that means we need a getter for
global $configso that as long as code is using the getter and setting them in settings.php then their code will not break.Comment #24
alexpottSomething like this. I think it is important that the new getter is used somewhere to (a) prove it works and (b) prove we don't break it. Hence I've used in the ConfigFactory - the most important place. But instead of forcing the injection of Settings I've made it optional - which i think is okay because it is a global singleton itself. This buys us testability and the ability remove the global $config in the Drupal 8 cycle. I've also made the other config global
@internalbecause it already has a getter.Comment #25
dawehnerMh, so does that mean we can use the global at some point just for setting and unset it later?
Comment #26
alexpottIt means the only supported way of setting it is in settings.php where you all you have to do is $config['blah'] = ...
This way no one has to interact with the global at all.
Comment #28
xjmComment #42
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 200, following Review a patch or merge require as a guide.
Tagging for an updated issue summary after 7 years imagine a lot has changed. Would be good to see what's still all needed (if anything).