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
- 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
- getMultiple() : bool
- This method is used to get the multiple execution flag
- 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
- 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
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
$isNewSingleExecution
This flag is used to mark a new single execution See explanations in method setIsNewSingleExecution()
protected
bool
$isNewSingleExecution
= false
Tags
$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
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?
getMultiple()
This method is used to get the multiple execution flag
public
getMultiple() : bool
Return values
bool —TRUE if concurrent executions are allowed, FALSE otherwise
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
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
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
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)