2014-06-12 10:14:43 -04:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2014-06-12 10:14:43 -04:00
|
|
|
/**
|
2024-06-06 13:48:28 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2014-06-12 10:14:43 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\Files_Sharing\External;
|
|
|
|
|
|
2014-11-24 09:54:42 -05:00
|
|
|
use OC\Files\Mount\MountPoint;
|
2014-06-12 10:14:43 -04:00
|
|
|
use OC\Files\Mount\MoveableMount;
|
2024-10-18 06:04:22 -04:00
|
|
|
use OC\Files\Storage\Storage;
|
2023-10-25 12:04:34 -04:00
|
|
|
use OCA\Files_Sharing\ISharedMountPoint;
|
2014-06-12 10:14:43 -04:00
|
|
|
|
2023-10-25 12:04:34 -04:00
|
|
|
class Mount extends MountPoint implements MoveableMount, ISharedMountPoint {
|
2014-06-12 10:14:43 -04:00
|
|
|
|
|
|
|
|
/**
|
2024-10-18 06:04:22 -04:00
|
|
|
* @param string|Storage $storage
|
2014-06-12 10:14:43 -04:00
|
|
|
* @param string $mountpoint
|
|
|
|
|
* @param array $options
|
|
|
|
|
* @param \OCA\Files_Sharing\External\Manager $manager
|
2014-11-24 09:54:42 -05:00
|
|
|
* @param \OC\Files\Storage\StorageFactory $loader
|
2014-06-12 10:14:43 -04:00
|
|
|
*/
|
2024-10-18 06:04:22 -04:00
|
|
|
public function __construct(
|
|
|
|
|
$storage,
|
|
|
|
|
$mountpoint,
|
|
|
|
|
$options,
|
|
|
|
|
protected $manager,
|
|
|
|
|
$loader = null,
|
|
|
|
|
) {
|
2022-02-02 10:12:57 -05:00
|
|
|
parent::__construct($storage, $mountpoint, $options, $loader, null, null, MountProvider::class);
|
2014-06-12 10:14:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Move the mount point to $target
|
|
|
|
|
*
|
|
|
|
|
* @param string $target the target mount point
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function moveMount($target) {
|
|
|
|
|
$result = $this->manager->setMountPoint($this->mountPoint, $target);
|
|
|
|
|
$this->setMountPoint($target);
|
2014-07-01 07:33:21 -04:00
|
|
|
|
2014-06-12 10:14:43 -04:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Remove the mount points
|
|
|
|
|
*/
|
2022-10-17 06:40:35 -04:00
|
|
|
public function removeMount(): bool {
|
2014-06-12 10:14:43 -04:00
|
|
|
return $this->manager->removeShare($this->mountPoint);
|
|
|
|
|
}
|
2018-01-11 04:16:07 -05:00
|
|
|
|
|
|
|
|
/**
|
2021-05-20 06:13:04 -04:00
|
|
|
* Get the type of mount point, used to distinguish things like shares and external storage
|
2018-01-11 04:16:07 -05:00
|
|
|
* in the web interface
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getMountType() {
|
|
|
|
|
return 'shared';
|
|
|
|
|
}
|
2014-06-12 10:14:43 -04:00
|
|
|
}
|