1
0

SendEventReminders.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\DAV\Command;
  7. use OCA\DAV\CalDAV\Reminder\ReminderService;
  8. use OCP\IConfig;
  9. use Symfony\Component\Console\Command\Command;
  10. use Symfony\Component\Console\Input\InputInterface;
  11. use Symfony\Component\Console\Output\OutputInterface;
  12. /**
  13. * Class SendEventReminders
  14. *
  15. * @package OCA\DAV\Command
  16. */
  17. class SendEventReminders extends Command {
  18. public function __construct(
  19. protected ReminderService $reminderService,
  20. protected IConfig $config,
  21. ) {
  22. parent::__construct();
  23. }
  24. /**
  25. * @inheritDoc
  26. */
  27. protected function configure():void {
  28. $this
  29. ->setName('dav:send-event-reminders')
  30. ->setDescription('Sends event reminders');
  31. }
  32. protected function execute(InputInterface $input, OutputInterface $output): int {
  33. if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
  34. $output->writeln('<error>Sending event reminders disabled!</error>');
  35. $output->writeln('<info>Please run "php occ config:app:set dav sendEventReminders --value yes"');
  36. return self::FAILURE;
  37. }
  38. if ($this->config->getAppValue('dav', 'sendEventRemindersMode', 'backgroundjob') !== 'occ') {
  39. $output->writeln('<error>Sending event reminders mode set to background-job!</error>');
  40. $output->writeln('<info>Please run "php occ config:app:set dav sendEventRemindersMode --value occ"');
  41. return self::FAILURE;
  42. }
  43. $this->reminderService->processReminders();
  44. return self::SUCCESS;
  45. }
  46. }