mount.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * @author Björn Schießle <schiessle@owncloud.com>
  4. * @author Morris Jobke <hey@morrisjobke.de>
  5. * @author Robin Appelman <icewind@owncloud.com>
  6. *
  7. * @copyright Copyright (c) 2015, ownCloud, Inc.
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OCA\Files_Sharing\External;
  24. use OC\Files\Mount\MountPoint;
  25. use OC\Files\Mount\MoveableMount;
  26. class Mount extends MountPoint implements MoveableMount {
  27. /**
  28. * @var \OCA\Files_Sharing\External\Manager
  29. */
  30. protected $manager;
  31. /**
  32. * @param string|\OC\Files\Storage\Storage $storage
  33. * @param string $mountpoint
  34. * @param array $options
  35. * @param \OCA\Files_Sharing\External\Manager $manager
  36. * @param \OC\Files\Storage\StorageFactory $loader
  37. */
  38. public function __construct($storage, $mountpoint, $options, $manager, $loader = null) {
  39. parent::__construct($storage, $mountpoint, $options, $loader);
  40. $this->manager = $manager;
  41. }
  42. /**
  43. * Move the mount point to $target
  44. *
  45. * @param string $target the target mount point
  46. * @return bool
  47. */
  48. public function moveMount($target) {
  49. $result = $this->manager->setMountPoint($this->mountPoint, $target);
  50. $this->setMountPoint($target);
  51. return $result;
  52. }
  53. /**
  54. * Remove the mount points
  55. *
  56. * @return mixed
  57. * @return bool
  58. */
  59. public function removeMount() {
  60. return $this->manager->removeShare($this->mountPoint);
  61. }
  62. }