Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
configuration system
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
18 May 2012 at 23:00 UTC
Updated:
29 Jul 2014 at 20:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
marcingy commentedInitial thoughts on the config_install_default_config is something along these lines
Comment #2
alexpottI think this makes sense... so are you suggesting that system_update_8010 should look something like this:
Comment #3
marcingy commentedYes something like that.
Comment #4
marcingy commentedInitial roll adding in the missing updates and a means by which existing configs won't be overwritten.
Comment #6
marcingy commentedRe-rolled for yaml.
Comment #7
sunI have no idea what this means.
Comment #8
marcingy commentedIt means exactly what it says the updates in question do not call config_install_default_config which means that the systems config files would not have been available for those updates and hence the import of variables would not have happened. All updates that manipulate config need to load files into the active store.
As it stood no data for rss and cron was available.
Comment #9
sunI'm pretty sure that my patch in #1496542: Convert site information to config system eliminates this issue. Am I correct?
Comment #10
marcingy commentedYes changes in update_variables_to_config will solve this issue as that approach is namespacing the config that is loaded. Marking this as a dup.
Comment #11
sunReplaced the issue summary.
Extracted relevant changes from #1496542: Convert site information to config system
Comment #12
sunComment #13
catchComment #14
sunStray left-over.
Comment #15
sunComment #15.0
sunUpdated issue summary.
Comment #16
sunApparently, I contradict myself. When being called repetitively to migrate (more) variables for the same config object name, then subsequent calls will reset the config object to the default configuration being defined in the default configuration file.
So far, this use-case does not exist in the module update functions, and at this point, I'm not sure whether the case will appear at all.
We'll have to decide whether to ignore that case for now, or whether to pro-actively prevent data rotten.
Upfront, though, DrupalConfig does not provide methods for handling the config data keys for a special case like this, so if we decide to account for it, then a proper solution will require a decent amount of code to handle the string-key to nested-array-key munging (in both directions).
Comment #17
sunoh. Luckily, we have a nice helper function for that already. Since this is in update.inc, we can use it. :)
Comment #18
sunAnd let's make that more explicit.
Comment #19
sunAdded tests for repetitive migration into same config object.
Comment #20
sunFWIW, this patch is ready to be committed.
Comment #21
cosmicdreams commentedNice patch sun. Was going to comment about a update function but later found you moved what node_update_8002 is doing the system module.
I do have a follow up question though. When update functions like that are moved should we modify the function names so that they remain sequential?
If that's not an issue then I vote RTBC
Comment #22
sunUpdate functions are normally not renamed.
(Although, admittedly, during the D7 cycle, there was a dedicated clean-up of the entire upgrade path, which not only renamed but also mixed and merged and rewrote plenty of update functions to speed up the upgrade performance. However, that was a special coordinated effort and shouldn't be done randomly IMO.)
Comment #23
cosmicdreams commentedGood to know, reviewed, although not manually tested.
Comment #24
catchOK just question really, looks really good to me though.
Do we really want to delete the variables here? During the release cycle I could see some variables being split into several more granular ones, with the current setting being used as the default for the new values. That could happen in contrib as well as between core modules.
Also we don't have explicit ownership of variables at the moment, and there's the potential for forked modules to have competing upgrade paths (think ubercart vs. commerce in D7).
I'm assuming we'll have an update in Drupal 9 that is just db_drop_table('variables'); which is going to have the same effect, so why not leave them there for now?
Don't really mind this, but why not just quote it?
I much prefer the explicit mapping here, this is great.
Comment #25
sun1) I don't think that retaining converted variables is a wise idea - exactly because of the reason that the already converted configuration might be changed further in a later update. Thus, the result would be duplicated and inconsistent values between variables and configuration, without having a clear master value. Due to that, I rather see modules using hook_update_dependencies() at this point.
But alas, that's exactly the reason for why I added the config_upgrade phpDoc group. I'm afraid we'll have to re-evaluate the entire upgrade path concerning variables and config conversions and make sure they run in the correct order at some point. :-/
2) @chx asked me the same, and I replied that var_export() does the quoting and also double-quoting if necessary.
--
Not sure what to do now... back to RTBC?
Comment #26
catchhook_update_dependencies() is probably enough here.
With the quoting vs. double quoting, I'm not sure why that's needed? The only reason to add quotes around the variable is differentiate it from the rest of the error message, if the variable is "it's" then it doesn't really matter if it's mis-quoted - it's a sentence as opposed to PHP.
Comment #27
dries commentedThe fact that we have to read and parse the default configuration file ourselves feels like a short-coming of the configuration management API. I'm happy to keep this as is but it did gave some pause. Seems like it would make sense to have an API to retrieve defaults? Maybe I misunderstood, in which case maybe this can be documented a bit better in the code.
Should we change 'system.cron.cron_max_threshold' to 'system.cron.max_threshold' now (i.e. drop 'cron_')? It seems like the module can be dropped from the variable names with the explicit naming and the extra namespacing.
Comment #28
sunThe fact that we're able to use the config system's file storage controller directly here is not a shortcoming, but instead the contrary, one of the accomplishments we've achieved through the config system re-architecture changes so far. There are many more to come, see #1560060: [meta] Configuration system roadmap and architecture clean-up for a complete picture.
This particular code is special upgrade path behavior in itself. But since it's using public API methods of the config storage interface, I don't think the code/usage needs anymore explanation or documentation.
Comment #29
sun#19: config.upgrade.19.patch queued for re-testing.
Comment #30
sunSo the only remaining "blocker" is to change the var_export() into some fancy quoted string concatenation?
Comment #31
sunReplaced var_export() with embedded string variables.
Tentatively moving back to RTBC.
Comment #32
dries commentedAlright, I committed this to 8.x. We can debate the finer points of the CMI API and whether it should know about defaults, but at the end of the day this patch fixes a critical bug. :)
Comment #33.0
(not verified) commentedUpdated issue summary.