- Issue created by @ambient.impact
As a follow-up to
✨
Provide Drush command to enforce configs
Fixed
, we'd like to provide some kind of feedback when running Drush commands (such as drush cache:rebuild
) if we do a configuration enforcement (or don't because of maintenance mode).
Run drush cache:rebuild --verbose
See no mention of configuration being enforced or similar.
I reached out on the Drupal.org Slack and was pointed to the fact that Drush now supports adding custom loggers so that would be one way we could output stuff to console.
Another way would be to add a hook to the Drush cache rebuild command and output our console messages that way. This second method might be problematic if we just output a message without it checking that we did indeed do an enforce. One way around this would be to instead detect in places where we would do an enforce (e.g. \hook_rebuild()
) if we're running via Drush (preferably without requiring Drush as a dependency but just checking if a service is present or something like that) and not do the enforcement at all in that case; instead we run the enforcement in the Drush hooks we implement, e.g. drush cache:rebuild
, and output the console message that way; this ensures that if there's an error in enforcing preceding the message, we don't erroneously output something like "configuration was enforced" when it had in fact not been.
Move enforcement stuff and logging to services or otherwise abstract them so you provide where to output messages and just call a single thing, both from \hook_rebuild()
and drush cache:rebuild
.
TBD.
TBD.
TBD.
Active
1.0
User interface