function rules_execute_rule in Rules 6
Execution handler for rules
1 string reference to 'rules_execute_rule'
- rules_elements in rules/
rules.module - Implementation of hook_elements() Defines default values for all available properties of rules's element types
File
- rules/
rules.module, line 404 - Rules engine module
Code
function rules_execute_rule(&$element, &$state) {
if ($element['#active'] && !$element['#recursion'] && rules_log_rule_is_evaluated($element)) {
rules_log(t('Not executing the rule "@name" on rule set "@set" to prevent recursion.', array(
'@name' => $element['#label'],
'@set' => $state['set_info']['label'],
)));
// Remember this, so the recursion count is still positive after this evaluation.
rules_log_evaluated_rule($element);
}
else {
if ($element['#active']) {
rules_log(t('Executing the rule "@name" on rule set "@set"', array(
'@name' => $element['#label'],
'@set' => $state['set_info']['label'],
)));
// Remember that we are processing this rule to prevent recursion
rules_log_evaluated_rule($element);
$result = rules_evaluate_elements($element['#conditions'], $state);
if ($result) {
rules_evaluate_elements($element['#actions'], $state);
}
}
}
// Return true, so that the next rules are evaluated too
return TRUE;
}