Created from #1775842: [meta] Convert all variables to state and/or config systems.
This looks like a good candidate for the state system as it is an internal flag of sorts.
Other references to this variable are http://drupal.org/node/1178246#comment-5123444 and http://drupal.org/node/1178246#comment-5123444, where Crell mentions:
"The better way of doing it would likely be "whatever the CMI folks come up with when they figure this out". :-) Heyrocker said to go ahead with this approach for the time being and when CMI figures out how to handle super-early configuration we can move it over to that, along with a half-dozen other things."
So, is the state system what we should use for this super-early configuration? Or do we need another approach altogether? Either way, the reference to variable_get() needs to be removed from comments as well.
The Autoloader doesn't exist in D7 so we don't need to worry about d7->d8 migrations.
Comment | File | Size | Author |
---|---|---|---|
#15 | autoloader_mode_global-1814086-15.patch | 2.87 KB | samhassell |
#12 | autoloader_mode_global-1814086-12.patch | 2.95 KB | samhassell |
#9 | autoloader_mode_global-1814086-6.patch | 2.97 KB | fgm |
#7 | autoloader_mode_global-1814086-6.patch | 2.97 KB | samhassell |
#4 | autoloader_mode_global-1814086-4.patch | 2.97 KB | samhassell |
Comments
Comment #0.0
samhassell CreditAttribution: samhassell commentedadded created from reference.
Comment #0.1
samhassell CreditAttribution: samhassell commentedadded comment about upgrades.
Comment #1
samhassell CreditAttribution: samhassell commentedconfig.inc gets loaded in _drupal_bootstrap_configuration directly after the call to drupal_classloader(), which contains the autoloader_mode get. This means we can't use config().
autoloader_mode isn't a good fit for state either, as it is a setting that should be sent between dev environments.
Setting this to needs review as I need some guidance on how to proceed before I start writing patch. Sorry if that's the wrong status :)
Comment #2
catchThis should be in neither state nor config at the moment, it'd need to move to its own global in settings.php similar to $databases. Eventually we might want to replace those with some other mechanism, but that should be enough to remove the variable_get().
Comment #3
catchComment #4
samhassell CreditAttribution: samhassell commentedOkay I removed autoloader_mode and added a global in settings.php, $class_loader. The new name seems more in line with the terminology used in the comments. $class_loader gets declared in drupal_settings_initialize() along with the other settings.php variables.
Needs some more perspective on comments as well.
Comment #5
samhassell CreditAttribution: samhassell commentedComment #7
samhassell CreditAttribution: samhassell commentedfixed php error.
Comment #8
BerdirLooks generally ok, we're still looking for a pattern and often still use $conf in settings.php but access it directly instead of through variable_get(). So that would be a possiblity as well that wouldn't require as much changes.
Also, we should check if it's set and initialize to default if not, then we don't need the block in settings.php, because e.g. sites that are upgrading from 7.x won't have that.
Comment #9
fgmChanged the docs a bit, fixed Symfony name.
Regarding the check for the variable, it needn't be initialized to default: because there is a
global $class_loader;
before its first use, it will always be defined, possibly toNULL
, even without being defined insettings.php
.Comment #10
BerdirAh, I didn't know about the part with global $class_loader.
What about having "# $class_loader = 'apc';" in there? There are quite a few lines in there with a similar pattern, then users just need to comment it out to enable apc?
"The APC classloader provides better performance and is recommended for production sites." instead of the last sentence?
Symfony. Maybe write this in a single sentence?
The docs look ok to me apart from that.
Comment #11
fgmOops, looks like I re-uploaded the original patch. Will redo.
Comment #12
samhassell CreditAttribution: samhassell commented- reworked the settings.php $class_loader comment incorporating Berdir's last line change, also fixing misspelling of Symfony. (You've no idea how often I'm doing that :P)
- following Berdir's advice set $class_loader to 'apc' and commented it out.
- removed the @todo in settings.php
Maybe we should get rid of this todo from bootstrap.inc? Settings.php variable seems logical for setting this.
@fgm: add your changes to this one?
Comment #13
aspilicious CreditAttribution: aspilicious commentedIt would surprise me if this still passes. Lets retest
Comment #14
aspilicious CreditAttribution: aspilicious commentedWhy do we need this global here? (at this spot in code)
This comment surpasses te 80 chars line. I'm not sure we need the todo. A settings.php setting looks fine to me for this case.
Comment #15
samhassell CreditAttribution: samhassell commentedThis line in drupal_settings_initialise() is used to declare the variables in settings.php as global variables. As all the other settings.php variables are declared global here, it makes sense to follow the pattern and declare $class_loader in the same manner.
I don't see a better alternative for this - it could be declared global in settings.php, but that has not been done in any other case.
*edit* Here's the relevant code for context:
I agree. Removed the comment in the attached patch (rolled against latest 8.x)
Comment #17
Berdir#15: autoloader_mode_global-1814086-15.patch queued for re-testing.
Test failure was a database deadlock.
Comment #19
samhassell CreditAttribution: samhassell commented#15: autoloader_mode_global-1814086-15.patch queued for re-testing.
Comment #21
samhassell CreditAttribution: samhassell commented#15: autoloader_mode_global-1814086-15.patch queued for re-testing.
Comment #22
aspilicious CreditAttribution: aspilicious commentedLooks good
Comment #23
catchCommitted/pushed this one to 8.x. This also reminded me of #1833516: Add a new top-level global for settings.php - move things out of $conf so I added a follow-up patch for this one there.
Comment #24.0
(not verified) CreditAttribution: commentedi think i a word