UnsetDefaultProvider.php 749 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\User_LDAP\Migration;
  8. use OCA\User_LDAP\LDAPProviderFactory;
  9. use OCP\IConfig;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\IRepairStep;
  12. class UnsetDefaultProvider implements IRepairStep {
  13. public function __construct(
  14. private IConfig $config,
  15. ) {
  16. }
  17. public function getName(): string {
  18. return 'Unset default LDAP provider';
  19. }
  20. public function run(IOutput $output): void {
  21. $current = $this->config->getSystemValue('ldapProviderFactory', null);
  22. if ($current === LDAPProviderFactory::class) {
  23. $this->config->deleteSystemValue('ldapProviderFactory');
  24. }
  25. }
  26. }