Followup to #2090115: Don't install a module when its default configuration has unmet dependencies
The config importer changes the source source used by the config installer so that configuration is read from the staging directory during module install during a configuration import. This is done by setting the storage on the config installer. The module installer then gets this and sets it again after every module enable because enabling modules rebuilds the container. Since the module installer is persisted through module installs the config importer sure set something on the module installer to use the alternative config storage and then we can simplify the config installer.
This is a bug because the config installer is re-entrant. If a language is created during an install then during the config save event the config installer is called to create any language config overrides.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2451365.2.patch | 17.21 KB | alexpott |
Comments
Comment #1
alexpottComment #2
alexpottPatch attached completely removes the global state used to maintain the sync status in the ConfigInstaller during a module installation.
Comment #3
alexpottThis is a pretty big change but I think it is extremely beneficial since it ensures that people writing hook_install() implementations should consider the fact that the code will run as part of a config sync.
Comment #4
mgiffordPatch no longer applies.
Comment #8
james.williams CreditAttribution: james.williams at ComputerMinds commentedI've just ran into an issue (#2852607-6: Error when importing core.extension.yml) where we discovered the ModuleInstaller was calling ConfigInstaller's public setSourceStorage method, which isn't in the ConfigInstallerInterface ... so I'd be in favour of this issue as it removes that problem too.
(Otherwise I'd create a ticket about adding setSourceStorage to the interface, but I think this wider issue around the global syncing state is more important.)
Comment #9
james.williams CreditAttribution: james.williams at ComputerMinds commentedI just started progress on a re-roll, but then realised that other parts of code still need to know about the syncing state. For example, see #2711645: ConfigInstaller::isSyncing() should return true always during a config sync - for that ticket, commerce needed to detect whether a config sync was in process during
hook_entity_bundle_create()
, which I don't think would be possible with this change?