CMS  Version 3.9
ScheduledTask Class Reference

Inherits DataItem.

Public Member Functions

 LogEntries ($constraint="")
 
 LastRun ()
 
 run ()
 

Static Public Member Functions

static getInstance ($component, $task_name)
 

Public Attributes

 $table = "scheduled_task"
 
 $primary_key = "task_id"
 
 $fields
 
 $relations
 

Detailed Description

Definition at line 7 of file scheduled_task.inc.

Member Function Documentation

◆ getInstance()

static ScheduledTask::getInstance (   $component,
  $task_name 
)
static

Definition at line 27 of file scheduled_task.inc.

28  {
29  return Query::create(ScheduledTask, "WHERE component=:c AND task_name=:t")
30  ->bind(":c", $component, ":t", $task_name)
31  ->executeSingle();
32  }
$component
Definition: help.inc:38

◆ LastRun()

ScheduledTask::LastRun ( )

Definition at line 34 of file scheduled_task.inc.

35  {
36  if ($this->_lastRun) return $this->_lastRun;
37  $lastRun = $this->LogEntries("ORDER BY log_date DESC limit 1");
38  $this->_lastRun = $lastRun;
39  return $lastRun;
40  }
LogEntries($constraint="")

◆ LogEntries()

ScheduledTask::LogEntries (   $constraint = "")

Definition at line 22 of file scheduled_task.inc.

23  {
24  return $this->getRelatedList(ScheduledTaskLogEntry, "", $constraint);
25  }
$constraint

◆ run()

ScheduledTask::run ( )

Definition at line 42 of file scheduled_task.inc.

43  {
44  $mgr = new ScheduledTaskManager();
45  $mgr->executeTask($this->component, $this->task_name);
46  }
Manages scheduled task registration and execution.

Member Data Documentation

◆ $fields

ScheduledTask::$fields
Initial value:
= array("task_id" => Number,
"component" => String,
"task_name" => String,
"run_every_hour" => Boolean,
"schedule" => TaskSchedule,
"active" => Boolean)

Definition at line 12 of file scheduled_task.inc.

◆ $primary_key

ScheduledTask::$primary_key = "task_id"

Definition at line 10 of file scheduled_task.inc.

◆ $relations

ScheduledTask::$relations
Initial value:
= array("LogEntries" => ScheduledTaskLogEntry,
"LastRun" => ScheduledTaskLogEntry)

Definition at line 19 of file scheduled_task.inc.

◆ $table

ScheduledTask::$table = "scheduled_task"

Definition at line 9 of file scheduled_task.inc.


The documentation for this class was generated from the following file: