QueuedJob
extends Job
in package
AbstractYes
Simple base class for a one time background job
Tags
Table of Contents
Properties
- $allowParallelRuns : bool
- $argument : mixed
- $id : int
- $lastRun : int
- $time : ITimeFactory
Methods
- __construct() : mixed
- execute() : void
- Run the job, then remove it from the joblist
- getAllowParallelRuns() : bool
- getArgument() : mixed
- Get the argument associated with the background job This is the argument that will be passed to the background job
- getId() : int
- Get the id of the background job This id is determined by the job list when a job is added to the list
- getLastRun() : int
- Get the last time this job was run as unix timestamp
- setAllowParallelRuns() : void
- Set this to false to prevent two Jobs from this class from running in parallel
- setArgument() : mixed
- setId() : mixed
- setLastRun() : mixed
- start() : void
- Run the job, then remove it from the joblist
- run() : void
- The actual function that is called to run the job
Properties
$allowParallelRuns
protected
bool
$allowParallelRuns
= true
$argument
protected
mixed
$argument
$id
protected
int
$id
= 0
$lastRun
protected
int
$lastRun
= 0
$time
protected
ITimeFactory
$time
Methods
__construct()
public
__construct(ITimeFactory $time) : mixed
Parameters
- $time : ITimeFactory
Tags
execute()
Run the job, then remove it from the joblist
public
final execute(IJobList $jobList[, ILogger|null $logger = null ]) : void
Use start() instead. This method will be removed with the ILogger interface
Parameters
Tags
getAllowParallelRuns()
public
getAllowParallelRuns() : bool
Tags
Return values
boolgetArgument()
Get the argument associated with the background job This is the argument that will be passed to the background job
public
getArgument() : mixed
Tags
getId()
Get the id of the background job This id is determined by the job list when a job is added to the list
public
final getId() : int
Tags
Return values
intgetLastRun()
Get the last time this job was run as unix timestamp
public
final getLastRun() : int
Tags
Return values
intsetAllowParallelRuns()
Set this to false to prevent two Jobs from this class from running in parallel
public
setAllowParallelRuns(bool $allow) : void
Parameters
- $allow : bool
Tags
setArgument()
public
setArgument(mixed $argument) : mixed
Parameters
- $argument : mixed
Tags
setId()
public
final setId(int $id) : mixed
Parameters
- $id : int
Tags
setLastRun()
public
final setLastRun(int $lastRun) : mixed
Parameters
- $lastRun : int
Tags
start()
Run the job, then remove it from the joblist
public
final start(IJobList $jobList) : void
Parameters
- $jobList : IJobList
-
The job list that manages the state of this job
Tags
run()
The actual function that is called to run the job
protected
abstract run(mixed $argument) : void
Parameters
- $argument : mixed