Problem/Motivation
There are no longer any usages of variable_get/set/del outside of the functions themselves and specific tests.
Proposed resolution
- Remove the Variable API/subsystem entirely.
- Remove the DRUPAL_BOOTSTRAP_VARIABLES bootstrap phase.
Remaining tasks
Review patch
User interface changes
None
API changes
Removes:
DRUPAL_BOOTSTRAP_VARIABLESbootstrap phasevariable_initialize()variable_get()variable_set()variable_del()- Removes
$new_phaseparameter ofdrupal_bootstrap() - Removes {variable} table
- Removes
_drupal_bootstrap_variables()
Actual commit message
Issue #2167109 by Berdir, sun, alexpott, ACF, acrollet, adamdicarlo, Albert Volkman, andreiashu, andyceo, andypost, anenkov, aspilicious, barbun, beejeebus, boombatower, cam8001, chriscalip, chx, cosmicdreams, dagmar, damiankloip, dawehner, deviance, disasm, dixon_, dstol, ebrowet, Gábor Hojtsy, heyrocker, Hydra, ianthomas_uk, japicoder, jcisio, jibran, julien, justafish, jvns, KarenS, kbasarab, kim.pepper, larowlan, Lars Toomre, leschekfm, Letharion, LinL, lirantal, Lukas von Blarer, marcingy, Mike Wacker, mrf, mtift, mtunay, n3or, nadavoid, nick_schuch, Niklas Fiekas, ParisLiakos, pcambra, penyaskito, pfrenssen, plopesc, Pol, Rok Žlender, rvilar, swentel, tim.plunkett, tobiasb, tsvenson, typhonius, vasi1186, vijaycs85, wamilton, webchick, webflo, wizonesolutions, xjm, yched, YesCT, znerol: Remove Variable subsystem.
| Comment | File | Size | Author |
|---|---|---|---|
| #42 | variable-die-2167109-42-interdiff.txt | 767 bytes | berdir |
| #42 | variable-die-2167109-42.patch | 46.54 KB | berdir |
| #38 | variable-die-2167109-38-interdiff.txt | 12.91 KB | berdir |
| #38 | variable-die-2167109-38.patch | 46.53 KB | berdir |
| #37 | 36-37-interdiff.txt | 5.78 KB | alexpott |
Comments
Comment #1
aspilicious commentedWhy are we opening a new critical task... Can't we do it in the meta? There was a patch in that issue already provided.
Comment #2
sunThe issue priority is irrelevant. A meta issue is not supposed to perform functional changes and the actual functional change might require more discussion.
Note that the bootstrap phase is removed separately in #2167105: Remove DRUPAL_BOOTSTRAP_VARIABLES — perhaps we're even able to proceed with that issue independently of the blockers.
Comment #3
xjmI'm not sure that this actually reflects current practice, but I'm entirely on board with marking #1775842: [meta] Convert all variables to state and/or config systems fixed when the blockers sun lists are fixed, and then handling the actual removal in this new issue. And this is critical, and a beta blocker. Thanks @sun.
Comment #4
xjmTag fail.
Comment #5
ianthomas_ukWe also need to remove the variable table itself, and @berdir pointed out that "there's also a VariableTest that you can remove and SystemTestController::variable_get() including the route that points to it"
There are still some direct uses of the variable table in update-related functions, but these can be ignored because these functions are now only useful as a reference for the migrate initiative.
There may also be places looking directly into the global $conf variable for items that used to be variables. The $conf variable is still used by CMI though - see #1881582: Change configuration overrides to use $config instead of $conf
Comment #6
sunAs long as we're able to cleanly separate the two parts of (1) the subsystem and (2) the subsystem's usage, it makes sense to distill, identify, and discuss the necessary changes independently of each other. We can merge the issues later, but it helps to have a clear picture first.
Thanks for the major pointer of missing the {variable} table! :)
To wit: One of the primary reasons to keep these functional changes separate:
Thankfully, the comment does not explain why and does not point (@see) to anything else. ;-)
However, my greps for this and the other issue did not yield any results in database drivers. So my only hope is that this comment is outdated and obsolete, but I'm not sure... :-/
Comment #7
damien tournoud commentedYes, database drivers do not and cannot depend on the variable table, feel free to nuke this. At one point PostgreSQL depended on the schema, but we nuked that a long time ago.
Comment #8
sunMerging #2167105: Remove DRUPAL_BOOTSTRAP_VARIABLES into this issue.
Attached patch removes all remnants of the variable system, including the bootstrap phase.
Leaving issue status postponed until the blockers are resolved.
Comment #9
berdirThere are also a number of global $conf of which most can be removed now, and we have #1881582: Change configuration overrides to use $config instead of $conf for the remaining ones.
Comment #10
sunIndeed, regex-grepping for
\bconf\byields a lot more instances.Attached patch (1) removes obsolete instances and (2) changes remaining to $GLOBAL['conf'] or adds a @todo.
interdiff wasn't possible, failed to reconstruct file.
Comment #11
andypostSuppose
statistics.phpcould skip page cache #2094335: statistics.php needs a lower bootstrap levelComment #12
berdirRe-roll.
I was able to bootstrap with this now, so I think it's time to let the testbot have a go with this :) Language negotiation tests will obviously still fail, and there's a weird node access test variable_set() left-over, but the issue for the first part is already RTBC and I want to review and RTBC #2175739: Actually test node_access_test_secret_catalan and clean up deprecated code in NodeAccessLanguageTest asap.
Comment #14
berdirUhm, no idea where that was coming from.
Comment #15
sunTo my knowledge, that was and is the one and only use-case for the second $new_phase argument and (slightly weird) recursion logic of drupal_bootstrap().
→ Would be great to remove that here as well?
That said, another removal of that same call got lost in the re-roll: LanguageNegotiator::getConfiguration()
Comment #16
catchJust committed the negotiation CMI conversion so this ought to pass now.
Comment #17
alexpottBlocked by #2175739: Actually test node_access_test_secret_catalan and clean up deprecated code in NodeAccessLanguageTest
Comment #19
alexpottAnd also blocked by #2182603: Remove LocaleUninstallTest
Comment #20
berdirRe-roll, Removed $new_phase, the second call has been removed already.
Fixed a notice in WebTestBase, that stuff there might need some more work...
Comment #21
berdirComment #23
berdirCleaning up DUBT tests.
Comment #24
webchickFYI: #2175739: Actually test node_access_test_secret_catalan and clean up deprecated code in NodeAccessLanguageTest and #2182603: Remove LocaleUninstallTest are both committed as of moments ago. :)
Comment #26
alexpottReroll since core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php no longer exists and a couple of minor comment edits since the phrase "Drupal variables" doesn't really make any sense.
Comment #27
alexpottImproving issue summary and adding a suggested commit message.
Comment #28
tim.plunkettAnd then there were 4!
Other than hook_update_N, upgrade tests, Migrate code, and core/scripts/generate-d6-content.sh, all variable code is gone.
Most of the additions to this patch are working around the setting of the request, or adding @todos.
I don't see why this isn't RTBC, so marking as such.
Comment #29
berdirThere might still be a few test fails that need to be looked into, if you look at the test fails in #20, there is for example MigrateSimpletestConfigsTest that fails and that does look suspicios...
Comment #30
gddI've been out of things for a while, but what an amazing accomplishment! Three years of work finally coming to fruition. Can't thank everyone who has helped out on CMI enough.
Comment #31
webchickWhile we're waiting on testbot, would someone be able to take on crafting an appropriate commit message that at least attempts to credit all of the various people involved? :)
Comment #32
alexpottWe still need to initialise
global $confindrupal_settings_initialize()since this is where settings.php is included.Comment #33
ianthomas_ukHere are the 80 people, in alphabetical order, who were credited on a patch with the commit message "Convert ... configuration system" or "Convert ... CMI". Sorry if I missed anyone.
ACF, acrollet, adamdicarlo, Albert Volkman, alexpott, andreiashu, andyceo, andypost, anenkov, aspilicious, barbun, beejeebus, berdir, boombatower, cam8001, chriscalip, chx, cosmicdreams, dagmar, damiankloip, dawehner, deviance, disasm, dixon_, dstol, ebrowet, Gábor Hojtsy, heyrocker, Hydra, ianthomas_uk, japicoder, jcisio, jibran, julien, justafish, jvns, KarenS, kbasarab, kim.pepper, larowlan, Lars Toomre, leschekfm, Letharion, LinL, lirantal, Lukas von Blarer, marcingy, Mike Wacker, mrf, mtift, mtunay, n3or, nadavoid, nick_schuch, Niklas Fiekas, no_commit_credit, ParisLiakos, pcambra, penyaskito, pfrenssen, plopesc, Pol, Rok Žlender, rvilar, sun, swentel, tim.plunkett, tobiasb, tsvenson, typhonius, vasi1186, vijaycs85, wamilton, webchick, webflo, wizonesolutions, xjm, yched, YesCT, znerol
Comment #36
berdirBad testbot, bad! :)
Messing with our tests, tsss...
Will provide another patch that removes all the $conf/$config related todo's, I think that's unecessary, will just unecessary conflict with patches that are already in that issue and once this is in, it will simply have to get rid of all the $conf left-overs.
Comment #37
alexpottHere's a patch removing all the @todos
Comment #38
berdirHere's another patch that does the same and changes/reverts a few more things.
- Revert the changed variable order in drupal_settings_initialize()
- Revert the removal of the similar global $conf in _drupal_load_test_overrides(), I think we should continue to support config overrides like that and will just have to rename it then.
- Revert changes to the update_variable_*() function docblocks, they will be removed in #2168011: Remove all 7.x to 8.x update hooks and disallow updates from the previous major version, which is close to RTBC as well, so let's not mess with that unnecessarily.
- Instead of simply dropping it, converted the $conf removal in DrupalKernelTest to settings, which is actually what the PhpStorageFactory is now using. There was also a second usage of $global conf in there which I updated too
- Instead of simply removing the bogus DatabaseStorageTest $conf change, I replaced it with a setting, to make it explicit that we are using the database backend and aren't just relying on the default.
I think we need one additional follow-up to move container_service_providers to settings instead of using global $conf, we have one for $config and for system.file:path.private.
Comment #40
berdirOpened #2183323: Replace $GLOBALS['conf']['container_service_providers'] in DrupalKernel with Settings
Comment #42
berdirArg, copy & paste fail.
Comment #45
berdir42: variable-die-2167109-42.patch queued for re-testing.
Edit: Random fail.
Comment #46
berdirComment #47
sunRegarding all of the variables in settings.php, see also #2160705: settings.php setting names are inconsistent (and undocumented)
Even though I authored major parts of this patch, I'd like to RTBC it. :-)
Comment #48
catchCommitted/pushed to 8.x, thanks!
http://drupalcode.org/project/drupal.git/commit/e373ebe
Comment #49
alexpottCommitted e373ebe and pushed to 8.x. Thanks!
A change notice already exists though it needs a lot of work :) https://drupal.org/node/1785368
Comment #50
alexpottCorrect change notice: https://drupal.org/node/1500260
Comment #51
gábor hojtsyI've updated https://drupal.org/node/1500260/revisions/view/6872993/6873033 a tiny bit for changes in core to code style and the typification of config yaml, but not sure what else would be needed to cover this issue. That already mentions variable_get()/set/del are replaced with the config() API. Maybe more examples would be nice, eg. on how to del/remove things. But otherwise what is missing?
Comment #52
gábor hojtsyAdded change notice for the actual change in https://drupal.org/node/2183531 - this was confirmed to be looking good by @beejeebus and @berdir, so closing this issue. Yayayayay!