FTP.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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('port', $l->t('Port')))
  24. ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
  25. (new DefinitionParameter('root', $l->t('Remote subfolder')))
  26. ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
  27. (new DefinitionParameter('secure', $l->t('Secure ftps://')))
  28. ->setType(DefinitionParameter::VALUE_BOOLEAN)
  29. ->setDefaultValue(true),
  30. ])
  31. ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
  32. ->setLegacyAuthMechanism($legacyAuth)
  33. ;
  34. }
  35. }