‪TYPO3CMS  9.5
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\Scheduler\Example\SleepTask TYPO3\CMS\Scheduler\Example\TestTask TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionTask TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandTask 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\Workspaces\Task\AutoPublishTask TYPO3\CMS\Workspaces\Task\CleanupPreviewLinkTask

Public Member Functions

 __construct ()
 
bool execute ()
 
string getAdditionalInformation ()
 
 setTaskUid ($id)
 
int getTaskUid ()
 
string getTaskTitle ()
 
string getTaskDescription ()
 
string getTaskClassName ()
 
bool isDisabled ()
 
 setDisabled ($flag)
 
 setRunOnNextCronJob ($flag)
 
bool getRunOnNextCronJob ()
 
 setExecutionTime ($timestamp)
 
int getTaskGroup ()
 
 setTaskGroup ($taskGroup)
 
int getExecutionTime ()
 
 setDescription ($description)
 
string getDescription ()
 
 setScheduler ()
 
 unsetScheduler ()
 
 registerSingleExecution ($timestamp)
 
 registerRecurringExecution ($start, $interval, $end=0, $multiple=false, $cron_cmd='')
 
 setExecution (Execution $execution)
 
Execution getExecution ()
 
int getNextDueExecution ()
 
bool areMultipleExecutionsAllowed ()
 
bool isExecutionRunning ()
 
int markExecution ()
 
 unmarkExecution ($executionID, \Throwable $failure=null)
 
bool unmarkAllExecutions ()
 
bool save ()
 
 stop ()
 
 remove ()
 
int getType ()
 

Public Attributes

const TYPE_SINGLE = 1
 
const TYPE_RECURRING = 2
 

Protected Member Functions

 logException (\Exception $e)
 

Protected Attributes

TYPO3 CMS Scheduler Scheduler $scheduler
 
int $taskUid
 
bool $disabled = false
 
bool $runOnNextCronJob = false
 
Execution $execution
 
int $executionTime = 0
 
string $description = ''
 
int $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 31 of file AbstractTask.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor

Reimplemented in TYPO3\CMS\Extbase\Scheduler\Task.

Definition at line 89 of file AbstractTask.php.

Member Function Documentation

◆ areMultipleExecutionsAllowed()

bool 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 381 of file AbstractTask.php.

◆ execute()

◆ getAdditionalInformation()

string 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

Reimplemented in TYPO3\CMS\Linkvalidator\Task\ValidatorTask, TYPO3\CMS\Extbase\Scheduler\Task, TYPO3\CMS\Scheduler\Task\IpAnonymizationTask, TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask, TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandTask, TYPO3\CMS\Recycler\Task\CleanerTask, TYPO3\CMS\Scheduler\Example\TestTask, TYPO3\CMS\Scheduler\Task\OptimizeDatabaseTableTask, and TYPO3\CMS\Scheduler\Example\SleepTask.

Definition at line 115 of file AbstractTask.php.

◆ getDescription()

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

This method returns the description of the task

Returns
‪string Description

Definition at line 269 of file AbstractTask.php.

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

◆ getExecution()

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

Returns the execution object

Returns
Execution The internal execution object

Definition at line 360 of file AbstractTask.php.

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

Referenced by TYPO3\CMS\Scheduler\Example\TestTask\execute(), and TYPO3\CMS\Scheduler\Task\AbstractTask\getType().

◆ getExecutionTime()

int 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 249 of file AbstractTask.php.

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

◆ getNextDueExecution()

int 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 370 of file AbstractTask.php.

◆ getRunOnNextCronJob()

bool TYPO3\CMS\Scheduler\Task\AbstractTask::getRunOnNextCronJob ( )

This method returns the run on next cron job status of the task

Returns
‪bool TRUE if task should run on next cron job, FALSE otherwise

Definition at line 209 of file AbstractTask.php.

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

◆ getTaskClassName()

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

This method returns the class name of the scheduler task

Returns
‪string

Definition at line 165 of file AbstractTask.php.

◆ getTaskDescription()

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

This method returns the description of the scheduler task

Returns
‪string

Definition at line 155 of file AbstractTask.php.

References $GLOBALS.

◆ getTaskGroup()

int 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 229 of file AbstractTask.php.

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

◆ getTaskTitle()

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

This method returns the title of the scheduler task

Returns
‪string

Definition at line 145 of file AbstractTask.php.

References $GLOBALS.

◆ getTaskUid()

int 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 135 of file AbstractTask.php.

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

◆ getType()

int 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 583 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\getExecution(), TYPO3\CMS\Scheduler\Task\AbstractTask\TYPE_RECURRING, and TYPO3\CMS\Scheduler\Task\AbstractTask\TYPE_SINGLE.

◆ isDisabled()

bool 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 175 of file AbstractTask.php.

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

