Nextcloud PHP API (stable19)

TimedJob extends Job

Simple base class to extend to run periodic background jobs.

Call setInterval with your desired interval in seconds from the constructor.

Tags
since
15.0.0

Table of Contents

$argument  : mixed
$id  : int
$interval  : int
$lastRun  : int
$time  : ITimeFactory
__construct()  : mixed
execute()  : mixed
run the job if the last run is is more than the interval ago
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
setInterval()  : mixed
set the interval for the job
setLastRun()  : mixed
run()  : mixed
The actual function that is called to run the job

Properties

$argument

protected mixed $argument

$id

protected int $id

$lastRun

protected int $lastRun

Methods

execute()

run the job if the last run is is more than the interval ago

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

The job list that manages the state of this job

$logger : ILogger|null = null
Tags
since
15.0.0
Return values
mixed

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
15.0.0
Return values
mixed

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

getLastRun()

Get the last time this job was run as unix timestamp

public final getLastRun() : int
Tags
since
15.0.0
Return values
int

setArgument()

public setArgument(mixed $argument) : mixed
Parameters
$argument : mixed
Tags
since
15.0.0
Return values
mixed

setId()

public final setId(mixed $id) : mixed
Parameters
$id : mixed
Tags
since
15.0.0
Return values
mixed

setInterval()

set the interval for the job

public setInterval(int $interval) : mixed
Parameters
$interval : int
Tags
since
15.0.0
Return values
mixed

setLastRun()

public final setLastRun(mixed $lastRun) : mixed
Parameters
$lastRun : mixed
Tags
since
15.0.0
Return values
mixed

run()

The actual function that is called to run the job

protected abstract run( $argument) : mixed
Parameters
$argument :
Tags
since
15.0.0
Return values
mixed

Search results