From 3ba93350389d75a4e6638e4eb1b46c5f8e9a1fc3 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 2 Oct 2023 16:27:10 +0200 Subject: [PATCH] fix(dav): add a new config key to check to retrigger regenerating birthday calendars So that birthday calendars are immediately updated and we don't need to wait for user to change a card or disable/enable the calendar. We reuse the existing RegenerateBirthdayCalendars repair step instead of adding a new one. Signed-off-by: Thomas Citharel --- .../Migration/RegenerateBirthdayCalendars.php | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php index 29547b09ff731..66baabc920894 100644 --- a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php +++ b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php @@ -4,6 +4,7 @@ * * @author Arthur Schiwon * @author Georg Ehrke + * @author Thomas Citharel * * @license GNU AGPL version 3 or any later version * @@ -30,36 +31,22 @@ use OCP\Migration\IRepairStep; class RegenerateBirthdayCalendars implements IRepairStep { + private IJobList $jobList; + private IConfig $config; - /** @var IJobList */ - private $jobList; - - /** @var IConfig */ - private $config; - - /** - * @param IJobList $jobList - * @param IConfig $config - */ public function __construct(IJobList $jobList, IConfig $config) { $this->jobList = $jobList; $this->config = $config; } - /** - * @return string - */ - public function getName() { + public function getName(): string { return 'Regenerating birthday calendars to use new icons and fix old birthday events without year'; } - /** - * @param IOutput $output - */ - public function run(IOutput $output) { + public function run(IOutput $output): void { // only run once - if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') { + if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes' && $this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForAlarmFix') === 'yes') { $output->info('Repair step already executed'); return; } @@ -69,5 +56,6 @@ public function run(IOutput $output) { // if all were done, no need to redo the repair during next upgrade $this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes'); + $this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForAlarmFix', 'yes'); } }