RemoveRefreshTime.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\User_LDAP\Migration;
  8. use OCP\IConfig;
  9. use OCP\IDBConnection;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\IRepairStep;
  12. /**
  13. * Class RmRefreshTime
  14. *
  15. * this can be removed with Nextcloud 21
  16. *
  17. * @package OCA\User_LDAP\Migration
  18. */
  19. class RemoveRefreshTime implements IRepairStep {
  20. /** @var IDBConnection */
  21. private $dbc;
  22. /** @var IConfig */
  23. private $config;
  24. public function __construct(IDBConnection $dbc, IConfig $config) {
  25. $this->dbc = $dbc;
  26. $this->config = $config;
  27. }
  28. public function getName() {
  29. return 'Remove deprecated refresh time markers for LDAP user records';
  30. }
  31. public function run(IOutput $output) {
  32. $this->config->deleteAppValue('user_ldap', 'updateAttributesInterval');
  33. $qb = $this->dbc->getQueryBuilder();
  34. $qb->delete('preferences')
  35. ->where($qb->expr()->eq('appid', $qb->createNamedParameter('user_ldap')))
  36. ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lastFeatureRefresh')))
  37. ->execute();
  38. }
  39. }