QueuedJob.php 892 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\BackgroundJob;
  8. use OCP\ILogger;
  9. /**
  10. * Simple base class for a one time background job
  11. *
  12. * @since 15.0.0
  13. */
  14. abstract class QueuedJob extends Job {
  15. /**
  16. * Run the job, then remove it from the joblist
  17. *
  18. * @param IJobList $jobList
  19. * @param ILogger|null $logger
  20. *
  21. * @since 15.0.0
  22. * @deprecated since 25.0.0 Use start() instead. This method will be removed
  23. * with the ILogger interface
  24. */
  25. final public function execute($jobList, ?ILogger $logger = null) {
  26. $this->start($jobList);
  27. }
  28. /**
  29. * Run the job, then remove it from the joblist
  30. *
  31. * @since 25.0.0
  32. */
  33. final public function start(IJobList $jobList): void {
  34. $jobList->remove($this, $this->argument);
  35. parent::start($jobList);
  36. }
  37. }