‪TYPO3CMS  11.5
TYPO3\CMS\Scheduler\Scheduler Class Reference
Inheritance diagram for TYPO3\CMS\Scheduler\Scheduler:

Public Member Functions

 __construct (LoggerInterface $logger)
bool addTask (AbstractTask $task)
bool executeTask (AbstractTask $task)
 recordLastRun ($type='cron')
bool removeTask (AbstractTask $task)
bool saveTask (AbstractTask $task)
Task AbstractTask null fetchTask ($uid=0)
array fetchTaskRecord ($uid)
array fetchTasksWithCondition ($where, $includeDisabledTasks=false)
bool isValidTaskObject ($task)
 log ($message, $status=0, $code='')

Public Attributes

array $extConf = array( )

Protected Member Functions

 cleanExecutionArrays ()

Protected Attributes

LoggerInterface $logger

Detailed Description

TYPO3 Scheduler. This class handles scheduling and execution of tasks.

Definition at line 32 of file Scheduler.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Scheduler\Scheduler::__construct ( LoggerInterface  $logger)

Constructor, makes sure all derived client classes are included

Definition at line 43 of file Scheduler.php.

References TYPO3\CMS\Scheduler\Scheduler\$logger, and TYPO3\CMS\Scheduler\Scheduler\cleanExecutionArrays().

Member Function Documentation

◆ addTask()

bool TYPO3\CMS\Scheduler\Scheduler::addTask ( AbstractTask  $task)

◆ cleanExecutionArrays()

TYPO3\CMS\Scheduler\Scheduler::cleanExecutionArrays ( )

Cleans the execution lists of the scheduled tasks, executions older than 24h are removed

‪find a way to actually kill the job

Definition at line 97 of file Scheduler.php.

References $GLOBALS, TYPO3\CMS\Scheduler\Scheduler\log(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Database\Connection\PARAM_STR.

Referenced by TYPO3\CMS\Scheduler\Scheduler\__construct().

◆ executeTask()

bool TYPO3\CMS\Scheduler\Scheduler::executeTask ( AbstractTask  $task)

This method executes the given task and properly marks and records that execution It is expected to return FALSE if the task was barred from running or if it was not saved properly

Task\AbstractTask$task‪The task to execute
‪bool Whether the task was saved successfully to the database or not

Definition at line 161 of file Scheduler.php.

◆ fetchTask()

Task AbstractTask null TYPO3\CMS\Scheduler\Scheduler::fetchTask (   $uid = 0)

Fetches and unserializes a task object from the db. If a uid is given the object with the uid is returned, else the object representing the next due task is returned. If there are no due tasks the method throws an exception.

int$uid‪Primary key of a task
Task\AbstractTask|null The fetched task object

Definition at line 311 of file Scheduler.php.

◆ fetchTaskRecord()

array TYPO3\CMS\Scheduler\Scheduler::fetchTaskRecord (   $uid)

This method is used to get the database record for a given task It returns the database record and not the task object

int$uid‪Primary key of the task to get
‪array Database record for the task
See also

Definition at line 392 of file Scheduler.php.

◆ fetchTasksWithCondition()

array TYPO3\CMS\Scheduler\Scheduler::fetchTasksWithCondition (   $where,
  $includeDisabledTasks = false 

Fetches and unserializes task objects selected with some (SQL) condition Objects are returned as an array

string$where‪Part of a SQL where clause (without the "WHERE" keyword)
bool$includeDisabledTasks‪TRUE if disabled tasks should be fetched too, FALSE otherwise
‪array List of task objects

Definition at line 421 of file Scheduler.php.

◆ isValidTaskObject()

bool TYPO3\CMS\Scheduler\Scheduler::isValidTaskObject (   $task)

This method encapsulates a very simple test for the purpose of clarity. Registered tasks are stored in the database along with a serialized task object. When a registered task is fetched, its object is unserialized. At that point, if the class corresponding to the object is not available anymore (e.g. because the extension providing it has been uninstalled), the unserialization will produce an incomplete object. This test checks whether the unserialized object is of the right (parent) class or not.

object$task‪The object to test
‪bool TRUE if object is a task, FALSE otherwise

Definition at line 470 of file Scheduler.php.

◆ log()

TYPO3\CMS\Scheduler\Scheduler::log (   $message,
  $status = 0,
  $code = '' 

This is a utility method that writes some message to the BE Log It could be expanded to write to some other log

string$message‪The message to write to the log
int$status‪Status (0 = message, 1 = error)
mixed$code‪Key for the message

Definition at line 483 of file Scheduler.php.

Referenced by TYPO3\CMS\Scheduler\Scheduler\cleanExecutionArrays().

◆ recordLastRun()

TYPO3\CMS\Scheduler\Scheduler::recordLastRun (   $type = 'cron')

This method stores information about the last run of the Scheduler into the system registry

string$type‪Type of run (manual or command-line (assumed to be cron))

Definition at line 220 of file Scheduler.php.

◆ removeTask()

bool TYPO3\CMS\Scheduler\Scheduler::removeTask ( AbstractTask  $task)

Removes a task completely from the system.

‪find a way to actually kill the existing jobs
Task\AbstractTask$task‪The object representing the task to delete
‪bool TRUE if task was successfully deleted, FALSE otherwise

Definition at line 239 of file Scheduler.php.

◆ saveTask()

bool TYPO3\CMS\Scheduler\Scheduler::saveTask ( AbstractTask  $task)

Updates a task in the pool

Task\AbstractTask$taskScheduler task object
‪bool False if submitted task was not of proper class

Definition at line 259 of file Scheduler.php.

Member Data Documentation

◆ $extConf

array TYPO3\CMS\Scheduler\Scheduler::$extConf = array( )

$extConf Settings from the extension manager

Definition at line 38 of file Scheduler.php.

◆ $logger

LoggerInterface TYPO3\CMS\Scheduler\Scheduler::$logger

Definition at line 34 of file Scheduler.php.

Referenced by TYPO3\CMS\Scheduler\Scheduler\__construct().