UpdateCalendarResourcesRoomsBackgroundJob.php 834 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\BackgroundJob;
  8. use OCP\AppFramework\Utility\ITimeFactory;
  9. use OCP\BackgroundJob\TimedJob;
  10. use OCP\Calendar\Resource\IManager as IResourceManager;
  11. use OCP\Calendar\Room\IManager as IRoomManager;
  12. class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
  13. public function __construct(
  14. ITimeFactory $time,
  15. private IResourceManager $resourceManager,
  16. private IRoomManager $roomManager,
  17. ) {
  18. parent::__construct($time);
  19. // Run once an hour
  20. $this->setInterval(60 * 60);
  21. $this->setTimeSensitivity(self::TIME_SENSITIVE);
  22. }
  23. public function run($argument): void {
  24. $this->resourceManager->update();
  25. $this->roomManager->update();
  26. }
  27. }