diff options
author | Christopher Ng <chrng8@gmail.com> | 2024-06-27 11:40:05 -0700 |
---|---|---|
committer | Stephan Orbaugh <62374139+sorbaugh@users.noreply.github.com> | 2024-09-05 17:53:37 +0200 |
commit | 7e51798e62d7c1451773449bcd4b304f2bc3344a (patch) | |
tree | 6d538d3cbd537570379424819e847cbe1430ec8d | |
parent | 176bf9ba1cb22c7634ce145e9e97aa3b956913ef (diff) | |
download | nextcloud-server-fix/ownership-transfer-source-user-files.tar.gz nextcloud-server-fix/ownership-transfer-source-user-files.zip |
refactor: Inject IRootFolderfix/ownership-transfer-source-user-files
Signed-off-by: Christopher Ng <chrng8@gmail.com>
-rw-r--r-- | apps/files/lib/Service/OwnershipTransferService.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 8715c845b83..750925b9129 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -47,6 +47,7 @@ class OwnershipTransferService { private IUserMountCache $userMountCache, private IUserManager $userManager, private IFactory $l10nFactory, + private IRootFolder $rootFolder, ) { $this->encryptionManager = $encryptionManager; } @@ -87,8 +88,8 @@ class OwnershipTransferService { // a lazy root folder which does not create the destination users folder \OC_Util::setupFS($sourceUser->getUID()); \OC_Util::setupFS($destinationUser->getUID()); - \OC::$server->getUserFolder($sourceUser->getUID()); - \OC::$server->getUserFolder($destinationUser->getUID()); + $this->rootFolder->getUserFolder($sourceUser->getUID()); + $this->rootFolder->getUserFolder($destinationUser->getUID()); Filesystem::initMountPoints($sourceUid); Filesystem::initMountPoints($destinationUid); @@ -395,7 +396,6 @@ class OwnershipTransferService { ):void { $output->writeln('Restoring shares ...'); $progress = new ProgressBar($output, count($shares)); - $rootFolder = \OCP\Server::get(IRootFolder::class); foreach ($shares as ['share' => $share, 'suffix' => $suffix]) { try { @@ -434,7 +434,7 @@ class OwnershipTransferService { } catch (\OCP\Files\NotFoundException) { // ID has changed due to transfer between different storages // Try to get the new ID from the target path and suffix of the share - $node = $rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix)); + $node = $this->rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix)); $newNodeId = $node->getId(); } $share->setNodeId($newNodeId); |