Skip to content

Commit 6090985

Browse files
committed
refactor: Inject IRootFolder
Signed-off-by: Christopher Ng <[email protected]>
1 parent a7ca1c6 commit 6090985

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

apps/files/lib/Service/OwnershipTransferService.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function __construct(
4747
private IUserMountCache $userMountCache,
4848
private IUserManager $userManager,
4949
private IFactory $l10nFactory,
50+
private IRootFolder $rootFolder,
5051
) {
5152
$this->encryptionManager = $encryptionManager;
5253
}
@@ -87,8 +88,8 @@ public function transfer(
8788
// a lazy root folder which does not create the destination users folder
8889
\OC_Util::setupFS($sourceUser->getUID());
8990
\OC_Util::setupFS($destinationUser->getUID());
90-
\OC::$server->getUserFolder($sourceUser->getUID());
91-
\OC::$server->getUserFolder($destinationUser->getUID());
91+
$this->rootFolder->getUserFolder($sourceUser->getUID());
92+
$this->rootFolder->getUserFolder($destinationUser->getUID());
9293
Filesystem::initMountPoints($sourceUid);
9394
Filesystem::initMountPoints($destinationUid);
9495

@@ -418,7 +419,6 @@ private function restoreShares(
418419
):void {
419420
$output->writeln("Restoring shares ...");
420421
$progress = new ProgressBar($output, count($shares));
421-
$rootFolder = \OCP\Server::get(IRootFolder::class);
422422

423423
foreach ($shares as ['share' => $share, 'suffix' => $suffix]) {
424424
try {
@@ -457,7 +457,7 @@ private function restoreShares(
457457
} catch (\OCP\Files\NotFoundException) {
458458
// ID has changed due to transfer between different storages
459459
// Try to get the new ID from the target path and suffix of the share
460-
$node = $rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix));
460+
$node = $this->rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix));
461461
$newNodeId = $node->getId();
462462
}
463463
$share->setNodeId($newNodeId);

0 commit comments

Comments
 (0)