FTP.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Files_External\Lib\Backend;
  8. use OCA\Files_External\Lib\Auth\AuthMechanism;
  9. use OCA\Files_External\Lib\Auth\Password\Password;
  10. use OCA\Files_External\Lib\DefinitionParameter;
  11. use OCA\Files_External\Lib\LegacyDependencyCheckPolyfill;
  12. use OCP\IL10N;
  13. class FTP extends Backend {
  14. use LegacyDependencyCheckPolyfill;
  15. public function __construct(IL10N $l, Password $legacyAuth) {
  16. $this
  17. ->setIdentifier('ftp')
  18. ->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat
  19. ->setStorageClass('\OCA\Files_External\Lib\Storage\FTP')
  20. ->setText($l->t('FTP'))
  21. ->addParameters([
  22. new DefinitionParameter('host', $l->t('Host')),
  23. (new DefinitionParameter('root', $l->t('Remote subfolder')))
  24. ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
  25. (new DefinitionParameter('secure', $l->t('Secure ftps://')))
  26. ->setType(DefinitionParameter::VALUE_BOOLEAN)
  27. ->setDefaultValue(true),
  28. ])
  29. ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
  30. ->setLegacyAuthMechanism($legacyAuth)
  31. ;
  32. }
  33. }