mirror of
https://github.com/nextcloud/server.git
synced 2026-04-03 08:05:43 -04:00
Merge b86acb26c1 into 521e61828f
This commit is contained in:
commit
cc7c727c76
17 changed files with 55 additions and 119 deletions
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
namespace OCA\DAV\Connector\Sabre;
|
||||
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\Files\Utils\PathHelper;
|
||||
use OC\Files\View;
|
||||
use OCA\DAV\AppInfo\Application;
|
||||
|
|
@ -22,6 +21,7 @@ use OCP\Files\Folder;
|
|||
use OCP\Files\ForbiddenException;
|
||||
use OCP\Files\InvalidPathException;
|
||||
use OCP\Files\Mount\IMountManager;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\NotPermittedException;
|
||||
use OCP\Files\StorageNotAvailableException;
|
||||
|
|
@ -410,7 +410,7 @@ class Directory extends Node implements
|
|||
$isMovableMount = false;
|
||||
$sourceMount = Server::get(IMountManager::class)->find($this->fileView->getAbsolutePath($sourcePath));
|
||||
$internalPath = $sourceMount->getInternalPath($this->fileView->getAbsolutePath($sourcePath));
|
||||
if ($sourceMount instanceof MoveableMount && $internalPath === '') {
|
||||
if ($sourceMount instanceof IMovableMount && $internalPath === '') {
|
||||
$isMovableMount = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OCA\DAV\Connector\Sabre;
|
||||
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\Files\Node\File;
|
||||
use OC\Files\Node\Folder;
|
||||
use OC\Files\View;
|
||||
|
|
@ -19,6 +18,7 @@ use OCP\Files\DavUtil;
|
|||
use OCP\Files\FileInfo;
|
||||
use OCP\Files\InvalidPathException;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\Storage\ISharedStorage;
|
||||
use OCP\Files\StorageNotAvailableException;
|
||||
|
|
@ -259,7 +259,7 @@ abstract class Node implements INode {
|
|||
* Eventually we need to do this properly
|
||||
*/
|
||||
$mountpoint = $this->info->getMountPoint();
|
||||
if (!($mountpoint instanceof MoveableMount)) {
|
||||
if (!($mountpoint instanceof IMovableMount)) {
|
||||
/**
|
||||
* @psalm-suppress UnnecessaryVarAnnotation Rector doesn't trust the return type annotation
|
||||
* @var string $mountpointpath
|
||||
|
|
|
|||
|
|
@ -7,16 +7,17 @@
|
|||
*/
|
||||
namespace OCA\Files_External\Lib;
|
||||
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OCA\Files_External\Config\ExternalMountPoint;
|
||||
use OCA\Files_External\Service\UserStoragesService;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use OCP\Files\Storage\IStorage;
|
||||
use OCP\Files\Storage\IStorageFactory;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Person mount points can be moved by the user
|
||||
*/
|
||||
class PersonalMount extends ExternalMountPoint implements MoveableMount {
|
||||
class PersonalMount extends ExternalMountPoint implements IMovableMount {
|
||||
/**
|
||||
* @param UserStoragesService $storagesService
|
||||
* @param int $storageId
|
||||
|
|
@ -42,13 +43,8 @@ class PersonalMount extends ExternalMountPoint implements MoveableMount {
|
|||
parent::__construct($storageConfig, $storage, $mountpoint, $arguments, $loader, $mountOptions, $mountId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the mount point to $target
|
||||
*
|
||||
* @param string $target the target mount point
|
||||
* @return bool
|
||||
*/
|
||||
public function moveMount($target) {
|
||||
#[Override]
|
||||
public function moveMount(string $target): bool {
|
||||
$storage = $this->storagesService->getStorage($this->numericExternalStorageId);
|
||||
// remove "/$user/files" prefix
|
||||
$targetParts = explode('/', trim($target, '/'), 3);
|
||||
|
|
@ -58,12 +54,8 @@ class PersonalMount extends ExternalMountPoint implements MoveableMount {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the mount points
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function removeMount() {
|
||||
#[Override]
|
||||
public function removeMount(): bool {
|
||||
$this->storagesService->removeStorage($this->numericExternalStorageId);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
16
apps/files_sharing/lib/External/Mount.php
vendored
16
apps/files_sharing/lib/External/Mount.php
vendored
|
|
@ -8,13 +8,13 @@
|
|||
namespace OCA\Files_Sharing\External;
|
||||
|
||||
use OC\Files\Mount\MountPoint;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\Files\Storage\Storage;
|
||||
use OC\Files\Storage\StorageFactory;
|
||||
use OCA\Files_Sharing\ISharedMountPoint;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use Override;
|
||||
|
||||
class Mount extends MountPoint implements MoveableMount, ISharedMountPoint {
|
||||
class Mount extends MountPoint implements IMovableMount, ISharedMountPoint {
|
||||
public function __construct(
|
||||
string|Storage $storage,
|
||||
string $mountpoint,
|
||||
|
|
@ -25,21 +25,15 @@ class Mount extends MountPoint implements MoveableMount, ISharedMountPoint {
|
|||
parent::__construct($storage, $mountpoint, $options, $loader, null, null, MountProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the mount point to $target
|
||||
*
|
||||
* @param string $target the target mount point
|
||||
*/
|
||||
public function moveMount($target): bool {
|
||||
#[Override]
|
||||
public function moveMount(string $target): bool {
|
||||
$result = $this->manager->setMountPoint($this->mountPoint, $target);
|
||||
$this->setMountPoint($target);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the mount points
|
||||
*/
|
||||
#[Override]
|
||||
public function removeMount(): bool {
|
||||
return $this->manager->removeShare($this->mountPoint);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,22 +10,25 @@ namespace OCA\Files_Sharing;
|
|||
|
||||
use OC\Files\Filesystem;
|
||||
use OC\Files\Mount\MountPoint;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OCA\Files_Sharing\Exceptions\BrokenPath;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\Events\InvalidateMountCacheEvent;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use OCP\Files\Storage\IStorageFactory;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IUser;
|
||||
use OCP\Server;
|
||||
use OCP\Share\IShare;
|
||||
use Override;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Shared mount points can be moved by the user
|
||||
*/
|
||||
class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint {
|
||||
/** @var ?SharedStorage $storage */
|
||||
class SharedMount extends MountPoint implements IMovableMount, ISharedMountPoint {
|
||||
/**
|
||||
* @var ?SharedStorage $storage
|
||||
*/
|
||||
protected $storage = null;
|
||||
|
||||
/** @var IShare */
|
||||
|
|
@ -74,7 +77,7 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
|
|||
* @return string e.g. turns '/admin/files/test.txt' into '/test.txt'
|
||||
* @throws BrokenPath
|
||||
*/
|
||||
protected function stripUserFilesPath($path) {
|
||||
protected function stripUserFilesPath(string $path): string {
|
||||
$trimmed = ltrim($path, '/');
|
||||
$split = explode('/', $trimmed);
|
||||
|
||||
|
|
@ -91,13 +94,8 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
|
|||
return '/' . $relPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the mount point to $target
|
||||
*
|
||||
* @param string $target the target mount point
|
||||
* @return bool
|
||||
*/
|
||||
public function moveMount($target) {
|
||||
#[Override]
|
||||
public function moveMount(string $target): bool {
|
||||
$relTargetPath = $this->stripUserFilesPath($target);
|
||||
$share = $this->storage->getShare();
|
||||
|
||||
|
|
@ -120,12 +118,8 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the mount points
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function removeMount() {
|
||||
#[Override]
|
||||
public function removeMount(): bool {
|
||||
$mountManager = Filesystem::getMountManager();
|
||||
/** @var SharedStorage $storage */
|
||||
$storage = $this->getStorage();
|
||||
|
|
@ -181,7 +175,8 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
|
|||
}
|
||||
}
|
||||
|
||||
public function getMountType() {
|
||||
#[Override]
|
||||
public function getMountType(): string {
|
||||
return 'shared';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ namespace OCA\Files_Versions\Listener;
|
|||
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
||||
use OC\DB\Exceptions\DbalException;
|
||||
use OC\Files\Filesystem;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\Files\Node\NonExistingFile;
|
||||
use OC\Files\Node\NonExistingFolder;
|
||||
use OC\Files\View;
|
||||
|
|
@ -36,6 +35,7 @@ use OCP\Files\File;
|
|||
use OCP\Files\Folder;
|
||||
use OCP\Files\IMimeTypeLoader;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use OCP\Files\Node;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -396,7 +396,7 @@ class FileEventsListener implements IEventListener {
|
|||
$manager = Filesystem::getMountManager();
|
||||
$mount = $manager->find($absOldPath);
|
||||
$internalPath = $mount->getInternalPath($absOldPath);
|
||||
if ($internalPath === '' && $mount instanceof MoveableMount) {
|
||||
if ($internalPath === '' && $mount instanceof IMovableMount) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace OC\Core\BackgroundJobs;
|
||||
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\BackgroundJob\IJobList;
|
||||
use OCP\BackgroundJob\TimedJob;
|
||||
use OCP\Files\Folder;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use OCP\FilesMetadata\Exceptions\FilesMetadataNotFoundException;
|
||||
use OCP\FilesMetadata\IFilesMetadataManager;
|
||||
use OCP\IAppConfig;
|
||||
|
|
@ -84,7 +84,7 @@ class GenerateMetadataJob extends TimedJob {
|
|||
|
||||
private function scanFolder(Folder $folder): void {
|
||||
// Do not scan share and other moveable mounts.
|
||||
if ($folder->getMountPoint() instanceof MoveableMount) {
|
||||
if ($folder->getMountPoint() instanceof IMovableMount) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
|
@ -18,4 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
|
|
|||
|
|
@ -1755,7 +1755,6 @@ return array(
|
|||
'OC\\Files\\Mount\\LocalHomeMountProvider' => $baseDir . '/lib/private/Files/Mount/LocalHomeMountProvider.php',
|
||||
'OC\\Files\\Mount\\Manager' => $baseDir . '/lib/private/Files/Mount/Manager.php',
|
||||
'OC\\Files\\Mount\\MountPoint' => $baseDir . '/lib/private/Files/Mount/MountPoint.php',
|
||||
'OC\\Files\\Mount\\MoveableMount' => $baseDir . '/lib/private/Files/Mount/MoveableMount.php',
|
||||
'OC\\Files\\Mount\\ObjectHomeMountProvider' => $baseDir . '/lib/private/Files/Mount/ObjectHomeMountProvider.php',
|
||||
'OC\\Files\\Mount\\RootMountProvider' => $baseDir . '/lib/private/Files/Mount/RootMountProvider.php',
|
||||
'OC\\Files\\Node\\File' => $baseDir . '/lib/private/Files/Node/File.php',
|
||||
|
|
|
|||
|
|
@ -1796,7 +1796,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
|||
'OC\\Files\\Mount\\LocalHomeMountProvider' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/LocalHomeMountProvider.php',
|
||||
'OC\\Files\\Mount\\Manager' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/Manager.php',
|
||||
'OC\\Files\\Mount\\MountPoint' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/MountPoint.php',
|
||||
'OC\\Files\\Mount\\MoveableMount' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/MoveableMount.php',
|
||||
'OC\\Files\\Mount\\ObjectHomeMountProvider' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/ObjectHomeMountProvider.php',
|
||||
'OC\\Files\\Mount\\RootMountProvider' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/RootMountProvider.php',
|
||||
'OC\\Files\\Node\\File' => __DIR__ . '/../../..' . '/lib/private/Files/Node/File.php',
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
namespace OC\Files\Mount;
|
||||
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
|
||||
/**
|
||||
* Defines the mount point to be (re)moved by the user
|
||||
*/
|
||||
interface MoveableMount extends IMovableMount {
|
||||
/**
|
||||
* Move the mount point to $target
|
||||
*
|
||||
* @param string $target the target mount point
|
||||
* @return bool
|
||||
*/
|
||||
public function moveMount($target);
|
||||
|
||||
/**
|
||||
* Remove the mount points
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function removeMount();
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@
|
|||
namespace OC\Files\Node;
|
||||
|
||||
use OC\Files\Filesystem;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\Files\Utils\PathHelper;
|
||||
use OC\Files\View;
|
||||
use OCP\Constants;
|
||||
|
|
@ -17,6 +16,7 @@ use OCP\EventDispatcher\IEventDispatcher;
|
|||
use OCP\Files\FileInfo;
|
||||
use OCP\Files\InvalidPathException;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use OCP\Files\Node as INode;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\NotPermittedException;
|
||||
|
|
@ -433,7 +433,7 @@ class Node implements INode {
|
|||
$parent->isCreatable()
|
||||
|| (
|
||||
$parent->getInternalPath() === ''
|
||||
&& ($parent->getMountPoint() instanceof MoveableMount)
|
||||
&& ($parent->getMountPoint() instanceof IMovableMount)
|
||||
)
|
||||
)
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ use Icewind\Streams\CallbackWrapper;
|
|||
use OC\Files\Cache\CacheEntry;
|
||||
use OC\Files\Cache\Scanner;
|
||||
use OC\Files\Mount\MountPoint;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\Files\Storage\Storage;
|
||||
use OC\Files\Storage\Wrapper\Quota;
|
||||
use OC\Files\Utils\PathHelper;
|
||||
|
|
@ -35,6 +34,7 @@ use OCP\Files\InvalidPathException;
|
|||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMountManager;
|
||||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\ReservedWordException;
|
||||
use OCP\Files\Storage\IStorage;
|
||||
|
|
@ -242,7 +242,7 @@ class View {
|
|||
* @param string $path relative to data/
|
||||
*/
|
||||
protected function removeMount($mount, $path): bool {
|
||||
if ($mount instanceof MoveableMount) {
|
||||
if ($mount instanceof IMovableMount) {
|
||||
// cut of /user/files to get the relative path to data/user/files
|
||||
$pathParts = explode('/', $path, 4);
|
||||
$relPath = '/' . $pathParts[3];
|
||||
|
|
@ -501,7 +501,7 @@ class View {
|
|||
$absolutePath = $this->getAbsolutePath($path);
|
||||
$mount = Filesystem::getMountManager()->find($absolutePath);
|
||||
if ($mount->getInternalPath($absolutePath) === '') {
|
||||
return $mount instanceof MoveableMount;
|
||||
return $mount instanceof IMovableMount;
|
||||
}
|
||||
return $this->basicOperation('isDeletable', $path);
|
||||
}
|
||||
|
|
@ -810,7 +810,7 @@ class View {
|
|||
$movedMounts[] = $mount1;
|
||||
$this->validateMountMove($movedMounts, $sourceParentMount, $mount2, !$this->targetIsNotShared($targetUser, $absolutePath2));
|
||||
/**
|
||||
* @var MountPoint|MoveableMount $mount1
|
||||
* @var MountPoint|IMovableMount $mount1
|
||||
*/
|
||||
$sourceMountPoint = $mount1->getMountPoint();
|
||||
$result = $mount1->moveMount($absolutePath2);
|
||||
|
|
@ -900,7 +900,7 @@ class View {
|
|||
$sourcePath = $mount->getMountPoint();
|
||||
}
|
||||
|
||||
if (!$mount instanceof MoveableMount) {
|
||||
if (!$mount instanceof IMovableMount) {
|
||||
throw new ForbiddenException($l->t('Storage %s cannot be moved', [$sourcePath]), false);
|
||||
}
|
||||
|
||||
|
|
@ -1452,7 +1452,7 @@ class View {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($mount instanceof MoveableMount && $internalPath === '') {
|
||||
if ($mount instanceof IMovableMount && $internalPath === '') {
|
||||
$data['permissions'] |= Constants::PERMISSION_DELETE;
|
||||
}
|
||||
if ($internalPath === '' && $data['name']) {
|
||||
|
|
@ -1650,7 +1650,7 @@ class View {
|
|||
$permissions = $rootEntry['permissions'];
|
||||
// do not allow renaming/deleting the mount point if they are not shared files/folders
|
||||
// for shared files/folders we use the permissions given by the owner
|
||||
if ($mount instanceof MoveableMount) {
|
||||
if ($mount instanceof IMovableMount) {
|
||||
$rootEntry['permissions'] = $permissions | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE;
|
||||
} else {
|
||||
$rootEntry['permissions'] = $permissions & (Constants::PERMISSION_ALL - (Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE));
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ namespace OC\Share20;
|
|||
use ArrayIterator;
|
||||
use OC\Core\AppInfo\ConfigLexicon;
|
||||
use OC\Files\Filesystem;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\KnownUser\KnownUserService;
|
||||
use OC\Share\Constants as ShareConstants;
|
||||
use OC\Share20\Exception\ProviderException;
|
||||
|
|
@ -26,6 +25,7 @@ use OCP\Files\File;
|
|||
use OCP\Files\Folder;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Mount\IMountManager;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use OCP\Files\Mount\IShareOwnerlessMount;
|
||||
use OCP\Files\Node;
|
||||
use OCP\Files\NotFoundException;
|
||||
|
|
@ -241,7 +241,7 @@ class Manager implements IManager {
|
|||
$permissions = 0;
|
||||
$nodesForUser = $userFolder->getById($share->getNodeId());
|
||||
foreach ($nodesForUser as $node) {
|
||||
if ($node->getInternalPath() === '' && !$node->getMountPoint() instanceof MoveableMount) {
|
||||
if ($node->getInternalPath() === '' && !$node->getMountPoint() instanceof IMovableMount) {
|
||||
// for the root of non-movable mount, the permissions we see if limited by the mount itself,
|
||||
// so we instead use the "raw" permissions from the storage
|
||||
$permissions |= $node->getStorage()->getPermissions('');
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace OCP\Files;
|
||||
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OCP\Constants;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
|
||||
|
|
@ -83,7 +82,7 @@ class DavUtil {
|
|||
|
||||
public static function canRename(FileInfo $info, FileInfo $parent): bool {
|
||||
// the root of a movable mountpoint can be renamed regardless of the file permissions
|
||||
if ($info->getMountPoint() instanceof MoveableMount && $info->getInternalPath() === '') {
|
||||
if ($info->getMountPoint() instanceof IMovableMount && $info->getInternalPath() === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ interface IMovableMount {
|
|||
* @return bool
|
||||
* @since 28.0.0
|
||||
*/
|
||||
public function moveMount($target);
|
||||
public function moveMount(string $target);
|
||||
|
||||
/**
|
||||
* Remove the mount points
|
||||
|
|
|
|||
|
|
@ -8,30 +8,22 @@
|
|||
|
||||
namespace Test;
|
||||
|
||||
use OC\Files\Mount;
|
||||
use OC\Files\Mount\MountPoint;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OCP\Files\Mount\IMovableMount;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Test moveable mount for mocking
|
||||
*/
|
||||
class TestMoveableMountPoint extends MountPoint implements MoveableMount {
|
||||
/**
|
||||
* Move the mount point to $target
|
||||
*
|
||||
* @param string $target the target mount point
|
||||
* @return bool
|
||||
*/
|
||||
public function moveMount($target) {
|
||||
class TestMoveableMountPoint extends MountPoint implements IMovableMount {
|
||||
#[Override]
|
||||
public function moveMount(string $target): bool {
|
||||
$this->setMountPoint($target);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the mount points
|
||||
*
|
||||
* @return mixed
|
||||
* @return bool
|
||||
*/
|
||||
public function removeMount() {
|
||||
#[Override]
|
||||
public function removeMount(): bool {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue