aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Service/OwnershipTransferService.php
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2024-06-27 11:40:05 -0700
committerChristopher Ng <chrng8@gmail.com>2024-10-16 15:28:12 -0700
commit7ba52eae35ae40efe05775a11c2b1a278754fdf9 (patch)
tree3909d5ffbc71a62ff5abb1a858e82b7290f8e4a2 /apps/files/lib/Service/OwnershipTransferService.php
parent53f0b3789e19e94e323f9e2ea827b90ae10a7a63 (diff)
downloadnextcloud-server-7ba52eae35ae40efe05775a11c2b1a278754fdf9.tar.gz
nextcloud-server-7ba52eae35ae40efe05775a11c2b1a278754fdf9.zip
refactor: Inject IRootFolder
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/files/lib/Service/OwnershipTransferService.php')
-rw-r--r--apps/files/lib/Service/OwnershipTransferService.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php
index 720b7c62e21..b5ae26d8b1f 100644
--- a/apps/files/lib/Service/OwnershipTransferService.php
+++ b/apps/files/lib/Service/OwnershipTransferService.php
@@ -50,6 +50,7 @@ class OwnershipTransferService {
private IUserMountCache $userMountCache,
private IUserManager $userManager,
private IFactory $l10nFactory,
+ private IRootFolder $rootFolder,
) {
$this->encryptionManager = $encryptionManager;
}
@@ -90,8 +91,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);
@@ -421,7 +422,6 @@ class OwnershipTransferService {
):void {
$output->writeln('Restoring shares ...');
$progress = new ProgressBar($output, count($shares));
- $rootFolder = Server::get(IRootFolder::class);
foreach ($shares as ['share' => $share, 'suffix' => $suffix]) {
try {
@@ -461,7 +461,7 @@ class OwnershipTransferService {
} catch (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);
}