class RulesSchedulerDefaultTaskHandler in Rules 7.2
Default scheduled task handler.
Hierarchy
- class \RulesSchedulerDefaultTaskHandler implements RulesSchedulerTaskHandlerInterface
Expanded class hierarchy of RulesSchedulerDefaultTaskHandler
1 string reference to 'RulesSchedulerDefaultTaskHandler'
- rules_scheduler_task_handler in rules_scheduler/
rules_scheduler.module - Returns the task handler for a given task.
File
- rules_scheduler/
includes/ rules_scheduler.handler.inc, line 11 - Views integration for the rules scheduler module.
View source
class RulesSchedulerDefaultTaskHandler implements RulesSchedulerTaskHandlerInterface {
/**
* The task array.
*
* @var array
*/
protected $task;
/**
* Constructs a repetitive task handler object.
*/
public function __construct(array $task) {
$this->task = $task;
}
/**
* Implements RulesSchedulerTaskHandlerInterface::runTask().
*/
public function runTask() {
if ($component = rules_get_cache('comp_' . $this->task['config'])) {
$replacements = array(
'%label' => $component
->label(),
'%plugin' => $component
->plugin(),
);
$replacements['%identifier'] = $this->task['identifier'] ? $this->task['identifier'] : t('without identifier');
rules_log('Scheduled evaluation of %plugin %label, task %identifier.', $replacements, RulesLog::INFO, $component, TRUE);
$state = unserialize($this->task['data']);
$state
->restoreBlocks();
// Block the config to prevent any future recursion.
$state
->block($component);
// Finally evaluate the component with the given state.
$component
->evaluate($state);
$state
->unblock($component);
rules_log('Finished evaluation of %plugin %label, task %identifier.', $replacements, RulesLog::INFO, $component, FALSE);
$state
->cleanUp();
}
}
/**
* Implements RulesSchedulerTaskHandlerInterface::afterTaskQueued().
*/
public function afterTaskQueued() {
// Delete the task from the task list.
db_delete('rules_scheduler')
->condition('tid', $this->task['tid'])
->execute();
}
/**
* Implements RulesSchedulerTaskHandlerInterface::getTask().
*/
public function getTask() {
return $this->task;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RulesSchedulerDefaultTaskHandler:: |
protected | property | The task array. | |
RulesSchedulerDefaultTaskHandler:: |
public | function |
Implements RulesSchedulerTaskHandlerInterface::afterTaskQueued(). Overrides RulesSchedulerTaskHandlerInterface:: |
|
RulesSchedulerDefaultTaskHandler:: |
public | function |
Implements RulesSchedulerTaskHandlerInterface::getTask(). Overrides RulesSchedulerTaskHandlerInterface:: |
|
RulesSchedulerDefaultTaskHandler:: |
public | function |
Implements RulesSchedulerTaskHandlerInterface::runTask(). Overrides RulesSchedulerTaskHandlerInterface:: |
1 |
RulesSchedulerDefaultTaskHandler:: |
public | function | Constructs a repetitive task handler object. |