Uninstalling the Rules module removes all settings visible in the Rules config but the cache_rules tables does not get flushed and will not be removed. Flushing caches via Drush and Devel do not fix it. The database table remains and the set up rule fires. Reenabling Rules leaves the settings visually resetted (no config items) but the rules in cache still fire. Starting to set up a new rule with the same name then the old one, opens the new rule already with the set up parts from the old one. This inconsistency makes it impossible to clean up Rules 100% and makes it hard to test and contribute to it.

Comments

diqidoq created an issue. See original summary.

jhalred’s picture

This issue is also in version 8.x-3.0-alpha3. Is there any work-around or manual fix I can use to clean up cache_rules? No matter what I've tries, the "ghost rules" still fire.

jhalred’s picture

I have found a way to delete the "ghost rules" so I can at least remove rules I don't want and make modifications. This works for me in version 8.x-3.0-alpha3:
1. delete the rule(s) using the drupal interface
2. go to the cache_rule(s) table in phpmyadmin
3. select and delete the rule(s)
4. create a new rule using the drupal interface

The steps above got me out of the "ghost rules" jam.

docans’s picture

What solution do you have for those without phpmyadmin. I am using Docksal as my dev environment. Its really sad how Rules is acting in drupal 8

StevenPatz’s picture

Going to tackle this, this weekend.

TR’s picture

Could this be due to #2852231: Cache bin doesn't follow the naming convention? Core would normally clear the module's cache when uninstalling, but since Rules doesn't name its cache properly ...

Can you test out the patch in that issue to see if it resolves this one too?

TR’s picture

Status: Active » Postponed (maintainer needs more info)

@StevenPatz: Did you get a chance to work on this? #2852231: Cache bin doesn't follow the naming convention has been committed, so maybe it fixed this as well?

StevenPatz’s picture

@TR Busy holiday season. I can look at this, this weekend.

StevenPatz’s picture

Status: Postponed (maintainer needs more info) » Active

Looks like this is resolved now. I installed the Rules module, created a rule and then uninstalled the Rules module. Cleared the Drupal cache and reinstalled the Rules module and there were no rules listed.

TR’s picture

Status: Active » Fixed

@StevenPatz: Thanks for looking into it!

I have tried to reproduce the original report with the current 8.x-3.x-dev, and I can confirm that the cache_rules table does get removed now when Rules is uninstalled, and there doesn't seem to be any Rules data left in the database. I'm going to assume #2852231: Cache bin doesn't follow the naming convention fixed the issue.

I'm marking this as fixed, but if the problem re-occurs in 8.x-3.x-dev feel free to reopen the issue and provide instructions to reproduce the error.

Status: Fixed » Closed (fixed)

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