Skip to content

Commit 7e51798

Browse files
Pytalsorbaugh
authored andcommitted
refactor: Inject IRootFolder
Signed-off-by: Christopher Ng <[email protected]>
1 parent 176bf9b commit 7e51798

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

@@ -395,7 +396,6 @@ private function restoreShares(
395396
):void {
396397
$output->writeln('Restoring shares ...');
397398
$progress = new ProgressBar($output, count($shares));
398-
$rootFolder = \OCP\Server::get(IRootFolder::class);
399399

400400
foreach ($shares as ['share' => $share, 'suffix' => $suffix]) {
401401
try {
@@ -434,7 +434,7 @@ private function restoreShares(
434434
} catch (\OCP\Files\NotFoundException) {
435435
// ID has changed due to transfer between different storages
436436
// Try to get the new ID from the target path and suffix of the share
437-
$node = $rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix));
437+
$node = $this->rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix));
438438
$newNodeId = $node->getId();
439439
}
440440
$share->setNodeId($newNodeId);

0 commit comments

Comments
 (0)