Skip to content

Commit b2dd580

Browse files
committed
chore: Replace MoveableMount usage with IMovableMount
The former is private API while the IMovableMount is public. Signed-off-by: Carl Schwan <carlschwan@kde.org>
1 parent 533125d commit b2dd580

19 files changed

Lines changed: 58 additions & 122 deletions

File tree

apps/dav/lib/Connector/Sabre/Directory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88
namespace OCA\DAV\Connector\Sabre;
99

10-
use OC\Files\Mount\MoveableMount;
1110
use OC\Files\Utils\PathHelper;
1211
use OC\Files\View;
1312
use OCA\DAV\AppInfo\Application;
@@ -22,6 +21,7 @@
2221
use OCP\Files\ForbiddenException;
2322
use OCP\Files\InvalidPathException;
2423
use OCP\Files\Mount\IMountManager;
24+
use OCP\Files\Mount\IMovableMount;
2525
use OCP\Files\NotFoundException;
2626
use OCP\Files\NotPermittedException;
2727
use OCP\Files\StorageNotAvailableException;
@@ -410,7 +410,7 @@ public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
410410
$isMovableMount = false;
411411
$sourceMount = Server::get(IMountManager::class)->find($this->fileView->getAbsolutePath($sourcePath));
412412
$internalPath = $sourceMount->getInternalPath($this->fileView->getAbsolutePath($sourcePath));
413-
if ($sourceMount instanceof MoveableMount && $internalPath === '') {
413+
if ($sourceMount instanceof IMovableMount && $internalPath === '') {
414414
$isMovableMount = true;
415415
}
416416

apps/dav/lib/Connector/Sabre/Node.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
namespace OCA\DAV\Connector\Sabre;
1111

12-
use OC\Files\Mount\MoveableMount;
1312
use OC\Files\Node\File;
1413
use OC\Files\Node\Folder;
1514
use OC\Files\View;
@@ -19,6 +18,7 @@
1918
use OCP\Files\FileInfo;
2019
use OCP\Files\InvalidPathException;
2120
use OCP\Files\IRootFolder;
21+
use OCP\Files\Mount\IMovableMount;
2222
use OCP\Files\NotFoundException;
2323
use OCP\Files\Storage\ISharedStorage;
2424
use OCP\Files\StorageNotAvailableException;
@@ -259,7 +259,7 @@ public function getSharePermissions(?string $user): int {
259259
* Eventually we need to do this properly
260260
*/
261261
$mountpoint = $this->info->getMountPoint();
262-
if (!($mountpoint instanceof MoveableMount)) {
262+
if (!($mountpoint instanceof IMovableMount)) {
263263
/**
264264
* @psalm-suppress UnnecessaryVarAnnotation Rector doesn't trust the return type annotation
265265
* @var string $mountpointpath

apps/files_external/lib/Lib/PersonalMount.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
*/
88
namespace OCA\Files_External\Lib;
99

10-
use OC\Files\Mount\MoveableMount;
1110
use OCA\Files_External\Config\ExternalMountPoint;
1211
use OCA\Files_External\Service\UserStoragesService;
12+
use OCP\Files\Mount\IMovableMount;
1313
use OCP\Files\Storage\IStorage;
1414
use OCP\Files\Storage\IStorageFactory;
15+
use Override;
1516

1617
/**
1718
* Person mount points can be moved by the user
1819
*/
19-
class PersonalMount extends ExternalMountPoint implements MoveableMount {
20+
class PersonalMount extends ExternalMountPoint implements IMovableMount {
2021
/**
2122
* @param UserStoragesService $storagesService
2223
* @param int $storageId
@@ -42,13 +43,8 @@ public function __construct(
4243
parent::__construct($storageConfig, $storage, $mountpoint, $arguments, $loader, $mountOptions, $mountId);
4344
}
4445

45-
/**
46-
* Move the mount point to $target
47-
*
48-
* @param string $target the target mount point
49-
* @return bool
50-
*/
51-
public function moveMount($target) {
46+
#[Override]
47+
public function moveMount(string $target): bool {
5248
$storage = $this->storagesService->getStorage($this->numericExternalStorageId);
5349
// remove "/$user/files" prefix
5450
$targetParts = explode('/', trim($target, '/'), 3);
@@ -58,12 +54,8 @@ public function moveMount($target) {
5854
return true;
5955
}
6056

61-
/**
62-
* Remove the mount points
63-
*
64-
* @return bool
65-
*/
66-
public function removeMount() {
57+
#[Override]
58+
public function removeMount(): bool {
6759
$this->storagesService->removeStorage($this->numericExternalStorageId);
6860
return true;
6961
}

apps/files_sharing/lib/External/Mount.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
namespace OCA\Files_Sharing\External;
99

1010
use OC\Files\Mount\MountPoint;
11-
use OC\Files\Mount\MoveableMount;
1211
use OC\Files\Storage\Storage;
1312
use OC\Files\Storage\StorageFactory;
1413
use OCA\Files_Sharing\ISharedMountPoint;
14+
use OCP\Files\Mount\IMovableMount;
1515
use Override;
1616

17-
class Mount extends MountPoint implements MoveableMount, ISharedMountPoint {
17+
class Mount extends MountPoint implements IMovableMount, ISharedMountPoint {
1818
public function __construct(
1919
string|Storage $storage,
2020
string $mountpoint,
@@ -25,21 +25,15 @@ public function __construct(
2525
parent::__construct($storage, $mountpoint, $options, $loader, null, null, MountProvider::class);
2626
}
2727

28-
/**
29-
* Move the mount point to $target
30-
*
31-
* @param string $target the target mount point
32-
*/
33-
public function moveMount($target): bool {
28+
#[Override]
29+
public function moveMount(string $target): bool {
3430
$result = $this->manager->setMountPoint($this->mountPoint, $target);
3531
$this->setMountPoint($target);
3632

3733
return $result;
3834
}
3935

40-
/**
41-
* Remove the mount points
42-
*/
36+
#[Override]
4337
public function removeMount(): bool {
4438
return $this->manager->removeShare($this->mountPoint);
4539
}

apps/files_sharing/lib/SharedMount.php

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,25 @@
1010

1111
use OC\Files\Filesystem;
1212
use OC\Files\Mount\MountPoint;
13-
use OC\Files\Mount\MoveableMount;
1413
use OCA\Files_Sharing\Exceptions\BrokenPath;
1514
use OCP\EventDispatcher\IEventDispatcher;
1615
use OCP\Files\Events\InvalidateMountCacheEvent;
16+
use OCP\Files\Mount\IMovableMount;
1717
use OCP\Files\Storage\IStorageFactory;
1818
use OCP\IDBConnection;
1919
use OCP\IUser;
2020
use OCP\Server;
2121
use OCP\Share\IShare;
22+
use Override;
2223
use Psr\Log\LoggerInterface;
2324

2425
/**
2526
* Shared mount points can be moved by the user
2627
*/
27-
class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint {
28-
/** @var ?SharedStorage $storage */
28+
class SharedMount extends MountPoint implements IMovableMount, ISharedMountPoint {
29+
/**
30+
* @var ?SharedStorage $storage
31+
*/
2932
protected $storage = null;
3033

3134
/** @var IShare */
@@ -74,7 +77,7 @@ private function updateFileTarget($newPath, &$share) {
7477
* @return string e.g. turns '/admin/files/test.txt' into '/test.txt'
7578
* @throws BrokenPath
7679
*/
77-
protected function stripUserFilesPath($path) {
80+
protected function stripUserFilesPath(string $path): string {
7881
$trimmed = ltrim($path, '/');
7982
$split = explode('/', $trimmed);
8083

@@ -91,13 +94,8 @@ protected function stripUserFilesPath($path) {
9194
return '/' . $relPath;
9295
}
9396

94-
/**
95-
* Move the mount point to $target
96-
*
97-
* @param string $target the target mount point
98-
* @return bool
99-
*/
100-
public function moveMount($target) {
97+
#[Override]
98+
public function moveMount(string $target): bool {
10199
$relTargetPath = $this->stripUserFilesPath($target);
102100
$share = $this->storage->getShare();
103101

@@ -120,12 +118,8 @@ public function moveMount($target) {
120118
return $result;
121119
}
122120

123-
/**
124-
* Remove the mount points
125-
*
126-
* @return bool
127-
*/
128-
public function removeMount() {
121+
#[Override]
122+
public function removeMount(): bool {
129123
$mountManager = Filesystem::getMountManager();
130124
/** @var SharedStorage $storage */
131125
$storage = $this->getStorage();
@@ -181,7 +175,8 @@ public function getNumericStorageId() {
181175
}
182176
}
183177

184-
public function getMountType() {
178+
#[Override]
179+
public function getMountType(): string {
185180
return 'shared';
186181
}
187182

apps/files_versions/lib/Listener/FileEventsListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
1111
use OC\DB\Exceptions\DbalException;
1212
use OC\Files\Filesystem;
13-
use OC\Files\Mount\MoveableMount;
1413
use OC\Files\Node\NonExistingFile;
1514
use OC\Files\Node\NonExistingFolder;
1615
use OC\Files\View;
@@ -36,6 +35,7 @@
3635
use OCP\Files\Folder;
3736
use OCP\Files\IMimeTypeLoader;
3837
use OCP\Files\IRootFolder;
38+
use OCP\Files\Mount\IMovableMount;
3939
use OCP\Files\Node;
4040
use OCP\Files\NotFoundException;
4141
use OCP\IUserSession;
@@ -396,7 +396,7 @@ public function pre_renameOrCopy_hook(Node $source, Node $target): void {
396396
$manager = Filesystem::getMountManager();
397397
$mount = $manager->find($absOldPath);
398398
$internalPath = $mount->getInternalPath($absOldPath);
399-
if ($internalPath === '' && $mount instanceof MoveableMount) {
399+
if ($internalPath === '' && $mount instanceof IMovableMount) {
400400
return;
401401
}
402402

core/BackgroundJobs/GenerateMetadataJob.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
namespace OC\Core\BackgroundJobs;
1010

11-
use OC\Files\Mount\MoveableMount;
1211
use OCP\AppFramework\Utility\ITimeFactory;
1312
use OCP\BackgroundJob\IJobList;
1413
use OCP\BackgroundJob\TimedJob;
1514
use OCP\Files\Folder;
1615
use OCP\Files\IRootFolder;
16+
use OCP\Files\Mount\IMovableMount;
1717
use OCP\FilesMetadata\Exceptions\FilesMetadataNotFoundException;
1818
use OCP\FilesMetadata\IFilesMetadataManager;
1919
use OCP\IAppConfig;
@@ -84,7 +84,7 @@ private function scanFilesForUser(string $userId): void {
8484

8585
private function scanFolder(Folder $folder): void {
8686
// Do not scan share and other moveable mounts.
87-
if ($folder->getMountPoint() instanceof MoveableMount) {
87+
if ($folder->getMountPoint() instanceof IMovableMount) {
8888
return;
8989
}
9090

lib/composer/composer/LICENSE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Copyright (c) Nils Adermann, Jordi Boggiano
32

43
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
1817
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1918
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2019
THE SOFTWARE.
21-

lib/composer/composer/autoload_classmap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,6 @@
17551755
'OC\\Files\\Mount\\LocalHomeMountProvider' => $baseDir . '/lib/private/Files/Mount/LocalHomeMountProvider.php',
17561756
'OC\\Files\\Mount\\Manager' => $baseDir . '/lib/private/Files/Mount/Manager.php',
17571757
'OC\\Files\\Mount\\MountPoint' => $baseDir . '/lib/private/Files/Mount/MountPoint.php',
1758-
'OC\\Files\\Mount\\MoveableMount' => $baseDir . '/lib/private/Files/Mount/MoveableMount.php',
17591758
'OC\\Files\\Mount\\ObjectHomeMountProvider' => $baseDir . '/lib/private/Files/Mount/ObjectHomeMountProvider.php',
17601759
'OC\\Files\\Mount\\RootMountProvider' => $baseDir . '/lib/private/Files/Mount/RootMountProvider.php',
17611760
'OC\\Files\\Node\\File' => $baseDir . '/lib/private/Files/Node/File.php',

lib/composer/composer/autoload_static.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
17961796
'OC\\Files\\Mount\\LocalHomeMountProvider' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/LocalHomeMountProvider.php',
17971797
'OC\\Files\\Mount\\Manager' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/Manager.php',
17981798
'OC\\Files\\Mount\\MountPoint' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/MountPoint.php',
1799-
'OC\\Files\\Mount\\MoveableMount' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/MoveableMount.php',
18001799
'OC\\Files\\Mount\\ObjectHomeMountProvider' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/ObjectHomeMountProvider.php',
18011800
'OC\\Files\\Mount\\RootMountProvider' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/RootMountProvider.php',
18021801
'OC\\Files\\Node\\File' => __DIR__ . '/../../..' . '/lib/private/Files/Node/File.php',

0 commit comments

Comments
 (0)