Account for Config Overrides of config_ignore.settings

Created on 2 December 2024, 11 months ago

Problem/Motivation

We have a crazy multisite single codebase situation where we lock down what is ignored in all of our sites through a config override. This has worked for us when we install the our config_override system in our host and then uninstall the package when we pull our databases locally. We're moving to have this functionality always on; however, when we run drush cim in this new setup we are not ignoring everything that needs to be ignored.

I initially explored " Use ignore settings of the target storage if the config ignore config is ignored πŸ› Use ignore settings of the target storage if the config ignore config is ignored Needs work " as a possible solution; however, in trying to create a patch our situation appears to be different. Neither the $transformation_storage nor $destination_storage variables passed to the transformStorage() function in ConfigIgnoreEventSubscriber have values so we aren't using the target storage (yes, we are ignoring the config_ignore.settings as well in our override) which separates our issues from the above referenced issue.

Proposed resolution

Line 141 of the ConfigIgnoreEventSubscriber has the following:
if ($transformation_storage->exists('config_ignore.settings')) and this always results to true for us with our config setup.

Adding the following addresses this particular use case:

if (empty($destination_storage->getAllCollectionNames()) && empty($transformation_storage->getAllCollectionNames())) {
      $ignoreConfig = ConfigIgnoreConfig::fromConfig($this->configFactory->get('config_ignore.settings'));
    } elseif ($transformation_storage->exists('config_ignore.settings'))

Merge request to follow shortly.

@bircher - if this is a valid proposal, I'm still relatively new to Drupal coding and tests are one of my weaknesses. I understand that a test will be needed and I'd greatly appreciate a high level clue of how to create a test for this use case similar to this comment you made πŸ› Use ignore settings of the target storage if the config ignore config is ignored Needs work a few months ago which was extremely helpful for me to diagnose this issue.

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States pbabin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @pbabin
  • Pipeline finished with Failed
    11 months ago
    Total: 140s
    #356748
  • πŸ‡¨πŸ‡­Switzerland bircher πŸ‡¨πŸ‡Ώ

    I am unsure how to help you here.
    If neither of the storages have any data then clearly your event subscriber needs to have different priorities. Config Ignore can only ignore things it knows about, so if you want to use it you have to make sure it runs after the other transformations.

    However, I think maybe it is worth merging always (?) the active config (including config overrides) with the ones from the transformation storage. Or maybe just on a config import.. I think that this is one of the things people get confused by most. Maybe configurable with another $settings entry for power users.

Production build 0.71.5 2024