2019-02-16 10:18:58 -05:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2026-02-09 04:53:58 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2019-02-16 10:18:58 -05:00
|
|
|
/**
|
2024-05-27 11:39:07 -04:00
|
|
|
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2019-02-16 10:18:58 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCA\DAV\Migration;
|
|
|
|
|
|
2019-05-23 05:10:48 -04:00
|
|
|
use OCA\DAV\BackgroundJob\RegisterRegenerateBirthdayCalendars;
|
2019-02-16 10:18:58 -05:00
|
|
|
use OCP\BackgroundJob\IJobList;
|
|
|
|
|
use OCP\IConfig;
|
|
|
|
|
use OCP\Migration\IOutput;
|
|
|
|
|
use OCP\Migration\IRepairStep;
|
|
|
|
|
|
|
|
|
|
class RegenerateBirthdayCalendars implements IRepairStep {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param IJobList $jobList
|
|
|
|
|
* @param IConfig $config
|
|
|
|
|
*/
|
2024-10-18 06:04:22 -04:00
|
|
|
public function __construct(
|
|
|
|
|
private IJobList $jobList,
|
|
|
|
|
private IConfig $config,
|
|
|
|
|
) {
|
2019-02-16 10:18:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2026-04-28 13:35:30 -04:00
|
|
|
#[\Override]
|
2019-02-16 10:18:58 -05:00
|
|
|
public function getName() {
|
|
|
|
|
return 'Regenerating birthday calendars to use new icons and fix old birthday events without year';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param IOutput $output
|
|
|
|
|
*/
|
2026-04-28 13:35:30 -04:00
|
|
|
#[\Override]
|
2019-02-16 10:18:58 -05:00
|
|
|
public function run(IOutput $output) {
|
|
|
|
|
// only run once
|
|
|
|
|
if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') {
|
|
|
|
|
$output->info('Repair step already executed');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$output->info('Adding background jobs to regenerate birthday calendar');
|
2019-05-23 05:10:48 -04:00
|
|
|
$this->jobList->add(RegisterRegenerateBirthdayCalendars::class);
|
2019-02-16 10:18:58 -05:00
|
|
|
|
|
|
|
|
// if all were done, no need to redo the repair during next upgrade
|
|
|
|
|
$this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes');
|
|
|
|
|
}
|
2019-04-17 07:40:48 -04:00
|
|
|
}
|