Skip to main content
Expanding a bit.
Source Link
kenorb
  • 14.3k
  • 10
  • 98
  • 168

In order to revert, you need to remove a single component from the database, so the configuration from the code can be loaded instead.

So to revert a single rule, load the rule and delete it, e.g.

$rule = rules_config_load("my_rule");
$rule->delete();

This can be placed in hook_update().

Check Add drush rules-revert patch which provides such functionality for the drush command, e.g.

drush rules-revert my_rule

In addition, to revert all rules by not using Features module (which will take much quicker), you can try:

if ($rules = rules_config_load_multiple(FALSE)) {
  foreach($rules as $rule) {
    if ($rule->hasStatus(ENTITY_OVERRIDDEN) && !$rule->hasStatus(ENTITY_FIXED)) {
      $rule->delete();
    }
  }
}

So by deleting the rules from the database, they're loaded from the code.

In order to revert, you need to remove a single component from the database, so the configuration from the code can be loaded instead.

So to revert a single rule, load the rule and delete it, e.g.

$rule = rules_config_load("my_rule");
$rule->delete();

This can be placed in hook_update().

Check Add drush rules-revert patch which provides such functionality for the drush command, e.g.

drush rules-revert my_rule

In order to revert, you need to remove a single component from the database, so the configuration from the code can be loaded instead.

So to revert a single rule, load the rule and delete it, e.g.

$rule = rules_config_load("my_rule");
$rule->delete();

This can be placed in hook_update().

Check Add drush rules-revert patch which provides such functionality for the drush command, e.g.

drush rules-revert my_rule

In addition, to revert all rules by not using Features module (which will take much quicker), you can try:

if ($rules = rules_config_load_multiple(FALSE)) {
  foreach($rules as $rule) {
    if ($rule->hasStatus(ENTITY_OVERRIDDEN) && !$rule->hasStatus(ENTITY_FIXED)) {
      $rule->delete();
    }
  }
}

So by deleting the rules from the database, they're loaded from the code.

Source Link
kenorb
  • 14.3k
  • 10
  • 98
  • 168

In order to revert, you need to remove a single component from the database, so the configuration from the code can be loaded instead.

So to revert a single rule, load the rule and delete it, e.g.

$rule = rules_config_load("my_rule");
$rule->delete();

This can be placed in hook_update().

Check Add drush rules-revert patch which provides such functionality for the drush command, e.g.

drush rules-revert my_rule