1
0

Mount.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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_Sharing\External;
  8. use OC\Files\Mount\MountPoint;
  9. use OC\Files\Mount\MoveableMount;
  10. use OCA\Files_Sharing\ISharedMountPoint;
  11. class Mount extends MountPoint implements MoveableMount, ISharedMountPoint {
  12. /**
  13. * @var \OCA\Files_Sharing\External\Manager
  14. */
  15. protected $manager;
  16. /**
  17. * @param string|\OC\Files\Storage\Storage $storage
  18. * @param string $mountpoint
  19. * @param array $options
  20. * @param \OCA\Files_Sharing\External\Manager $manager
  21. * @param \OC\Files\Storage\StorageFactory $loader
  22. */
  23. public function __construct($storage, $mountpoint, $options, $manager, $loader = null) {
  24. parent::__construct($storage, $mountpoint, $options, $loader, null, null, MountProvider::class);
  25. $this->manager = $manager;
  26. }
  27. /**
  28. * Move the mount point to $target
  29. *
  30. * @param string $target the target mount point
  31. * @return bool
  32. */
  33. public function moveMount($target) {
  34. $result = $this->manager->setMountPoint($this->mountPoint, $target);
  35. $this->setMountPoint($target);
  36. return $result;
  37. }
  38. /**
  39. * Remove the mount points
  40. */
  41. public function removeMount(): bool {
  42. return $this->manager->removeShare($this->mountPoint);
  43. }
  44. /**
  45. * Get the type of mount point, used to distinguish things like shares and external storage
  46. * in the web interface
  47. *
  48. * @return string
  49. */
  50. public function getMountType() {
  51. return 'shared';
  52. }
  53. }