TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
AbstractTask Class Reference
Inheritance diagram for AbstractTask:
Task UpdateExtensionListTask ValidatorTask CleanerTask SystemStatusUpdateTask BulkUpdateTask SleepTask TestTask CachingFrameworkGarbageCollectionTask FileStorageExtractionTask FileStorageIndexingTask OptimizeDatabaseTableTask RecyclerGarbageCollectionTask TableGarbageCollectionTask AutoPublishTask 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 25 of file scheduler/Classes/Task/AbstractTask.php.

Constructor & Destructor Documentation

__construct ( )

Member Function Documentation

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 359 of file scheduler/Classes/Task/AbstractTask.php.

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
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 107 of file scheduler/Classes/Task/AbstractTask.php.

getDescription ( )

This method returns the description of the task

Returns
string Description

Definition at line 246 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\$description.

getExecution ( )

Returns the execution object

Returns
The internal execution object

Definition at line 338 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\$execution.

Referenced by AbstractTask\getType().

getExecutionTime ( )

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

Returns
int Timestamp of next execution

Definition at line 225 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\$executionTime.

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 348 of file scheduler/Classes/Task/AbstractTask.php.

getTaskClassName ( )

This method returns the class name of the scheduler task

Returns
string

Definition at line 158 of file scheduler/Classes/Task/AbstractTask.php.

getTaskDescription ( )

This method returns the description of the scheduler task

Returns
string

Definition at line 148 of file scheduler/Classes/Task/AbstractTask.php.

References $GLOBALS.

getTaskGroup ( )

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

Returns
int Uid of task group

Definition at line 204 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\$taskGroup.

getTaskTitle ( )

This method returns the title of the scheduler task

Returns
string

Definition at line 138 of file scheduler/Classes/Task/AbstractTask.php.

References $GLOBALS.

getTaskUid ( )

This method returns the unique id of the task

Returns
int The id of the task

Definition at line 128 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\$taskUid.

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 560 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\getExecution().

isDisabled ( )

This method returns the disable status of the task

Returns
bool TRUE if task is disabled, FALSE otherwise

Definition at line 168 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\$disabled.

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 369 of file scheduler/Classes/Task/AbstractTask.php.

References GeneralUtility\makeInstance().

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 395 of file scheduler/Classes/Task/AbstractTask.php.

References GeneralUtility\makeInstance().

remove ( )

Removes the task totally from the system.

Returns
void

Definition at line 549 of file scheduler/Classes/Task/AbstractTask.php.

save ( )

Saves the details of the task to the database.

Returns
bool

Definition at line 528 of file scheduler/Classes/Task/AbstractTask.php.

Referenced by BulkUpdateTask\execute(), and ValidatorTask\execute().

setDescription (   $description)

This method is used to set the description of the task

Parameters
string$descriptionDescription
Returns
void

Definition at line 236 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\$description.

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 179 of file scheduler/Classes/Task/AbstractTask.php.

Referenced by BulkUpdateTask\activateSelf(), and BulkUpdateTask\deactivateSelf().

setExecution ( \TYPO3\CMS\Scheduler\Execution  $execution)

Sets the internal execution object

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

Definition at line 328 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\$execution.

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 194 of file scheduler/Classes/Task/AbstractTask.php.

setScheduler ( )

Sets the internal reference to the singleton instance of the Scheduler

Returns
void

Definition at line 256 of file scheduler/Classes/Task/AbstractTask.php.

References GeneralUtility\makeInstance().

Referenced by AbstractTask\__construct().

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 215 of file scheduler/Classes/Task/AbstractTask.php.

References AbstractTask\$taskGroup.

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 118 of file scheduler/Classes/Task/AbstractTask.php.

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 539 of file scheduler/Classes/Task/AbstractTask.php.

References GeneralUtility\makeInstance().

unmarkAllExecutions ( )

Clears all marked executions

Returns
bool TRUE if the clearing succeeded, FALSE otherwise

Definition at line 506 of file scheduler/Classes/Task/AbstractTask.php.

References GeneralUtility\makeInstance().

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 445 of file scheduler/Classes/Task/AbstractTask.php.

References GeneralUtility\makeInstance().

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 268 of file scheduler/Classes/Task/AbstractTask.php.

Member Data Documentation

$description = ''
protected
$disabled = false
protected

Definition at line 49 of file scheduler/Classes/Task/AbstractTask.php.

Referenced by AbstractTask\isDisabled().

$execution
protected
$executionTime = 0
protected
$scheduler
protected

Definition at line 35 of file scheduler/Classes/Task/AbstractTask.php.

$taskGroup
protected
$taskUid
protected

Definition at line 42 of file scheduler/Classes/Task/AbstractTask.php.

Referenced by AbstractTask\getTaskUid().

const TYPE_RECURRING = 2

Definition at line 28 of file scheduler/Classes/Task/AbstractTask.php.

const TYPE_SINGLE = 1