TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Scheduler\Scheduler Class Reference
Inheritance diagram for TYPO3\CMS\Scheduler\Scheduler:
TYPO3\CMS\Core\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 ()
 
 getDatabaseConnection ()
 

Detailed Description

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

Definition at line 26 of file Scheduler.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Scheduler\Scheduler::__construct ( )

Constructor, makes sure all derived client classes are included

Returns

Definition at line 38 of file Scheduler.php.

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

Member Function Documentation

◆ addTask()

TYPO3\CMS\Scheduler\Scheduler::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 58 of file Scheduler.php.

References $GLOBALS, and TYPO3\CMS\Scheduler\Scheduler\getDatabaseConnection().

◆ cleanExecutionArrays()

TYPO3\CMS\Scheduler\Scheduler::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 89 of file Scheduler.php.

References $GLOBALS, and TYPO3\CMS\Scheduler\Scheduler\getDatabaseConnection().

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

◆ executeTask()

TYPO3\CMS\Scheduler\Scheduler::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

Definition at line 133 of file Scheduler.php.

◆ fetchTaskRecord()

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

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

Definition at line 324 of file Scheduler.php.

◆ getDatabaseConnection()

TYPO3\CMS\Scheduler\Scheduler::getDatabaseConnection ( )
protected

◆ isValidTaskObject()

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.

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

Definition at line 388 of file Scheduler.php.

◆ log()

TYPO3\CMS\Scheduler\Scheduler::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 402 of file Scheduler.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger(), TYPO3\CMS\Core\Utility\CommandUtility\escapeShellArguments(), and TYPO3\CMS\Core\Utility\GeneralUtility\isFirstPartOfStr().

◆ removeTask()

TYPO3\CMS\Scheduler\Scheduler::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 209 of file Scheduler.php.

◆ saveTask()

TYPO3\CMS\Scheduler\Scheduler::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 229 of file Scheduler.php.

Member Data Documentation

◆ $extConf

TYPO3\CMS\Scheduler\Scheduler::$extConf = []

Definition at line 31 of file Scheduler.php.