Execution

class \TYPO3\CMS\Scheduler\Execution

This class manages the logic of a particular execution of a task

Table of Contents

Properties

$cronCmd  : string
The cron command string of this task,
$end  : int
End date of a task (timestamp)
$interval  : int
Interval between executions (in seconds)
$isNewSingleExecution  : bool
This flag is used to mark a new single execution See explanations in method setIsNewSingleExecution()
$multiple  : bool
Flag for concurrent executions: TRUE if allowed, FALSE otherwise (default)
$start  : int
Start date of a task (timestamp)

Methods

calculateNextIntervalExecution()  : int
Calculates the first interval-based execution after the given point in time
createFromDetails()  : self
createRecurringExecution()  : self
Registers a recurring execution of the task
createSingleExecution()  : self
Registers a single execution of the task
getCronCmd()  : string
Get the value of the cron command
getEnd()  : int
This method is used to get the end date
getInterval()  : int
This method is used to get the interval
getIsNewSingleExecution()  : bool
Get whether this is a newly created single execution
getNextCronExecution()  : int
Calculates the next execution from a cron command
getNextExecution()  : int
This method gets or calculates the next execution date
getStart()  : int
This method is used to get the start date
isEnded()  : bool
Checks if the schedule for a task is passed or not
isParallelExecutionAllowed()  : bool
This method is used to get the multiple execution flag
isRecurring()  : bool
Guess recurring type from the existing information If an interval or a cron command is defined, it's a recurring task
isSingleRun()  : bool
isStarted()  : bool
Checks if the schedule for a task is started or not
setCronCmd()  : mixed
Set the value of the cron command
setEnd()  : mixed
This method is used to set the end date
setInterval()  : mixed
This method is used to set the interval
setIsNewSingleExecution()  : mixed
Set whether this is a newly created single execution.
setMultiple()  : mixed
This method is used to set the multiple execution flag
setStart()  : mixed
This method is used to set the start date
toArray()  : array

Properties

$cronCmd

The cron command string of this task,

protected string $cronCmd

$end

End date of a task (timestamp)

protected int $end

$interval

Interval between executions (in seconds)

protected int $interval

$multiple

Flag for concurrent executions: TRUE if allowed, FALSE otherwise (default)

protected bool $multiple = false

$start

Start date of a task (timestamp)

protected int $start

Methods

calculateNextIntervalExecution()

Calculates the first interval-based execution after the given point in time

public calculateNextIntervalExecution(int $now) : int

Parameters

$now : int

Reference timestamp

Return values

int —

Timestamp of the next execution

createFromDetails()

public static createFromDetails(array $details) : self

Parameters

$details : array

Return values

self

createRecurringExecution()

Registers a recurring execution of the task

public static createRecurringExecution(int $start, int $interval[, int $end = 0 ][, bool $multiple = false ][, string $cronCmd = '' ]) : self

Parameters

$start : int

The first date/time when this execution should occur (timestamp)

$interval : int

Execution interval in seconds

$end : int = 0

The last date/time when this execution should occur (timestamp)

$multiple : bool = false

Set to FALSE if multiple executions of this task are not permitted in parallel

$cronCmd : string = ''

Used like in crontab (minute hour day month weekday)

Return values

self

createSingleExecution()

Registers a single execution of the task

public static createSingleExecution(int $timestamp) : self

Parameters

$timestamp : int

Timestamp of the next execution

Return values

self

getCronCmd()

Get the value of the cron command

public getCronCmd() : string

Return values

string —

Cron command, using cron-like syntax

getEnd()

This method is used to get the end date

public getEnd() : int

Return values

int —

End date (timestamp)

getInterval()

This method is used to get the interval

public getInterval() : int

Return values

int —

Interval (in seconds)

getIsNewSingleExecution()

Get whether this is a newly created single execution

public getIsNewSingleExecution() : bool

Return values

bool —

Is newly created single execution?

getNextCronExecution()

Calculates the next execution from a cron command

public getNextCronExecution() : int

Return values

int —

Next execution (timestamp)

getNextExecution()

This method gets or calculates the next execution date

public getNextExecution() : int

Tags

throws
OutOfBoundsException

Return values

int —

Timestamp of the next execution

getStart()

This method is used to get the start date

public getStart() : int

Return values

int —

Start date (timestamp)

isEnded()

Checks if the schedule for a task is passed or not

public isEnded() : bool

Return values

bool —

TRUE if the schedule is not active anymore, FALSE otherwise

isParallelExecutionAllowed()

This method is used to get the multiple execution flag

public isParallelExecutionAllowed() : bool

Return values

bool —

TRUE if concurrent executions are allowed, FALSE otherwise

isRecurring()

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

public isRecurring() : bool

Return values

bool

isSingleRun()

public isSingleRun() : bool

Return values

bool

isStarted()

Checks if the schedule for a task is started or not

public isStarted() : bool

Return values

bool —

TRUE if the schedule is already active, FALSE otherwise

setCronCmd()

Set the value of the cron command

public setCronCmd(string $cmd) : mixed

Parameters

$cmd : string

Cron command, using cron-like syntax

setEnd()

This method is used to set the end date

public setEnd(int $end) : mixed

Parameters

$end : int

End date (timestamp)

setInterval()

This method is used to set the interval

public setInterval(int $interval) : mixed

Parameters

$interval : int

Interval (in seconds)

setIsNewSingleExecution()

Set whether this is a newly created single execution.

public setIsNewSingleExecution(bool $isNewSingleExecution) : mixed

This is necessary for the following reason: if a new single-running task is created and its start date is in the past (even for only a few seconds), the next run time calculation (which happens upon saving) will disable that task, because it was meant to run only once and is in the past. Setting this flag to TRUE preserves this task for a single run. Upon next execution, this flag is set to FALSE.

Parameters

$isNewSingleExecution : bool

Is newly created single execution?

Tags

see
Execution::getNextExecution()

setMultiple()

This method is used to set the multiple execution flag

public setMultiple(bool $multiple) : mixed

Parameters

$multiple : bool

TRUE if concurrent executions are allowed, FALSE otherwise

setStart()

This method is used to set the start date

public setStart(int $start) : mixed

Parameters

$start : int

Start date (timestamp)

toArray()

public toArray() : array

Return values

array
On this page