0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-15 08:45:21 +00:00
nextcloud_server/apps/dav/lib/BackgroundJob/EventReminderJob.php
Andy Scherzinger 9d4b944098
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-27 20:11:22 +02:00

52 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\BackgroundJob;
use OCA\DAV\CalDAV\Reminder\ReminderService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
class EventReminderJob extends TimedJob {
/** @var ReminderService */
private $reminderService;
/** @var IConfig */
private $config;
public function __construct(ITimeFactory $time,
ReminderService $reminderService,
IConfig $config) {
parent::__construct($time);
$this->reminderService = $reminderService;
$this->config = $config;
// Run every 5 minutes
$this->setInterval(5 * 60);
$this->setTimeSensitivity(self::TIME_SENSITIVE);
}
/**
* @throws \OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException
* @throws \OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException
* @throws \OC\User\NoUserException
*/
public function run($argument):void {
if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
return;
}
if ($this->config->getAppValue('dav', 'sendEventRemindersMode', 'backgroundjob') !== 'backgroundjob') {
return;
}
$this->reminderService->processReminders();
}
}