From f31b794addd85f1d41a0ab112e824ece7f7ca009 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 2 Nov 2016 19:53:23 +0100 Subject: Transfer ownership only analyze home storage When transferring ownership, only the local files will be transferred during the rename operation. This means that the analyzing code doesn't need to recurse into any mount points. Furthermore this fixes issues where FailedStorage might appear as mount points as a result of inaccessible external storages or shares. So this makes it more robust. --- apps/files/lib/Command/TransferOwnership.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apps/files') diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php index 3b51e4a9e6d..13cbe62ff6f 100644 --- a/apps/files/lib/Command/TransferOwnership.php +++ b/apps/files/lib/Command/TransferOwnership.php @@ -157,6 +157,11 @@ class TransferOwnership extends Command { $this->walkFiles($view, "$this->sourceUser/files", function (FileInfo $fileInfo) use ($progress, $self) { if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { + // only analyze into folders from main storage, + // sub-storages have an empty internal path + if ($fileInfo->getInternalPath() === '' && $fileInfo->getPath() !== '') { + return false; + } return true; } $progress->advance(); -- cgit v1.2.3 From 7e6830729e0d38ac22b4e337908d1a53f111f3c9 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 14 Nov 2016 17:21:24 +0100 Subject: Test on storage Signed-off-by: Roeland Jago Douma --- apps/files/lib/Command/TransferOwnership.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/files') diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php index 13cbe62ff6f..378654d5bf8 100644 --- a/apps/files/lib/Command/TransferOwnership.php +++ b/apps/files/lib/Command/TransferOwnership.php @@ -27,6 +27,7 @@ namespace OCA\Files\Command; use OC\Files\Filesystem; use OC\Files\View; use OCP\Files\FileInfo; +use OCP\Files\IHomeStorage; use OCP\Files\Mount\IMountManager; use OCP\IUser; use OCP\IUserManager; @@ -158,8 +159,7 @@ class TransferOwnership extends Command { function (FileInfo $fileInfo) use ($progress, $self) { if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { // only analyze into folders from main storage, - // sub-storages have an empty internal path - if ($fileInfo->getInternalPath() === '' && $fileInfo->getPath() !== '') { + if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { return false; } return true; -- cgit v1.2.3