1
0

CleanUpReminders.php 778 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 OCA\FilesReminders\BackgroundJob;
  8. use OCA\FilesReminders\Service\ReminderService;
  9. use OCP\AppFramework\Utility\ITimeFactory;
  10. use OCP\BackgroundJob\IJob;
  11. use OCP\BackgroundJob\TimedJob;
  12. class CleanUpReminders extends TimedJob {
  13. public function __construct(
  14. ITimeFactory $time,
  15. private ReminderService $reminderService,
  16. ) {
  17. parent::__construct($time);
  18. $this->setInterval(24 * 60 * 60); // 1 day
  19. $this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
  20. }
  21. /**
  22. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  23. */
  24. protected function run($argument) {
  25. $this->reminderService->cleanUp(500);
  26. }
  27. }