AddRemoveOldTasksBackgroundJob.php 1011 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Repair;
  8. use OC\TaskProcessing\RemoveOldTasksBackgroundJob;
  9. use OC\TextProcessing\RemoveOldTasksBackgroundJob as RemoveOldTextProcessingTasksBackgroundJob;
  10. use OC\TextToImage\RemoveOldTasksBackgroundJob as RemoveOldTextToImageTasksBackgroundJob;
  11. use OCP\BackgroundJob\IJobList;
  12. use OCP\Migration\IOutput;
  13. use OCP\Migration\IRepairStep;
  14. class AddRemoveOldTasksBackgroundJob implements IRepairStep {
  15. private IJobList $jobList;
  16. public function __construct(IJobList $jobList) {
  17. $this->jobList = $jobList;
  18. }
  19. public function getName(): string {
  20. return 'Add AI tasks cleanup jobs';
  21. }
  22. public function run(IOutput $output) {
  23. $this->jobList->add(RemoveOldTextProcessingTasksBackgroundJob::class);
  24. $this->jobList->add(RemoveOldTextToImageTasksBackgroundJob::class);
  25. $this->jobList->add(RemoveOldTasksBackgroundJob::class);
  26. }
  27. }