Problem/Motivation
Configuration Synchronizer uses the config_sync.snapshot_extension_storage service to take a snapshot of extension-provided configuration as last installed. We use this snapshot to determine what updates are available. The snapshot should always reflect the last imported state, whether that is the configuration as originally installed or as updated with Configuration Synchronizer.
Currently we use an all or nothing approach to refresh the snapshot. We import every available update and so refresh all of our snapshots. See ConfigSyncImport::finishBatch().
In #2800321: Allow limiting updates by extension we're trying to enable more nuanced import. Do do so, however, we need to be able to selectively refresh only what is imported.
We need an appropriate event to respond to. We are using ConfigImporter to do our imports. ConfigImporter calls Config::save(), which invokes ConfigEvents::SAVE. However, this event is invoked every time a config item is saved--for example, through the UI, or through core's configuration staging system. We don't want to refresh the snapshot in those instances, because we haven't imported from the extension.
Proposed resolution
We need a way to provide and trigger own event. A possible approach:
- Provide a custom class extending Event. This could be similar to ConfigRevertEvent in the Configuration Update Manager module. Also provide an events class similar to ConfigEvents, though we may need only a single event.
- Provide our own class extending
ConfigImporter, overriding::importConfig()to invoke our custom config event. - In our ConfigSyncImport, include our own version of ConfigImporter as ConfigImporter so that it will be used in
ConfigSync::submitForm().
With that in place:
- Register a listener to our custom event.
- In the listener, delete the specific config item from the
config_sync.snapshot_extension_storagestorage.
Because ConfigSyncSnapshotter::refreshSnapshot() is a costly operation, we don't want to refresh on each deletion. Instead:
- Register a listener to ConfigEvents::IMPORT.
- In the listener, call
ConfigSyncSnapshotter::refreshSnapshot().
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | config_sync-refresh-2804955-7.patch | 3.55 KB | nedjo |
Comments
Comment #2
nedjoComment #3
nedjoComment #4
nedjoComment #5
nedjoComment #6
nedjoComment #7
nedjoRoughing in some first steps, untested.
Comment #8
nedjoComment #9
nedjoAfter refactoring in 8.x-2.x, this is no longer relevant.