TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Scheduler\Task\AbstractTask Class Reference
Inheritance diagram for TYPO3\CMS\Scheduler\Task\AbstractTask:
TYPO3\CMS\Extbase\Scheduler\Task TYPO3\CMS\Extensionmanager\Task\UpdateExtensionListTask TYPO3\CMS\Linkvalidator\Task\ValidatorTask TYPO3\CMS\Recycler\Task\CleanerTask TYPO3\CMS\Reports\Task\SystemStatusUpdateTask TYPO3\CMS\Saltedpasswords\Task\BulkUpdateTask TYPO3\CMS\Scheduler\Example\SleepTask TYPO3\CMS\Scheduler\Example\TestTask TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionTask TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask TYPO3\CMS\Scheduler\Task\FileStorageIndexingTask TYPO3\CMS\Scheduler\Task\IpAnonymizationTask TYPO3\CMS\Scheduler\Task\OptimizeDatabaseTableTask TYPO3\CMS\Scheduler\Task\RecyclerGarbageCollectionTask TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask TYPO3\CMS\Version\Task\AutoPublishTask TYPO3\CMS\Workspaces\Task\AutoPublishTask TYPO3\CMS\Workspaces\Task\CleanupPreviewLinkTask

Public Member Functions

 __construct ()
 
 execute ()
 
 getAdditionalInformation ()
 
 setTaskUid ($id)
 
 getTaskUid ()
 
 getTaskTitle ()
 
 getTaskDescription ()
 
 getTaskClassName ()
 
 isDisabled ()
 
 setDisabled ($flag)
 
 setExecutionTime ($timestamp)
 
 getTaskGroup ()
 
 setTaskGroup ($taskGroup)
 
 getExecutionTime ()
 
 setDescription ($description)
 
 getDescription ()
 
 setScheduler ()
 
 unsetScheduler ()
 
 setExecution (\TYPO3\CMS\Scheduler\Execution $execution)
 
 getExecution ()
 
 getNextDueExecution ()
 
 areMultipleExecutionsAllowed ()
 
 isExecutionRunning ()
 
 markExecution ()
 
 unmarkExecution ($executionID, \Exception $failure=null)
 
 unmarkAllExecutions ()
 
 save ()
 
 stop ()
 
 remove ()
 
 getType ()
 

Public Attributes

const TYPE_SINGLE = 1
 
const TYPE_RECURRING = 2
 

Protected Attributes

 $scheduler
 
 $taskUid
 
 $disabled = false
 
 $execution
 
 $executionTime = 0
 
 $description = ''
 
 $taskGroup
 

Detailed Description

This is the base class for all Scheduler tasks It's an abstract class, not designed to be instantiated directly All Scheduler tasks should inherit from this class

Definition at line 22 of file AbstractTask.php.

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ areMultipleExecutionsAllowed()

TYPO3\CMS\Scheduler\Task\AbstractTask::areMultipleExecutionsAllowed ( )

Returns TRUE if several runs of the task are allowed concurrently

Returns
bool TRUE if concurrent executions are allowed, FALSE otherwise

Definition at line 356 of file AbstractTask.php.

◆ execute()

TYPO3\CMS\Scheduler\Task\AbstractTask::execute ( )
abstract

This is the main method that is called when a task is executed It MUST be implemented by all classes inheriting from this one Note that there is no error handling, errors and failures are expected to be handled and logged by the client implementations. Should return TRUE on successful execution, FALSE on error.

Returns
bool Returns TRUE on successful execution, FALSE on error

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

◆ getAdditionalInformation()

TYPO3\CMS\Scheduler\Task\AbstractTask::getAdditionalInformation ( )

This method is designed to return some additional information about the task, that may help to set it apart from other tasks from the same class This additional information is used - for example - in the Scheduler's BE module This method should be implemented in most task classes

Returns
string Information to display

Definition at line 104 of file AbstractTask.php.

◆ getDescription()

TYPO3\CMS\Scheduler\Task\AbstractTask::getDescription ( )

This method returns the description of the task

