1
0

FixBirthdayCalendarComponent.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. /** @var IDBConnection */
  13. private $connection;
  14. /**
  15. * FixBirthdayCalendarComponent constructor.
  16. *
  17. * @param IDBConnection $connection
  18. */
  19. public function __construct(IDBConnection $connection) {
  20. $this->connection = $connection;
  21. }
  22. /**
  23. * @inheritdoc
  24. */
  25. public function getName() {
  26. return 'Fix component of birthday calendars';
  27. }
  28. /**
  29. * @inheritdoc
  30. */
  31. public function run(IOutput $output) {
  32. $query = $this->connection->getQueryBuilder();
  33. $updated = $query->update('calendars')
  34. ->set('components', $query->createNamedParameter('VEVENT'))
  35. ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
  36. ->execute();
  37. $output->info("$updated birthday calendars updated.");
  38. }
  39. }