Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I noticed that when I tried to clear the Rules cache manually by calling \Drupal::cache('rules'), I get a PHP error.
Rules currently defines a rules.cache
cache bin service. From the Cache Bins API page, it looks like module's should define their own cache bins using the cache.nameofbin
scheme and a number of cache functions assume that bins are declared in this way by prefixing the bin argument with cache.
.
Comment | File | Size | Author |
---|---|---|---|
#2 | rename-cache-bin-2852231-2.patch | 1.11 KB | Devin Carlson |
Comments
Comment #2
Devin Carlson CreditAttribution: Devin Carlson commentedThe attached patch renames the current cache bin to match the standards.
Comment #4
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedHi Devin Carlson,
The error in the tests:
PHPUnit_Framework_Exception: Fatal error: Class Drupal\rules\Ui\RulesUiDefinition contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Drupal\Component\Plugin\Definition\PluginDefinitionInterface::id, Drupal\Component\Plugin\Definition\PluginDefinitionInterface::getProvider) in /var/www/html/modules/contrib/rules/src/Ui/RulesUiDefinition.php on line 146
is unrelated to your patch change. I am getting exactly the same error in the Rules tests for Scheduler 8.x testing where we implement Rules conditions, actions and events and test them.I first noticed this fault on 3rd Feb, and it fails at Core 8.4 and 8.3, however the same tests pass at core 8.2. They were all passing OK on 21st Dec 2016, so I guess something changed between those dates (whether in Core or in Rules, I don't know) but we now have a more strict checking on classes and definitions, and Rules module needs to be fixed as in the message text above.
I have raised a Scheduler issue #2851618: Rules automated tests fail at D8.3 and 8.4 to allow us to track the problem, and maybe implement a temporary fix to not run our Rules tests for the time being, as this fault is affecting every test run and hence every patch we try to test.
Jonathan
[Scheduler module maintainer]
Comment #5
TR CreditAttribution: TR commentedI retested, and the tests are now passing.
Comment #6
TR CreditAttribution: TR commentedI confirmed the information about cache naming, see https://api.drupal.org/api/drupal/core%21core.api.php/group/cache/8.5.x. Also see core.services.yml for the way all other cache bins are named.
Patch still applies, tests pass, and this patch allows the rules cache to be programmatically cleared.
Comment #8
fagothx, committed and pushed.