2 // $Id: rules_scheduler.module,v 1.1.2.4 2009/04/19 15:03:43 fago Exp $
6 * @file Rules scheduler module
10 * Implementation of hook_cron().
12 function rules_scheduler_cron() {
13 // Do max 30 rule sets
14 //TODO: make this configureable
15 $result = db_query_range("SELECT * FROM {rules_scheduler} WHERE date < '%s'", gmdate('Y-m-d H:i:s'), 0, 30);
17 while ($row = db_fetch_object($result)) {
18 rules_include('rules');
19 $vars = rules_unpack_variables(unserialize($row->arguments));
22 // Invoke the rule set
23 $args = $vars['data'];
24 array_unshift($args, $row->set_name);
25 call_user_func_array('rules_invoke_rule_set', $args);
27 db_query("DELETE FROM {rules_scheduler} WHERE tid = %d", $row->tid);