◆ isExecutionRunning()

bool 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 391 of file AbstractTask.php.

◆ logException()

TYPO3\CMS\Scheduler\Task\AbstractTask::logException ( \Exception  $e)
protected
Parameters
\Exception$e

Definition at line 594 of file AbstractTask.php.

Referenced by TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\execute().

◆ markExecution()

int 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 417 of file AbstractTask.php.

References TYPO3\CMS\Core\Core\Environment\isCli(), and TYPO3\CMS\Core\Database\Connection\PARAM_LOB.

◆ registerRecurringExecution()

TYPO3\CMS\Scheduler\Task\AbstractTask::registerRecurringExecution (   $start,
  $interval,
  $end = 0,
  $multiple = false,
  $cron_cmd = '' 
)

Registers a recurring execution of the task

Parameters
int$start‪The first date/time where this execution should occur (timestamp)
string$intervalExecution interval in seconds
int$end‪The last date/time where this execution should occur (timestamp)
bool$multiple‪Set to FALSE if multiple executions of this task are not permitted in parallel
string$cron_cmd‪Used like in crontab (minute hour day month weekday)

Definition at line 324 of file AbstractTask.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\$execution, TYPO3\CMS\Scheduler\Execution\setCronCmd(), TYPO3\CMS\Scheduler\Execution\setEnd(), TYPO3\CMS\Scheduler\Execution\setInterval(), TYPO3\CMS\Scheduler\Execution\setMultiple(), and TYPO3\CMS\Scheduler\Execution\setStart().

◆ registerSingleExecution()

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

◆ remove()

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

Removes the task totally from the system.

Definition at line 572 of file AbstractTask.php.

◆ save()

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

Saves the details of the task to the database.

Returns
‪bool

Definition at line 555 of file AbstractTask.php.

Referenced by TYPO3\CMS\Linkvalidator\Task\ValidatorTask\execute(), and TYPO3\CMS\Linkvalidator\Task\ValidatorTask\reportEmail().

◆ setDescription()

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

This method is used to set the description of the task

Parameters
string$description‪Description

Definition at line 259 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$flag‪TRUE if task should be disabled, FALSE otherwise

Definition at line 185 of file AbstractTask.php.

◆ setExecution()

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

Sets the internal execution object

Parameters
Execution$execution‪The execution to add

Definition at line 350 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$timestamp‪Timestamp of next execution

Definition at line 219 of file AbstractTask.php.

◆ setRunOnNextCronJob()

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

This method set the flag for next cron job execution

Parameters
bool$flag‪TRUE if task should run with the next cron job, FALSE otherwise

Definition at line 199 of file AbstractTask.php.

◆ setScheduler()

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

Sets the internal reference to the singleton instance of the Scheduler and the logger instance in case it was unserialized

Definition at line 278 of file AbstractTask.php.

Referenced by TYPO3\CMS\Extbase\Scheduler\FieldProvider\getAdditionalFields(), and TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandAdditionalFieldProvider\getAdditionalFields().

◆ setTaskGroup()

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

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

Parameters
int$taskGroup‪Uid of task group

Definition at line 239 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$id‪Primary key (from the database record) of the scheduled task

Definition at line 125 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

Definition at line 564 of file AbstractTask.php.

◆ unmarkAllExecutions()

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

Clears all marked executions

Returns
‪bool TRUE if the clearing succeeded, FALSE otherwise

Definition at line 530 of file AbstractTask.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_LOB.

◆ unmarkExecution()

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

Removes given execution from list

Parameters
int$executionID‪Id of the execution to remove.
\Throwable$failure‪An exception to signal a failed execution

Definition at line 465 of file AbstractTask.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_LOB.

◆ unsetScheduler()

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

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

Definition at line 290 of file AbstractTask.php.

Member Data Documentation

◆ $description

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

◆ $disabled

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

Disable flag, TRUE if task is disabled, FALSE otherwise

Definition at line 54 of file AbstractTask.php.

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

◆ $execution

◆ $executionTime

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

This variable contains the time of next execution of the task

Definition at line 72 of file AbstractTask.php.

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

◆ $runOnNextCronJob

bool TYPO3\CMS\Scheduler\Task\AbstractTask::$runOnNextCronJob = false
protected

Run on next cron job flag, TRUE if task should run on next cronjob, FALSE otherwise

Definition at line 60 of file AbstractTask.php.

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

◆ $scheduler

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

Reference to a scheduler object

Definition at line 42 of file AbstractTask.php.

◆ $taskGroup

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

◆ $taskUid

int TYPO3\CMS\Scheduler\Task\AbstractTask::$taskUid
protected

The unique id of the task used to identify it in the database

Definition at line 48 of file AbstractTask.php.

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

◆ TYPE_RECURRING

◆ TYPE_SINGLE