TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Scheduler\Scheduler Class Reference
Inheritance diagram for TYPO3\CMS\Scheduler\Scheduler:
TYPO3\CMS\Core\SingletonInterface tx_scheduler

Public Member Functions

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

Public Attributes

 $extConf = array()
 

Protected Member Functions

 cleanExecutionArrays ()
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! TYPO3 Scheduler. This class handles scheduling and execution of tasks. Formerly known as "Gabriel TYPO3 arch angel"

Author
François Suter franc.nosp@m.ois@.nosp@m.typo3.nosp@m..org
Christian Jul Jensen julle.nosp@m.@typ.nosp@m.o3.or.nosp@m.g

Definition at line 23 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 36 of file Scheduler.php.

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

Member Function Documentation

◆ addTask()

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

Adds a task to the pool

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

Definition at line 55 of file Scheduler.php.

References $GLOBALS, and $result.

◆ 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 85 of file Scheduler.php.

References $GLOBALS.

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

◆ executeTask()

TYPO3\CMS\Scheduler\Scheduler::executeTask ( \TYPO3\CMS\Scheduler\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
\TYPO3\CMS\Scheduler\Task\AbstractTask$taskThe task to execute
Returns
boolean Whether the task was saved successfully to the database or not

Definition at line 124 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
integer$uidPrimary key of the task to get
Returns
array Database record for the task
See also
tx_scheduler::fetchTask()

Definition at line 305 of file Scheduler.php.

◆ 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
boolean TRUE if object is a task, FALSE otherwise

Definition at line 365 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
integer$statusStatus (0 = message, 1 = error)
mixed$codeKey for the message
Returns
void

Definition at line 378 of file Scheduler.php.

References $GLOBALS, and $registry.

◆ removeTask()

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

Removes a task completely from the system. TODO: find a way to actually kill the existing jobs

Parameters
\TYPO3\CMS\Scheduler\Task\AbstractTask$taskThe object representing the task to delete
Returns
boolean TRUE if task was successfully deleted, FALSE otherwise

Definition at line 197 of file Scheduler.php.

◆ saveTask()

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

Updates a task in the pool

Parameters
\TYPO3\CMS\Scheduler\Task\AbstractTask$taskScheduler task object
Returns
boolean False if submitted task was not of proper class

Definition at line 216 of file Scheduler.php.

Member Data Documentation

◆ $extConf

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

Definition at line 29 of file Scheduler.php.