Returns
string Description

Definition at line 243 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$description.

◆ getExecution()

TYPO3\CMS\Scheduler\Task\AbstractTask::getExecution ( )

Returns the execution object

Returns
The internal execution object

Definition at line 335 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$execution.

Referenced by TYPO3\CMS\Scheduler\Task\AbstractTask\getType().

◆ getExecutionTime()

TYPO3\CMS\Scheduler\Task\AbstractTask::getExecutionTime ( )

This method returns the timestamp corresponding to the next execution time of the task

Returns
int Timestamp of next execution

Definition at line 222 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$executionTime.

◆ getNextDueExecution()

TYPO3\CMS\Scheduler\Task\AbstractTask::getNextDueExecution ( )

Returns the timestamp for next due execution of the task

Returns
int Date and time of the next execution as a timestamp

Definition at line 345 of file AbstractTask.php.

◆ getTaskClassName()

TYPO3\CMS\Scheduler\Task\AbstractTask::getTaskClassName ( )

This method returns the class name of the scheduler task

Returns
string

Definition at line 155 of file AbstractTask.php.

◆ getTaskDescription()

TYPO3\CMS\Scheduler\Task\AbstractTask::getTaskDescription ( )

This method returns the description of the scheduler task

Returns
string

Definition at line 145 of file AbstractTask.php.

References $GLOBALS.

◆ getTaskGroup()

TYPO3\CMS\Scheduler\Task\AbstractTask::getTaskGroup ( )

This method returns the task group (uid) of the task

Returns
int Uid of task group

Definition at line 201 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$taskGroup.

◆ getTaskTitle()

TYPO3\CMS\Scheduler\Task\AbstractTask::getTaskTitle ( )

This method returns the title of the scheduler task

Returns
string

Definition at line 135 of file AbstractTask.php.

References $GLOBALS.

◆ getTaskUid()

TYPO3\CMS\Scheduler\Task\AbstractTask::getTaskUid ( )

This method returns the unique id of the task

Returns
int The id of the task

Definition at line 125 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$taskUid.

◆ getType()

TYPO3\CMS\Scheduler\Task\AbstractTask::getType ( )

Guess task type from the existing information If an interval or a cron command is defined, it's a recurring task

Returns
int

Definition at line 529 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\getExecution().

◆ isDisabled()

TYPO3\CMS\Scheduler\Task\AbstractTask::isDisabled ( )

This method returns the disable status of the task

Returns
bool TRUE if task is disabled, FALSE otherwise

Definition at line 165 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$disabled.

◆ isExecutionRunning()

TYPO3\CMS\Scheduler\Task\AbstractTask::isExecutionRunning ( )

Returns TRUE if an instance of the task is already running

Returns
bool TRUE if an instance is already running, FALSE otherwise

Definition at line 366 of file AbstractTask.php.

References $GLOBALS, and TYPO3\CMS\Scheduler\Task\AbstractTask\$taskUid.

◆ markExecution()

TYPO3\CMS\Scheduler\Task\AbstractTask::markExecution ( )

This method adds current execution to the execution list It also logs the execution time and mode

Returns
int Execution id

Definition at line 391 of file AbstractTask.php.

References $GLOBALS, and TYPO3\CMS\Scheduler\Task\AbstractTask\$taskUid.

◆ remove()

TYPO3\CMS\Scheduler\Task\AbstractTask::remove ( )

Removes the task totally from the system.

Returns
void

Definition at line 518 of file AbstractTask.php.

◆ save()

TYPO3\CMS\Scheduler\Task\AbstractTask::save ( )

◆ setDescription()

TYPO3\CMS\Scheduler\Task\AbstractTask::setDescription (   $description)

This method is used to set the description of the task

Parameters
string$descriptionDescription
Returns
void

Definition at line 233 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$description.

◆ setDisabled()

TYPO3\CMS\Scheduler\Task\AbstractTask::setDisabled (   $flag)

This method is used to set the disable status of the task

Parameters
bool$flagTRUE if task should be disabled, FALSE otherwise
Returns
void

