"Error: Class 'Civi\ConfigItems\CiviRulesCompilerPass' not found" with latest CiviRules
I've been receiving this error on just one site consistently, though I experienced it on multiple sites on first upgrade to the version that included the configitems integration. On most sites, deleting CiviRules, deleting templates_c
, and restoring CiviRules did the trick.
I'm not sure this is a CiviRules bug and not a core bug; I saw some chatter about issues with the order in which items loaded during the Civi boot process. Nevertheless, I imagine others looking for a solution will come here first.
For now, I've made the following change, though I doubt it makes sense as a long-term solution:
diff --git a/sites/all/civicrm/extensions/org.civicoop.civirules/civirules.php b/sites/all/civicrm/extensions/org.civicoop.civirules/civirules.php
index 716368f444..c53cd2a86d 100644
--- a/sites/all/civicrm/extensions/org.civicoop.civirules/civirules.php
+++ b/sites/all/civicrm/extensions/org.civicoop.civirules/civirules.php
@@ -18,7 +18,9 @@
* @throws \CRM_Core_Exception
*/
function civirules_civicrm_container(\Symfony\Component\DependencyInjection\ContainerBuilder $container) {
- $container->addCompilerPass(new \Civi\ConfigItems\CiviRulesCompilerPass());
+ if (class_exists('\Civi\ConfigItems\CiviRulesCompilerPass')) {
+ $container->addCompilerPass(new \Civi\ConfigItems\CiviRulesCompilerPass());
+ }
if (version_compare(CRM_Utils_System::version(), '5.34', '>=')) {
// Add the symfony listeners.
// We can do this after CiviCRM 5.34 because we need the eventID parameter on the