Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a spin-off from #1703168: [Meta] Ensure that configuration system functionality matches expected workflows for users and devs.
The patch adds a config import directory, and updates the tests, installer and config sync code to use it.
Comment | File | Size | Author |
---|---|---|---|
#43 | 1741804_43.patch | 23.73 KB | chx |
#38 | 1741804_38.patch | 24.02 KB | chx |
#38 | interdiff_27_38.txt | 12.81 KB | chx |
#38 | interdiff_34_38.txt | 5.88 KB | chx |
#34 | config.directories.34.patch | 23.4 KB | sun |
Comments
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedconfig-import-directory.patch queued for re-testing.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedhmmm. so our upgrade path tests don't work unless your parent drupal has a writable settings.php. i don't know enough about those tests to know if that's a known, expected behaviour or not.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedtagging.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedzomg, i had to export another global. sigh.
Comment #7
tstoecklerTypo of "direcotry"
Otherwise, looks really great, though.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentednew patch just fixes typo from #7.
Comment #9
alexpottI think we should move to a format like this:
Because it makes it consistent with
global $databases;
and then a site can add more... which allows for some very interesting workflows.No interdiff because it's a different approach.
Patch attached is a potential implementation
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedi'm not sure i buy the reasoning exactly, but i like making config_get_config_directory() take a param, so i'm happy if we move forward from the patch in #9.
lets make that code check that $config_directories[$type] is set, and throw an exception if it isn't. Bad Things can happen in that case, and we want to blow up immediately with a specific error.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedattached patch implements #10.
Comment #12
chx CreditAttribution: chx commentedThanks, I think this is going great! I am not sure how I feel about calling it staging... it feels bikeshed-y to debate that so I will pass.
import or staging? Comment says one thing, the code another.
Same.
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commented@alexpott if u get to this before I do, I prefer import, but I'll don't care too much either way.
Comment #14
alexpottBut you import and export into this folder :) that's why I went for "staging"... I might actually prefer "stage" (hmmm... I feel like I'm entering a bikeshed ;) )
Comment #15
Anonymous (not verified) CreditAttribution: Anonymous commentedi've painted the bikeshed a fetching shade of staging - all comments now refer to a staging directory :-)
Comment #16
andyceo CreditAttribution: andyceo commentedconfig-import-directory.patch queued for re-testing.
Comment #17
chx CreditAttribution: chx commentedLooks nice.
Comment #18
sunAwesome! Thanks for moving this forward, @beejeebus!
It makes sense to do this as a separate patch as preparation for switching to FileStorage for the active store.
A few issues though:
1) $GLOBALS['config_directory']
should be
$GLOBALS['config_directories']
I think?
2) Not really happy about polluting $this with these individual properties... can we just set $this->configDirectories to essentially hold the already resolved values of the global variable?
We can do it in a follow-up patch, but ideally we should just be calling into install_ensure_config_directory().
I prepared that in #1626584-112: Combine configuration system changes to verify they are compatible already. Earlier comments on that issue explain some more problems with the Drupal installer. I'm happy to perform these changes along with the issue/patch that replaces the DatabaseStorage to FileStorage for the active store though. That said, I'm not sure whether we want to change install_ensure_config_directory() to create all config directories in one fell swoop, as I've done in there?
Comment #19
matason CreditAttribution: matason commentedBy the looks of it, I think we can just call config_get_config_directory() since this function checks drupal_valid_test_ua() and returns an appropriate path, I'll test out my theory and come back with a patch if it works.
Comment #20
matason CreditAttribution: matason commentedThe attached patch implements sun's suggestion however to make use of install_ensure_config_directory() we'd need to require_once(DRUPAL_ROOT . '/core/includes/install.inc'); which I suspect we don't want to do? Instead I have stuck with a call to file_prepare_directory(); for each config directory.
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commented#20: 1741804-20-config-import-directory.patch queued for re-testing.
Comment #24
Anonymous (not verified) CreditAttribution: Anonymous commentedfixed brokenosity in prepareEnvironment() and implemented #18.
Comment #26
Anonymous (not verified) CreditAttribution: Anonymous commentedblurgh, fix typo in config_get_config_directory.
Comment #27
Anonymous (not verified) CreditAttribution: Anonymous commentedin #drupal-contribute chx asked me to make the code in drupal_install_config_directories() use a loop, and i think its a good suggestion.
new patch is the same as 26 apart from that.
Comment #28
dagmarCode looks good, however I see some issues with the docs:
Could we have a better explanation about what means 'active' and 'staging'?
If developers try to get this information reading the docs of config_get_config_directory it says: Drupal core provide 'active' and 'staging' but doens't really explain which directory will be used to export and which is used to import configurations.
Same for this settings. It should be more clear the difference between staging and active.
Comment #29
sunFixed phpDoc and Exception of config_get_config_directory().
Added staging storage as a separate DIC service.
Some of these changes/adjustments are essentially extracted from #1626584-113: Combine configuration system changes to verify they are compatible
Comment #30
sunThat said, the service name
config.state
was a quick naming choice. Do we want to rename the two config storage services intoconfig.storage.active
andconfig.storage.staging
?Comment #32
yched CreditAttribution: yched commentedNaming nitpick :
I'm a little worried that the 'staging' config dir is confusing. The most commonly used meaning of the word is "one of the servers in a typical dev-stage-live deployment line". So having a 'staging' config dir on each of the 'dev', 'staging' and 'live' servers sounds like a WTF.
Can't we have the 'active' and 'import' stores ?
Comment #33
sunHrm. Spent quite some time to resolve the Drupal installer errors, but pretty much ended up with merging a range of changes from the next branch...
The failures are currently "hidden" with the original patch here, since it doesn't register the config staging/state storage as a service on the DIC. As soon as you do that (and we want to do that), the installer calls into drupal_container() for rendering the maintenance theme and other stuff, but drupal_container() calls into config_get_config_directory(), which throws an exception, because the requested config directory does not exist yet.
I'm not entirely sure whether to proceed with this patch without the DIC service, or whether we want to merge in the required adjustments for the Drupal installer here. As mentioned, we'll need to do those anyway later on. I somewhat lean towards not including them here, but yet, reducing the amount of conflicts.
Will roll a revised patch in a minute.
Comment #34
sunFixed installer creates config directories too early.
Reverted config.state DIC service.
re: #32: @yched: "import" doesn't really fly either, since it is also used for exporting config. That's more or less the reason why I chose to go with "state" in the service name... None of the names are really ideal, but if possible, I'd prefer to defer the discussion on a proper name to a separate issue, so we can move on with all the other technical implementation stuff in parallel.
Comment #35
Anonymous (not verified) CreditAttribution: Anonymous commentedsun can drive this home.
Comment #36
sunMy changes to this patch are pretty minor -- merely ensured that they're compatible with the new CachedFileStorage implementation, so I think this is RTBC.
Let's move the discussion about the "staging"/"state"/"import" config directory name into the original issue:
#1703168: [Meta] Ensure that configuration system functionality matches expected workflows for users and devs
(That said, I'm already working on incorporating this patch into the next branch and stumbled over some new + odd hiccups in the installer, but we can fix/adjust this code when we're actually switching to the CachedFileStorage.)
Comment #37
sunMoved the discussion on "staging" into #1703168-47: [Meta] Ensure that configuration system functionality matches expected workflows for users and devs
Would be great if we could quickly move forward here, since this patch is blocking #1702080: Introduce canonical FileStorage + (regular) cache
Comment #38
chx CreditAttribution: chx commentedI have added a use Exception to boostrap.inc because that's our code standard like it or not, renamed variables in the test -- because it was called $state and it was not storing state of any kind IMO -- but that's all. It's just renames. I have attached two interdiffs, one to sun's latest and one to Justin's because sun's patches were changing wildly back and forth making it harder to compare to Justin's patch.
Comment #39
chx CreditAttribution: chx commentedAnd totally yes to #37 let's get this moving! I totally approve of the RTBC with the renames I added (which are in a test, anyways).
Comment #41
alexpott#38: 1741804_38.patch queued for re-testing.
Comment #43
chx CreditAttribution: chx commentedWeird. I get no fails. Here it is again.
Comment #44
alexpott+1 for this patch...
Comment #45
webchickAwesome!
This patch is pretty straight-forward. It changes from one config directory to two and as such ends up making a bunch of adjustments throughout the system that remove the assumption that there's only one.
The only thing I really don't like is that the distinction between CONFIG_ACTIVE_DIRECTORY and CONFIG_STAGING_DIRECTORY is not very intuitive; the names definitely need work. I don't think that's worth holding up the architecture fix, however, which is essential to moving forward on CMI. But we should either file a major/critical task specifically about revisiting the naming, or not close #1703168: [Meta] Ensure that configuration system functionality matches expected workflows for users and devs (which is already a critical task) until this is done. I have a feeling the naming discussion will be easier once more of the CMI work is completed, so I don't mind holding off on that for a few more patches.
Committed and pushed to 8.x. ROCK!