TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
Scheduler Class Reference
Inheritance diagram for Scheduler:
SingletonInterface

Public Member Functions

 __construct ()
 
 addTask (Task\AbstractTask $task)
 
 executeTask (Task\AbstractTask $task)
 
 removeTask (Task\AbstractTask $task)
 
 saveTask (Task\AbstractTask $task)
 
 fetchTaskRecord ($uid)
 
 isValidTaskObject ($task)
 
 log ($message, $status=0, $code= 'scheduler')
 

Public Attributes

 $extConf = []
 

Protected Member Functions

 cleanExecutionArrays ()
 

Detailed Description

TYPO3 Scheduler. This class handles scheduling and execution of tasks. Formerly known as "Gabriel TYPO3 arch angel"

Definition at line 28 of file Scheduler.php.

Constructor & Destructor Documentation

__construct ( )

Constructor, makes sure all derived client classes are included

Returns

Definition at line 40 of file Scheduler.php.

References $GLOBALS, and Scheduler\cleanExecutionArrays().

Member Function Documentation

addTask ( Task\AbstractTask  $task)

Adds a task to the pool

Parameters
Task\AbstractTask$taskThe object representing the task to add
Returns
bool TRUE if the task was successfully added, FALSE otherwise

Definition at line 60 of file Scheduler.php.

References $fields, $GLOBALS, and GeneralUtility\makeInstance().

cleanExecutionArrays ( )
protected

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

Todo:
find a way to actually kill the job
Returns
void

Definition at line 94 of file Scheduler.php.

References $GLOBALS, and GeneralUtility\makeInstance().

Referenced by Scheduler\__construct().

executeTask ( Task\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

Parameters
Task\AbstractTask$taskThe task to execute
Returns
bool Whether the task was saved successfully to the database or not
Exceptions
FailedExecutionException
Exception

Definition at line 151 of file Scheduler.php.

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

Parameters
int$uidPrimary key of the task to get
Returns
array Database record for the task
See also
::fetchTask()
Exceptions
OutOfBoundsException

Definition at line 359 of file Scheduler.php.

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.

Parameters
object$taskThe object to test
Returns
bool TRUE if object is a task, FALSE otherwise

Definition at line 433 of file Scheduler.php.

log (   $message,
  $status = 0,
  $code = 'scheduler' 
)

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

Parameters
string$messageThe message to write to the log
int$statusStatus (0 = message, 1 = error)
mixed$codeKey for the message
Returns
void

Definition at line 447 of file Scheduler.php.

removeTask ( Task\AbstractTask  $task)

Removes a task completely from the system.

Todo:
find a way to actually kill the existing jobs
Parameters
Task\AbstractTask$taskThe object representing the task to delete
Returns
bool TRUE if task was successfully deleted, FALSE otherwise

Definition at line 224 of file Scheduler.php.

saveTask ( Task\AbstractTask  $task)

Updates a task in the pool

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

Definition at line 246 of file Scheduler.php.

Member Data Documentation

$extConf = []

Definition at line 33 of file Scheduler.php.