Active
Project:
Configuration Split
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Apr 2021 at 19:28 UTC
Updated:
18 Dec 2024 at 18:31 UTC
Jump to comment: Most recent
Comments
Comment #2
liquidcms commentedAfter thinking about this i am guessing it isn't possible to override/hook into existing drush commands; and CS likely just needs to have it's own cex command.
Another issue i see with existing cex command is that, too my surprise and delight, i see that if i select a module in the Complete section of split; what i thought it was doing was simply including all the configs associated with that module; but it also enables that module for that environment and then removes it from the global "enabled modules" config: core.extensions.
After doing this and then doing a cex, it lists the only config file to be written as the config.split for that environment; but although it will also write out the new core.ext config into global sync folder; that is not listed as being written (of course when i go to commit the file; i see it has been changed).
Comment #3
liquidcms commentedComment #4
bircherYes modules can hook into drush command invocations in several places.
Notably before or after the method of the drush command is invoked.
So we could add some message before the normal drush config-export.
Note though that the output of the drush command depends on the arguments and options that are passed to it, so we would have to check those and update our code when drush does.
In addition it is worth of note that the core drush command will print what goes in the sync directory.
So maybe instead of hooking into the drush command and force all users of config split to get that message, we could add a new drush command that lists what is different in all active splits. Then those who want to know can run this drush command and we can use the same code also in the
config-split:exportcommand to emulate the core export including adding a diff preview etc.Comment #5
liquidcms commentedsure, i have no issue with a separate drush command (I think that was my original or 2nd title). Not sure anyone specifically doesnt want to know that changes they just made aren't going to be exported to sync when they thought they were; but if separate command for showing both what is going to sync and what is going elsewhere is good... as long as not 2 commands... one to go to sync and one to go to local.
I guess hand in hand with this might be a the ability to force as if you were in a different environment; but that might be dangerous... as you really should swith to that environment, import for that environment first.. before exporting.
but if hooking is allowed; not sure why modification of this table:
to simply add another column, wouldnt be the easiest and more clear way to go.
Comment #6
bircherWell, the drush command with drush 10 and config_split 2.x or with config_filter 2.x only shows what goes in the sync directory. So if you made a change to a config which is going to a split then you wouldn't see that in the normal drush command.
And about the hook, I don't know if we can edit the table. we can print stuff before it for sure and maybe after it.
But in any case I would rather have our own.
We are going to have a command to enable and disable splits too and they could also display a diff with a similar table etc.
And if you want the split to be included in the normal drush command (under the collection column) then you can just switch to using the collection storage which will be added in #3167216: Allow split in collection
Comment #7
pfructuoso commentedThis suggestion from @niteman can be useful here
drush ev 'foreach (\Drupal::configFactory()->listAll("config_split.config_split") as $name) { print_r($name . ": " . \Drupal::configFactory()->get($name)->get("status") . "\n");};'