namespace OC\BackgroundJob;
+use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\IJobList;
use OCP\AutoloadNotAllowedException;
}
/**
- * @param Job|string $job
+ * @param IJob|string $job
* @param mixed $argument
*/
public function add($job, $argument = null) {
if (!$this->has($job, $argument)) {
- if ($job instanceof Job) {
+ if ($job instanceof IJob) {
$class = get_class($job);
} else {
$class = $job;
}
/**
- * @param Job|string $job
+ * @param IJob|string $job
* @param mixed $argument
*/
public function remove($job, $argument = null) {
- if ($job instanceof Job) {
+ if ($job instanceof IJob) {
$class = get_class($job);
} else {
$class = $job;
/**
* check if a job is in the list
*
- * @param Job|string $job
+ * @param IJob|string $job
* @param mixed $argument
* @return bool
*/
public function has($job, $argument) {
- if ($job instanceof Job) {
+ if ($job instanceof IJob) {
$class = get_class($job);
} else {
$class = $job;
/**
* get all jobs in the list
*
- * @return Job[]
+ * @return IJob[]
*/
public function getAll() {
$query = $this->connection->getQueryBuilder();
/**
* get the next job in the list
*
- * @return Job
+ * @return IJob|null
*/
public function getNext() {
$lastId = $this->getLastJob();
/**
* @param int $id
- * @return Job|null
+ * @return IJob|null
*/
public function getById($id) {
$query = $this->connection->getQueryBuilder();
* get the job object from a row in the db
*
* @param array $row
- * @return Job
+ * @return IJob|null
*/
private function buildJob($row) {
$class = $row['class'];
/**
* set the job that was last ran
*
- * @param Job $job
+ * @param IJob $job
*/
public function setLastJob($job) {
$this->config->setAppValue('backgroundjob', 'lastjob', $job->getId());
/**
* get the id of the last ran job
*
- * @return string
+ * @return int
*/
public function getLastJob() {
- return $this->config->getAppValue('backgroundjob', 'lastjob', 0);
+ return (int) $this->config->getAppValue('backgroundjob', 'lastjob', 0);
}
/**
* set the lastRun of $job to now
*
- * @param Job $job
+ * @param IJob $job
*/
public function setLastRun($job) {
$query = $this->connection->getQueryBuilder();
*
* @param \OCP\BackgroundJob\IJob|string $job
* @param mixed $argument The argument to be passed to $job->run() when the job is exectured
- * @return void
* @since 7.0.0
*/
public function add($job, $argument = null);
*
* @param \OCP\BackgroundJob\IJob|string $job
* @param mixed $argument
- * @return void
* @since 7.0.0
*/
public function remove($job, $argument = null);
/**
* get the next job in the list
*
- * @return \OCP\BackgroundJob\IJob
+ * @return \OCP\BackgroundJob\IJob|null
* @since 7.0.0
*/
public function getNext();
/**
* @param int $id
- * @return \OCP\BackgroundJob\IJob
+ * @return \OCP\BackgroundJob\IJob|null
* @since 7.0.0
*/
public function getById($id);
* set the job that was last ran to the current time
*
* @param \OCP\BackgroundJob\IJob $job
- * @return void
* @since 7.0.0
*/
public function setLastJob($job);
* set the lastRun of $job to now
*
* @param \OCP\BackgroundJob\IJob $job
- * @return void
* @since 7.0.0
*/
public function setLastRun($job);