- disable rules when dependent modules are disabled, and enable them again afterwards
- mark rules as broken so the UI can properly deal with them (mark them, but don't deal with them. show missing dependency.)
- allow deleting broken rules

Should we deal with rules that have a failing integrity-check similarly?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

klausi’s picture

Component: Rules Core » Rules Engine
Status: Active » Needs review
FileSize
7.93 KB

Here is a patch:
* Adds a rules_dependencies table to track dependencies
* Adds a db column "dirty" to rules_config to track broken configurations
* Adds a "dependencies" property to Rules configurations on load
* uses hook_modules_disable/enable() to update the "dirty" flag
* Adds a RulesDependencyException

TODO:
* Mark configs as dirty during execution
* Don't execute dirty configurations
* Display dirty configurations properly in the UI
* Tests

klausi’s picture

Some progress, but I'm not sure if this is the right way.
integrityCheck() now sets the dirty flag. Reaction rules that execute a dirty component are now marked as dirty, too.

TODO:
* how many dirty states do we need? only one?
* all other TODOs from above

fago’s picture

+        'description' => 'Indicates broken configurations. 0 = OK, 1 = missing dependency, 2 = failed integrity check.',

Let's use a single dirty state + have exceptions tell why it is dirty when integrityCheck() is called. With the dependencies() information now loaded into the entity object, this approach should be good to go.

Perhaps we should clean up the exception handling first though.

fago’s picture

FileSize
23.88 KB

ok, I finished the patch + added tests. Works for me.

Todo: Implement UI changes, i.e. show in the admin UI when rules are failing, including the error message.

fago’s picture

Status: Needs review » Fixed

ok, I've improved the UI to work better for configurations having error + added in displaying of error messages.

Attached patch works for me -> committed.

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