FixBirthdayCalendarComponent.php 911 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 ownCloud GmbH.
  4. * SPDX-License-Identifier: AGPL-3.0-only
  5. */
  6. namespace OCA\DAV\Migration;
  7. use OCA\DAV\CalDAV\BirthdayService;
  8. use OCP\IDBConnection;
  9. use OCP\Migration\IOutput;
  10. use OCP\Migration\IRepairStep;
  11. class FixBirthdayCalendarComponent implements IRepairStep {
  12. public function __construct(
  13. private IDBConnection $connection,
  14. ) {
  15. }
  16. /**
  17. * @inheritdoc
  18. */
  19. public function getName() {
  20. return 'Fix component of birthday calendars';
  21. }
  22. /**
  23. * @inheritdoc
  24. */
  25. public function run(IOutput $output) {
  26. $query = $this->connection->getQueryBuilder();
  27. $updated = $query->update('calendars')
  28. ->set('components', $query->createNamedParameter('VEVENT'))
  29. ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
  30. ->executeStatement();
  31. $output->info("$updated birthday calendars updated.");
  32. }
  33. }