diff options
author | Anna Larch <anna@nextcloud.com> | 2024-05-08 20:38:51 +0200 |
---|---|---|
committer | Anna Larch <anna@nextcloud.com> | 2024-05-31 13:14:01 +0200 |
commit | ad78f7e48e7f03fc6c3f47a8972d122cde275d97 (patch) | |
tree | 220b6a13bbe7be61b60f4bda5bfe118bf3bc28ce /apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php | |
parent | 4a6ac1f1aab769089b1b48a45bbb15bd1fb847e1 (diff) | |
download | nextcloud-server-ad78f7e48e7f03fc6c3f47a8972d122cde275d97.tar.gz nextcloud-server-ad78f7e48e7f03fc6c3f47a8972d122cde275d97.zip |
fix(caldav): automatically delete outdated scheduling objects
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php')
-rw-r--r-- | apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php b/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php new file mode 100644 index 00000000000..fa53a8be4f0 --- /dev/null +++ b/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php @@ -0,0 +1,35 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCA\DAV\BackgroundJob; + +use OCA\DAV\CalDAV\CalDavBackend; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; +use Psr\Log\LoggerInterface; + +class DeleteOutdatedSchedulingObjects extends TimedJob { + public function __construct( + private CalDavBackend $calDavBackend, + private LoggerInterface $logger, + ITimeFactory $timeFactory, + ) { + parent::__construct($timeFactory); + $this->setInterval(23 * 60 * 60); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); + } + + /** + * @param array $argument + */ + protected function run($argument): void { + $time = $this->time->getTime() - (60 * 60); + $this->calDavBackend->deleteOutdatedSchedulingObjects($time, 50000); + $this->logger->info("Removed outdated scheduling objects"); + } +} |