IJobList¶
-
interface
OCP\BackgroundJob\
IJobList
¶ - Interface IJobListThis interface provides functions to register background jobsTo create a new background job create a new class that inherits from either\OC\BackgroundJob\Job, \OC\BackgroundJob\QueuedJob or\OC\BackgroundJob\TimedJob and register it using ->add($job, $argument),$argument will be passed to the run() function of the job when the job isexecuted.A regular job will be executed every time cron.php is run, a QueuedJob willonly run once and a TimedJob will only run at a specific interval which is tobe specified in the constructor of the job by calling$this->setInterval($interval) with $interval in seconds.
Implemented by: OC\BackgroundJob\JobList
Source: lib/public/BackgroundJob/IJobList.php#47
Methods¶
-
public
OCP\BackgroundJob\IJobList::
add
($job, $argument=null)¶ - Add a job to the list
Source: Parameters: - $job (
OCP\BackgroundJob\IJob
| string) - $argument (mixed) The argument to be passed to $job->run() when the job is exectured
Since: 7.0.0
- $job (
-
public
OCP\BackgroundJob\IJobList::
remove
($job, $argument=null)¶ - Remove a job from the list
Source: Parameters: - $job (
OCP\BackgroundJob\IJob
| string) - $argument (mixed)
Since: 7.0.0
- $job (
-
public
OCP\BackgroundJob\IJobList::
has
($job, $argument)¶ - check if a job is in the list
Source: Parameters: - $job (
OCP\BackgroundJob\IJob
| string) - $argument (mixed)
Returns: bool
Since: 7.0.0
- $job (
-
public
OCP\BackgroundJob\IJobList::
getAll
()¶ - get all jobs in the list
Source: lib/public/BackgroundJob/IJobList.php#84 Returns: \OCP\BackgroundJob\IJob[]
Since: 7.0.0 Deprecated: 9.0.0 - This method is dangerous since it can cause load and memory problems when creating too many instances.
-
public
OCP\BackgroundJob\IJobList::
getNext
()¶ - get the next job in the list
Source: lib/public/BackgroundJob/IJobList.php#92 Returns: \OCP\BackgroundJob\IJob
| nullSince: 7.0.0
-
public
OCP\BackgroundJob\IJobList::
getById
($id)¶ Source: Parameters: - $id (int)
Returns: \OCP\BackgroundJob\IJob
| nullSince: 7.0.0
-
public
OCP\BackgroundJob\IJobList::
setLastJob
($job)¶ - set the job that was last ran to the current time
Source: Parameters: - $job (
OCP\BackgroundJob\IJob
)
Since: 7.0.0
- $job (
-
public
OCP\BackgroundJob\IJobList::
unlockJob
($job)¶ - Remove the reservation for a job
Source: Parameters: - $job (
OCP\BackgroundJob\IJob
)
Since: 9.1.0
- $job (
-
public
OCP\BackgroundJob\IJobList::
setLastRun
($job)¶ - set the lastRun of $job to now
Source: Parameters: - $job (
OCP\BackgroundJob\IJob
)
Since: 7.0.0
- $job (
-
public
OCP\BackgroundJob\IJobList::
setExecutionTime
($job, $timeTaken)¶ - set the run duration of $job
Source: Parameters: - $job (
OCP\BackgroundJob\IJob
) - $timeTaken
Since: 12.0.0
- $job (