SetDefaultProvider.php 800 B

1234567891011121314151617181920212223242526272829303132333435
  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 OCA\User_LDAP\Helper;
  9. use OCA\User_LDAP\LDAPProviderFactory;
  10. use OCP\IConfig;
  11. use OCP\Migration\IOutput;
  12. use OCP\Migration\IRepairStep;
  13. class SetDefaultProvider implements IRepairStep {
  14. public function __construct(
  15. private IConfig $config,
  16. private Helper $helper,
  17. ) {
  18. }
  19. public function getName(): string {
  20. return 'Set default LDAP provider';
  21. }
  22. public function run(IOutput $output): void {
  23. $current = $this->config->getSystemValue('ldapProviderFactory', null);
  24. if ($current === null) {
  25. $this->config->setSystemValue('ldapProviderFactory', LDAPProviderFactory::class);
  26. }
  27. }
  28. }