\OCPBackgroundJob

This class provides functions to register backgroundjobs in ownCloud

To create a new backgroundjob create a new class that inherits from either \OC\BackgroundJob\Job, \OC\BackgroundJob\QueuedJob or \OC\BackgroundJob\TimedJob and register it using \OCP\BackgroundJob->registerJob($job, $argument), $argument will be passed to the run() function of the job when the job is executed.

A regular Job will be executed every time cron.php is run, a QueuedJob will only run once and a TimedJob will only run at a specific interval which is to be specified in the constructor of the job by calling $this->setInterval($interval) with $interval in seconds.

Summary

Methods
Properties
Constants
getExecutionType()
setExecutionType()
registerJob()
addRegularTask()
allRegularTasks()
findQueuedTask()
allQueuedTasks()
queuedTaskWhereAppIs()
addQueuedTask()
deleteQueuedTask()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getExecutionType()

getExecutionType() : string

get the execution type of background jobs

Returns

string —

This method returns the type how background jobs are executed. If the user did not select something, the type is ajax.

setExecutionType()

setExecutionType(string  $type) : false|null

sets the background jobs execution type

Parameters

string $type

execution type

Returns

false|null —

This method sets the execution type of the background jobs. Possible types are "none", "ajax", "webcron", "cron"

registerJob()

registerJob(string  $job, mixed  $argument = null) 

Parameters

string $job
mixed $argument

addRegularTask()

addRegularTask(string  $klass, string  $method) : boolean|null

Parameters

string $klass

class name

string $method

method name

Returns

boolean|null

allRegularTasks()

allRegularTasks() : array

Returns

array —

key is string "$klass-$method", value is array( $klass, $method )

findQueuedTask()

findQueuedTask(integer  $id) : \OCP\BackgroundJob\IJob|null

Parameters

integer $id

ID of the task

Returns

\OCP\BackgroundJob\IJob|null

allQueuedTasks()

allQueuedTasks() : array

Returns

array —

an array of associative arrays

queuedTaskWhereAppIs()

queuedTaskWhereAppIs(string  $app) : array

Parameters

string $app

app name

Returns

array —

an array of associative arrays

addQueuedTask()

addQueuedTask(string  $app, string  $class, string  $method, string  $parameters) : boolean

Parameters

string $app

app name

string $class

class name

string $method

method name

string $parameters

all useful data as text

Returns

boolean —

id of task

deleteQueuedTask()

deleteQueuedTask(integer  $id) : boolean|null

Parameters

integer $id

id of task

Returns

boolean|null —

Deletes a report