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;
|
2025-12-09 05:20:37 -05:00
|
|
|
use OC\Files\Storage\StorageFactory;
|
2023-10-25 12:04:34 -04:00
|
|
|
use OCA\Files_Sharing\ISharedMountPoint;
|
2025-12-09 05:20:37 -05:00
|
|
|
use Override;
|
2014-06-12 10:14:43 -04:00
|
|
|
|
2023-10-25 12:04:34 -04:00
|
|
|
class Mount extends MountPoint implements MoveableMount, ISharedMountPoint {
|
2024-10-18 06:04:22 -04:00
|
|
|
public function __construct(
|
2025-12-09 05:20:37 -05:00
|
|
|
string|Storage $storage,
|
|
|
|
|
string $mountpoint,
|
|
|
|
|
array $options,
|
|
|
|
|
protected Manager $manager,
|
|
|
|
|
?StorageFactory $loader = null,
|
2024-10-18 06:04:22 -04:00
|
|
|
) {
|
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
|
|
|
|
|
*/
|
2025-10-29 11:50:50 -04:00
|
|
|
public function moveMount($target): bool {
|
2014-06-12 10:14:43 -04:00
|
|
|
$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
|
|
|
|
2025-12-09 05:20:37 -05:00
|
|
|
#[Override]
|
2025-10-29 11:50:50 -04:00
|
|
|
public function getMountType(): string {
|
2018-01-11 04:16:07 -05:00
|
|
|
return 'shared';
|
|
|
|
|
}
|
2014-06-12 10:14:43 -04:00
|
|
|
}
|