2018-06-18 12:15:50 -04:00
|
|
|
<?php
|
2021-12-02 10:38:48 -05:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2018-06-18 12:15:50 -04:00
|
|
|
/**
|
2024-05-27 11:39:07 -04:00
|
|
|
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-06-18 12:15:50 -04:00
|
|
|
*/
|
2021-12-02 10:38:48 -05:00
|
|
|
|
2018-06-18 12:15:50 -04:00
|
|
|
namespace OCA\DAV\BackgroundJob;
|
|
|
|
|
|
2022-02-22 05:24:38 -05:00
|
|
|
use OCP\AppFramework\Utility\ITimeFactory;
|
|
|
|
|
use OCP\BackgroundJob\TimedJob;
|
2018-06-18 12:15:50 -04:00
|
|
|
use OCP\Calendar\Resource\IManager as IResourceManager;
|
|
|
|
|
use OCP\Calendar\Room\IManager as IRoomManager;
|
|
|
|
|
|
|
|
|
|
class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
2024-05-16 15:27:07 -04:00
|
|
|
public function __construct(
|
|
|
|
|
ITimeFactory $time,
|
|
|
|
|
private IResourceManager $resourceManager,
|
|
|
|
|
private IRoomManager $roomManager,
|
|
|
|
|
) {
|
2022-02-22 05:24:38 -05:00
|
|
|
parent::__construct($time);
|
2018-06-18 12:15:50 -04:00
|
|
|
|
2022-02-22 05:24:38 -05:00
|
|
|
// Run once an hour
|
2018-06-18 12:15:50 -04:00
|
|
|
$this->setInterval(60 * 60);
|
2022-02-22 05:24:38 -05:00
|
|
|
$this->setTimeSensitivity(self::TIME_SENSITIVE);
|
2018-06-18 12:15:50 -04:00
|
|
|
}
|
|
|
|
|
|
2021-12-02 10:38:48 -05:00
|
|
|
public function run($argument): void {
|
2024-05-16 15:27:07 -04:00
|
|
|
$this->resourceManager->update();
|
|
|
|
|
$this->roomManager->update();
|
2019-07-29 09:39:43 -04:00
|
|
|
}
|
2018-06-18 12:15:50 -04:00
|
|
|
}
|