‪TYPO3CMS  10.4
TYPO3\CMS\Scheduler\Task\AbstractTask Class Reference
Inheritance diagram for TYPO3\CMS\Scheduler\Task\AbstractTask:
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

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)
 
LanguageService null getLanguageService ()
 

Protected Attributes

TYPO3 CMS Scheduler Scheduler $scheduler
 
int $taskUid
 
bool $disabled = false
 
bool $runOnNextCronJob = false
 
Execution $execution
 
int $executionTime = 0
 
string $description = ''
 
int $taskGroup = 0
 

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor

Definition at line 92 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 384 of file AbstractTask.php.

◆ execute()

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

◆ 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\Scheduler\Task\IpAnonymizationTask, TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask, TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandTask, TYPO3\CMS\Scheduler\Example\TestTask, TYPO3\CMS\Recycler\Task\CleanerTask, TYPO3\CMS\Scheduler\Task\OptimizeDatabaseTableTask, and TYPO3\CMS\Scheduler\Example\SleepTask.

Definition at line 118 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 272 of file AbstractTask.php.

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

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

◆ getExecution()

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

Returns the execution object

Returns
Execution The internal execution object

Definition at line 363 of file AbstractTask.php.

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

Referenced by 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 252 of file AbstractTask.php.

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

◆ getLanguageService()

◆ 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 373 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 212 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 168 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 158 of file AbstractTask.php.

References $GLOBALS, TYPO3\CMS\Scheduler\Task\AbstractTask\getLanguageService(), and TYPO3\CMS\Core\Localization\LanguageService\sL().

◆ 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 232 of file AbstractTask.php.

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

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

◆ getTaskTitle()

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

This method returns the title of the scheduler task

Returns
‪string

Definition at line 148 of file AbstractTask.php.

References $GLOBALS, TYPO3\CMS\Scheduler\Task\AbstractTask\getLanguageService(), and TYPO3\CMS\Core\Localization\LanguageService\sL().

◆ getTaskUid()

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

◆ 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 586 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 178 of file AbstractTask.php.

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

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

◆ 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 394 of file AbstractTask.php.

◆ logException()

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

Definition at line 597 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 420 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 327 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 575 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 558 of file AbstractTask.php.

Referenced by TYPO3\CMS\Scheduler\Scheduler\addTask(), 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 262 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 188 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 353 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 222 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 202 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 281 of file AbstractTask.php.

Referenced by 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 242 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 128 of file AbstractTask.php.

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

◆ 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 567 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 533 of file AbstractTask.php.

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

Referenced by TYPO3\CMS\Scheduler\Command\SchedulerCommand\stopTask().

◆ 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 468 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 293 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 57 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 75 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 63 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 45 of file AbstractTask.php.

◆ $taskGroup

int TYPO3\CMS\Scheduler\Task\AbstractTask::$taskGroup = 0
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 51 of file AbstractTask.php.

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

◆ TYPE_RECURRING

◆ TYPE_SINGLE