Local.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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\NullMechanism;
  10. use OCA\Files_External\Lib\DefinitionParameter;
  11. use OCA\Files_External\Lib\StorageConfig;
  12. use OCA\Files_External\Service\BackendService;
  13. use OCP\IL10N;
  14. use OCP\IUser;
  15. class Local extends Backend {
  16. public function __construct(IL10N $l, NullMechanism $legacyAuth) {
  17. $this
  18. ->setIdentifier('local')
  19. ->addIdentifierAlias('\OC\Files\Storage\Local') // legacy compat
  20. ->setStorageClass('\OC\Files\Storage\Local')
  21. ->setText($l->t('Local'))
  22. ->addParameters([
  23. new DefinitionParameter('datadir', $l->t('Location')),
  24. ])
  25. ->setAllowedVisibility(BackendService::VISIBILITY_ADMIN)
  26. ->setPriority(BackendService::PRIORITY_DEFAULT + 50)
  27. ->addAuthScheme(AuthMechanism::SCHEME_NULL)
  28. ->setLegacyAuthMechanism($legacyAuth)
  29. ;
  30. }
  31. public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null): void {
  32. $storage->setBackendOption('isExternal', true);
  33. }
  34. }