Nextcloud PHP API (master)

IJob

This interface represend a backgroud job run with cron

To implement a background job, you must extend either \OCP\BackgroundJob\Job, \OCP\BackgroundJob\TimedJob or \OCP\BackgroundJob\QueuedJob

Tags
since
7.0.0

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
since
24.0.0

TIME_SENSITIVE

public mixed TIME_SENSITIVE = 1
Tags
since
24.0.0

Methods

execute()

Run the background job with the registered argument

public execute(IJobList $jobList[, ILogger|null $logger = null ]) : mixed
Parameters
$jobList : IJobList

The job list that manages the state of this job

$logger : ILogger|null = null
Tags
since
7.0.0
deprecated

since 25.0.0 Use start() instead. This method will be removed with the ILogger interface

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
since
7.0.0

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
since
7.0.0
Return values
int

getLastRun()

Get the last time this job was run as unix timestamp

public getLastRun() : int
Tags
since
7.0.0
Return values
int

setArgument()

public setArgument(mixed $argument) : mixed
Parameters
$argument : mixed
Tags
since
7.0.0

setId()

public setId(int $id) : mixed
Parameters
$id : int
Tags
since
7.0.0

setLastRun()

public setLastRun(int $lastRun) : mixed
Parameters
$lastRun : int
Tags
since
7.0.0

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

Tags
since
25.0.0

        
On this page

Search results