Problem/Motivation

Our use case is, that we have 3 splits: develop, test, live. On the live website, only the latter is active. In the local dev environment, only the first one is active.

Occasionally, we have to import the live DB into the local environment, e.g. to export all config to ensure that we have the latest in git.

We control the active state of each environment with variables in settings.php, so locally develop is active and live is inactive.

After the DB import, we run drush -y config-split:import develop which enables all components from that environment.

What's missing is to disable all the components from the live environment. This would be happening with a drush config:import, but that would override all the potential changes to config in the DB. The other way round, i.e. drush config:export doesn't work either, because that enables all the live-only modules in the main config outside of any split, because those modules are enabled but the live split is inactive due to the settings.php variables.

What would give us the correct result is to run drush config-split:deactivate live, as it would disable those modules and delete the config entities from e.g. complete_list. However, that command exits, because it gets the status that live is already inactive.

Proposed resolution

Adding an option --force would solve this problem, i.e. disabling that environment regardless of its current status.

I'd be happy to contribute the relevant code. It shouldn't be too complex.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jurgenhaas created an issue. See original summary.

jurgenhaas’s picture

As I'm looking at the code, it seems that most of this is already implemented, since \Drupal\config_split\ConfigSplitManager::singleDeactivate already accepts the $override variable which defaults to FALSE. When using TRUE there, this already works as intended above.

So, the optional argument should probably be called --override instead of --force.

jurgenhaas’s picture

Status: Active » Needs review

This is only a couple of lines and works like a charm.

bircher made their first commit to this issue’s fork.

bircher’s picture

Status: Needs review » Fixed

I think --force would be ok too..

Thanks for you contribution

jurgenhaas’s picture

Thank you, that's nice to get this recognized so quickly.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.