diff options
author | Christopher Ng <chrng8@gmail.com> | 2024-06-27 11:40:05 -0700 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2024-10-16 16:10:09 -0700 |
commit | 0f9cf04537ecdd5d0831365e83850c95ac002547 (patch) | |
tree | 59393fb507bab61a7c8aca2252cd8d72208ec374 | |
parent | b14e53666b24873fd7fa66aa3b2cc5fa4f5142d3 (diff) | |
download | nextcloud-server-0f9cf04537ecdd5d0831365e83850c95ac002547.tar.gz nextcloud-server-0f9cf04537ecdd5d0831365e83850c95ac002547.zip |
refactor: Inject IRootFolderbackport/46124/stable28
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 16300cba80e..283a49932f7 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -69,6 +69,7 @@ class OwnershipTransferService { private IMountManager $mountManager, private IUserMountCache $userMountCache, private IUserManager $userManager, + private IRootFolder $rootFolder, ) { $this->encryptionManager = $encryptionManager; } @@ -109,8 +110,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); @@ -437,7 +438,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 { @@ -477,7 +477,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(); $output->writeln('Had to change node id to ' . $newNodeId, OutputInterface::VERBOSITY_VERY_VERBOSE); } |