Definition at line 176 of file AbstractTask.php.

Referenced by TYPO3\CMS\Saltedpasswords\Task\BulkUpdateTask\activateSelf(), and TYPO3\CMS\Saltedpasswords\Task\BulkUpdateTask\deactivateSelf().

◆ setExecution()

TYPO3\CMS\Scheduler\Task\AbstractTask::setExecution ( \TYPO3\CMS\Scheduler\Execution  $execution)

Sets the internal execution object

Parameters
\TYPO3\CMS\Scheduler\Execution$executionThe execution to add

Definition at line 325 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$execution.

◆ setExecutionTime()

TYPO3\CMS\Scheduler\Task\AbstractTask::setExecutionTime (   $timestamp)

This method is used to set the timestamp corresponding to the next execution time of the task

Parameters
int$timestampTimestamp of next execution
Returns
void

Definition at line 191 of file AbstractTask.php.

◆ setScheduler()

TYPO3\CMS\Scheduler\Task\AbstractTask::setScheduler ( )

Sets the internal reference to the singleton instance of the Scheduler

Returns
void

Definition at line 253 of file AbstractTask.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

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

◆ setTaskGroup()

TYPO3\CMS\Scheduler\Task\AbstractTask::setTaskGroup (   $taskGroup)

This method is used to set the task group (uid) of the task

Parameters
int$timestampUid of task group
Returns
void

Definition at line 212 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$taskGroup.

◆ setTaskUid()

TYPO3\CMS\Scheduler\Task\AbstractTask::setTaskUid (   $id)

This method is used to set the unique id of the task

Parameters
int$idPrimary key (from the database record) of the scheduled task
Returns
void

Definition at line 115 of file AbstractTask.php.

◆ stop()

TYPO3\CMS\Scheduler\Task\AbstractTask::stop ( )

Stops the task, by replacing the execution object by an empty one NOTE: the task still needs to be saved after that

Returns
void

Definition at line 508 of file AbstractTask.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ unmarkAllExecutions()

TYPO3\CMS\Scheduler\Task\AbstractTask::unmarkAllExecutions ( )

Clears all marked executions

Returns
bool TRUE if the clearing succeeded, FALSE otherwise

Definition at line 483 of file AbstractTask.php.

References $GLOBALS.

◆ unmarkExecution()

TYPO3\CMS\Scheduler\Task\AbstractTask::unmarkExecution (   $executionID,
\Exception  $failure = null 
)

Removes given execution from list

Parameters
int$executionIDId of the execution to remove.
\Exception$failureAn exception to signal a failed execution
Returns
void

Definition at line 431 of file AbstractTask.php.

References $GLOBALS, and TYPO3\CMS\Scheduler\Task\AbstractTask\$taskUid.

◆ unsetScheduler()

TYPO3\CMS\Scheduler\Task\AbstractTask::unsetScheduler ( )

Unsets the internal reference to the singleton instance of the Scheduler This is done before a task is serialized, so that the scheduler instance is not saved to the database too

Returns
void

Definition at line 265 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$execution, and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Member Data Documentation

◆ $description

TYPO3\CMS\Scheduler\Task\AbstractTask::$description = ''
protected

◆ $disabled

TYPO3\CMS\Scheduler\Task\AbstractTask::$disabled = false
protected

Definition at line 46 of file AbstractTask.php.

Referenced by TYPO3\CMS\Scheduler\Task\AbstractTask\isDisabled().

◆ $execution

◆ $executionTime

TYPO3\CMS\Scheduler\Task\AbstractTask::$executionTime = 0
protected

◆ $scheduler

TYPO3\CMS\Scheduler\Task\AbstractTask::$scheduler
protected

Definition at line 32 of file AbstractTask.php.

◆ $taskGroup

TYPO3\CMS\Scheduler\Task\AbstractTask::$taskGroup
protected

◆ $taskUid

◆ TYPE_RECURRING

const TYPO3\CMS\Scheduler\Task\AbstractTask::TYPE_RECURRING = 2

◆ TYPE_SINGLE