‪TYPO3CMS  ‪main
TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository Class Reference

Public Member Functions

 __construct (protected readonly TaskSerializer $taskSerializer,)
 
bool add (AbstractTask $task)
 
bool remove (int|AbstractTask $task)
 
 update (AbstractTask $task)
 
array null findRecordByUid (int $uid)
 
 findByUid (int $uid)
 
AbstractTask findNextExecutableTask ()
 
 getGroupedTasks ()
 
 findNextExecutableTaskForUid (int $uid)
 
 isTaskMarkedAsRunning (AbstractTask $task)
 
int addExecutionToTask (AbstractTask $task)
 
 removeExecutionOfTask (AbstractTask $task, int $executionID, array|string $failureReason=null)
 
bool removeAllRegisteredExecutionsForTask (AbstractTask $task)
 
 hasTasks ()
 

Protected Member Functions

 createValidTaskObjectOrDisableTask (array $row)
 
 isValidTaskObject ($task)
 

Protected Attributes

const TABLE_NAME = 'tx_scheduler_task'
 

Detailed Description

Repository class to fetch tasks available in the systems ready to be executed

Definition at line 35 of file SchedulerTaskRepository.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::__construct ( protected readonly TaskSerializer  $taskSerializer)

Definition at line 39 of file SchedulerTaskRepository.php.

Member Function Documentation

◆ add()

bool TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::add ( AbstractTask  $task)

◆ addExecutionToTask()

int TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::addExecutionToTask ( AbstractTask  $task)

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

Returns
‪int Execution id

Definition at line 455 of file SchedulerTaskRepository.php.

References TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository\findRecordByUid(), TYPO3\CMS\Scheduler\Task\AbstractTask\getTaskUid(), TYPO3\CMS\Core\Core\Environment\isCli(), and TYPO3\CMS\Core\Database\Connection\PARAM_LOB.

◆ createValidTaskObjectOrDisableTask()

TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::createValidTaskObjectOrDisableTask ( array  $row)
protected

◆ findByUid()

TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::findByUid ( int  $uid)

Fetches and unserializes a task object from the db with the given $uid. The object representing the next due task is returned. If there are no due tasks the method throws an exception.

Parameters
int$uid‪Primary key of a task
Exceptions

Definition at line 176 of file SchedulerTaskRepository.php.

References TYPO3\CMS\Webhooks\Message\$uid, TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository\createValidTaskObjectOrDisableTask(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

◆ findNextExecutableTask()

AbstractTask TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::findNextExecutableTask ( )

Fetch and unserialize a task object from the db. Returns the object representing the next due task is returned. If there are no due tasks the method throws an exception.

Returns
‪AbstractTask The fetched task object
Exceptions

Definition at line 205 of file SchedulerTaskRepository.php.

References $GLOBALS, TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository\createValidTaskObjectOrDisableTask(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

◆ findNextExecutableTaskForUid()

TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::findNextExecutableTaskForUid ( int  $uid)

◆ findRecordByUid()

array null TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::findRecordByUid ( int  $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
int$uid‪Primary key of the task to get
Returns
‪array|null Database record for the task
See also
findByUid()

Definition at line 148 of file SchedulerTaskRepository.php.

References TYPO3\CMS\Webhooks\Message\$uid, and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository\addExecutionToTask(), and TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository\removeExecutionOfTask().

◆ getGroupedTasks()

TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::getGroupedTasks ( )

◆ hasTasks()

TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::hasTasks ( )

See if there are any tasks configured at all.

Definition at line 550 of file SchedulerTaskRepository.php.

◆ isTaskMarkedAsRunning()

TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::isTaskMarkedAsRunning ( AbstractTask  $task)

◆ isValidTaskObject()

◆ remove()

bool TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::remove ( int|AbstractTask  $task)

Removes a task completely from the system.

Parameters
int | AbstractTask$task‪The object representing the task to delete
Returns
‪bool TRUE if task was successfully deleted, FALSE otherwise

Definition at line 84 of file SchedulerTaskRepository.php.

◆ removeAllRegisteredExecutionsForTask()

bool TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::removeAllRegisteredExecutionsForTask ( AbstractTask  $task)

Clears all marked executions

Returns
‪bool TRUE if the clearing succeeded, FALSE otherwise

Definition at line 533 of file SchedulerTaskRepository.php.

References TYPO3\CMS\Scheduler\Task\AbstractTask\getTaskUid(), and TYPO3\CMS\Core\Database\Connection\PARAM_LOB.

◆ removeExecutionOfTask()

TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::removeExecutionOfTask ( AbstractTask  $task,
int  $executionID,
array|string  $failureReason = null 
)

Removes given execution from list

Parameters
int$executionID‪Id of the execution to remove.
string | array | null$failureReason‪Details of an exception to signal a failed execution

Definition at line 493 of file SchedulerTaskRepository.php.

References TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository\findRecordByUid(), TYPO3\CMS\Scheduler\Task\AbstractTask\getTaskUid(), and TYPO3\CMS\Core\Database\Connection\PARAM_LOB.

◆ update()

Member Data Documentation

◆ TABLE_NAME

const TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository::TABLE_NAME = 'tx_scheduler_task'
protected

Definition at line 37 of file SchedulerTaskRepository.php.