1
0

RemoveRefreshTime.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. public function __construct(
  21. private IDBConnection $dbc,
  22. private IConfig $config,
  23. ) {
  24. }
  25. public function getName() {
  26. return 'Remove deprecated refresh time markers for LDAP user records';
  27. }
  28. public function run(IOutput $output) {
  29. $this->config->deleteAppValue('user_ldap', 'updateAttributesInterval');
  30. $qb = $this->dbc->getQueryBuilder();
  31. $qb->delete('preferences')
  32. ->where($qb->expr()->eq('appid', $qb->createNamedParameter('user_ldap')))
  33. ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lastFeatureRefresh')))
  34. ->executeStatement();
  35. }
  36. }