mount.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OCA\Files_Sharing\External;
  9. use OC\Files\Mount\MoveableMount;
  10. class Mount extends \OC\Files\Mount\Mount implements MoveableMount {
  11. /**
  12. * @var \OCA\Files_Sharing\External\Manager
  13. */
  14. protected $manager;
  15. /**
  16. * @param string|\OC\Files\Storage\Storage $storage
  17. * @param string $mountpoint
  18. * @param array $options
  19. * @param \OCA\Files_Sharing\External\Manager $manager
  20. * @param \OC\Files\Storage\Loader $loader
  21. */
  22. public function __construct($storage, $mountpoint, $options, $manager, $loader = null) {
  23. parent::__construct($storage, $mountpoint, $options, $loader);
  24. $this->manager = $manager;
  25. }
  26. /**
  27. * Move the mount point to $target
  28. *
  29. * @param string $target the target mount point
  30. * @return bool
  31. */
  32. public function moveMount($target) {
  33. $result = $this->manager->setMountPoint($this->mountPoint, $target);
  34. $this->setMountPoint($target);
  35. return $result;
  36. }
  37. /**
  38. * Remove the mount points
  39. *
  40. * @return mixed
  41. * @return bool
  42. */
  43. public function removeMount() {
  44. return $this->manager->removeShare($this->mountPoint);
  45. }
  46. }