1
0

CleanUpReminders.php 750 B

123456789101112131415161718192021222324252627282930313233
  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\TimedJob;
  11. class CleanUpReminders extends TimedJob {
  12. public function __construct(
  13. ITimeFactory $time,
  14. private ReminderService $reminderService,
  15. ) {
  16. parent::__construct($time);
  17. $this->setInterval(24 * 60 * 60); // 1 day
  18. $this->setTimeSensitivity(self::TIME_INSENSITIVE);
  19. }
  20. /**
  21. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  22. */
  23. protected function run($argument) {
  24. $this->reminderService->cleanUp(500);
  25. }
  26. }