UnsetDefaultProvider.php 802 B

1234567891011121314151617181920212223242526272829303132333435
  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. /** @var IConfig */
  14. private $config;
  15. public function __construct(IConfig $config) {
  16. $this->config = $config;
  17. }
  18. public function getName(): string {
  19. return 'Unset default LDAP provider';
  20. }
  21. public function run(IOutput $output): void {
  22. $current = $this->config->getSystemValue('ldapProviderFactory', null);
  23. if ($current === LDAPProviderFactory::class) {
  24. $this->config->deleteSystemValue('ldapProviderFactory');
  25. }
  26. }
  27. }