f7cloud_client/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

36 lines
920 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 F7cloud GmbH and F7cloud 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');
}
}