1
0

DeleteOutdatedSchedulingObjects.php 924 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\BackgroundJob;
  8. use OCA\DAV\CalDAV\CalDavBackend;
  9. use OCP\AppFramework\Utility\ITimeFactory;
  10. use OCP\BackgroundJob\TimedJob;
  11. use Psr\Log\LoggerInterface;
  12. class DeleteOutdatedSchedulingObjects extends TimedJob {
  13. public function __construct(
  14. private CalDavBackend $calDavBackend,
  15. private LoggerInterface $logger,
  16. ITimeFactory $timeFactory,
  17. ) {
  18. parent::__construct($timeFactory);
  19. $this->setInterval(23 * 60 * 60);
  20. $this->setTimeSensitivity(self::TIME_INSENSITIVE);
  21. }
  22. /**
  23. * @param array $argument
  24. */
  25. protected function run($argument): void {
  26. $time = $this->time->getTime() - (60 * 60);
  27. $this->calDavBackend->deleteOutdatedSchedulingObjects($time, 50000);
  28. $this->logger->info("Removed outdated scheduling objects");
  29. }
  30. }