class RulesSchedulerDefaultTaskHandler
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
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
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
RulesSchedulerDefaultTaskHandler::$task | protected | property | The task array. | ||
RulesSchedulerDefaultTaskHandler::afterTaskQueued | public | function | Implements RulesSchedulerTaskHandlerInterface::afterTaskQueued(). | Overrides RulesSchedulerTaskHandlerInterface::afterTaskQueued | |
RulesSchedulerDefaultTaskHandler::getTask | public | function | Implements RulesSchedulerTaskHandlerInterface::getTask(). | Overrides RulesSchedulerTaskHandlerInterface::getTask | |
RulesSchedulerDefaultTaskHandler::runTask | public | function | Implements RulesSchedulerTaskHandlerInterface::runTask(). | Overrides RulesSchedulerTaskHandlerInterface::runTask | 1 |
RulesSchedulerDefaultTaskHandler::__construct | public | function | Constructs a repetitive task handler object. |