1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- declare(strict_types=1);
- 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);
- }
-
- protected function run($argument): void {
- $time = $this->time->getTime() - (60 * 60);
- $this->calDavBackend->deleteOutdatedSchedulingObjects($time, 50000);
- $this->logger->info('Removed outdated scheduling objects');
- }
- }
|