2018-10-09 06:36:43 -04:00
|
|
|
<?php
|
2019-12-03 13:57:53 -05:00
|
|
|
|
2018-10-09 06:36:43 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-10-09 06:36:43 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCP\BackgroundJob;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Simple base class for a one time background job
|
|
|
|
|
*
|
|
|
|
|
* @since 15.0.0
|
2024-09-18 18:37:55 -04:00
|
|
|
* @since 25.0.0 deprecated `execute()` method in favor of `start()`
|
|
|
|
|
* @since 33.0.0 removed deprecated `execute()` method
|
2018-10-09 06:36:43 -04:00
|
|
|
*/
|
|
|
|
|
abstract class QueuedJob extends Job {
|
2022-06-28 06:09:08 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Run the job, then remove it from the joblist
|
|
|
|
|
*
|
2022-06-28 06:55:26 -04:00
|
|
|
* @since 25.0.0
|
2022-06-28 06:09:08 -04:00
|
|
|
*/
|
|
|
|
|
final public function start(IJobList $jobList): void {
|
2024-05-30 09:07:26 -04:00
|
|
|
if ($this->id) {
|
|
|
|
|
$jobList->removeById($this->id);
|
|
|
|
|
} else {
|
|
|
|
|
$jobList->remove($this, $this->argument);
|
|
|
|
|
}
|
2022-06-28 06:09:08 -04:00
|
|
|
parent::start($jobList);
|
2018-10-09 06:36:43 -04:00
|
|
|
}
|
|
|
|
|
}
|