IJob
in
This interface represents a background job run with cron
To implement a background job, you must extend either \OCP\BackgroundJob\Job, \OCP\BackgroundJob\TimedJob or \OCP\BackgroundJob\QueuedJob
Tags
Table of Contents
Constants
- TIME_INSENSITIVE = 0
- TIME_SENSITIVE = 1
Methods
- execute() : mixed
- Run the background job with the registered argument
- 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
- setArgument() : mixed
- setId() : mixed
- setLastRun() : mixed
- start() : void
- Start the background job with the registered argument
Constants
TIME_INSENSITIVE
public
mixed
TIME_INSENSITIVE
= 0
Tags
TIME_SENSITIVE
public
mixed
TIME_SENSITIVE
= 1
Tags
Methods
execute()
Run the background job with the registered argument
public
execute(IJobList $jobList[, ILogger|null $logger = null ]) : mixed
Use start() instead. This method will be removed with the ILogger interface
Parameters
Tags
getArgument()
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
getId() : int
Tags
Return values
intgetLastRun()
Get the last time this job was run as unix timestamp
public
getLastRun() : int
Tags
Return values
intsetArgument()
public
setArgument(mixed $argument) : mixed
Parameters
- $argument : mixed
Tags
setId()
public
setId(int $id) : mixed
Parameters
- $id : int
Tags
setLastRun()
public
setLastRun(int $lastRun) : mixed
Parameters
- $lastRun : int
Tags
start()
Start the background job with the registered argument
public
start(IJobList $jobList) : void
This methods will take care of running the background job, of initializing the state and cleaning up the job list after running the job.
For common background job scenario, you will want to use TimedJob or QueuedJob instead of overwritting this method.
Parameters
- $jobList : IJobList
-
The job list that manages the state of this job