Local.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin McCorkell <robin@mccorkell.me.uk>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OCA\Files_External\Lib\Backend;
  25. use OCA\Files_External\Lib\Auth\AuthMechanism;
  26. use OCA\Files_External\Lib\Auth\NullMechanism;
  27. use OCA\Files_External\Lib\DefinitionParameter;
  28. use OCA\Files_External\Lib\StorageConfig;
  29. use OCA\Files_External\Service\BackendService;
  30. use OCP\IL10N;
  31. use OCP\IUser;
  32. class Local extends Backend {
  33. public function __construct(IL10N $l, NullMechanism $legacyAuth) {
  34. $this
  35. ->setIdentifier('local')
  36. ->addIdentifierAlias('\OC\Files\Storage\Local') // legacy compat
  37. ->setStorageClass('\OC\Files\Storage\Local')
  38. ->setText($l->t('Local'))
  39. ->addParameters([
  40. new DefinitionParameter('datadir', $l->t('Location')),
  41. ])
  42. ->setAllowedVisibility(BackendService::VISIBILITY_ADMIN)
  43. ->setPriority(BackendService::PRIORITY_DEFAULT + 50)
  44. ->addAuthScheme(AuthMechanism::SCHEME_NULL)
  45. ->setLegacyAuthMechanism($legacyAuth)
  46. ;
  47. }
  48. public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null): void {
  49. $storage->setBackendOption('isExternal', true);
  50. }
  51. }