You are here

function rules_evaluate_rule_set in Rules 6

Evaluates the configured rules for the given rule set and evaluation state. This is used, when rule sets are invoked by action. So the action can set up a new state, working with the same variables. So the original execution state can take over variable saving.

Parameters

$set_name The name of the rule set to invoke:

$set The rule set, as returned from rules_get_rule_set().:

$state The evaluation state.:

$skip_save An optional array of names of variables, for which saving should: be skipped.

2 calls to rules_evaluate_rule_set()
rules_action_invoke_set in rules/modules/rules.rules.inc
Base action implementation for invoking all rule sets.
rules_invoke_rule_set in rules/rules.module
Invokes configured rules for the given rule set

File

rules/rules.module, line 296
Rules engine module

Code

function rules_evaluate_rule_set($set_name, $set, &$state, $skip_save = array()) {
  _rules_log_set_invocation(t('"@label" has been invoked.', array(
    '@label' => $state['set_info']['label'],
  )), TRUE);
  rules_evaluate_elements($set['rules'], $state);
  foreach ($state['variables'] as $name => $variable) {
    if (!in_array($name, $skip_save)) {
      $variable
        ->save_changes();
    }
  }
  rules_log_evaluation_clear($set_name);
  _rules_log_set_invocation(t('Evaluation of "@label" has been finished.', array(
    '@label' => $state['set_info']['label'],
  )), FALSE);
}