1
0

CalendarRetentionJob.php 737 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 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\RetentionService;
  9. use OCP\AppFramework\Utility\ITimeFactory;
  10. use OCP\BackgroundJob\TimedJob;
  11. class CalendarRetentionJob extends TimedJob {
  12. /** @var RetentionService */
  13. private $service;
  14. public function __construct(ITimeFactory $time,
  15. RetentionService $service) {
  16. parent::__construct($time);
  17. $this->service = $service;
  18. // Run four times a day
  19. $this->setInterval(6 * 60 * 60);
  20. $this->setTimeSensitivity(self::TIME_SENSITIVE);
  21. }
  22. protected function run($argument): void {
  23. $this->service->cleanUp();
  24. }
  25. }