aboutsummaryrefslogtreecommitdiffstats
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 16:16:38 -0700
commit6090985ca3b21bfc6096aaeb943e4a75bc919b83 (patch)
tree25c4679a3f2a11db419d616a7c945366e47292cc
parenta7ca1c6289decd5f40933d50dd12878041a12d69 (diff)
downloadnextcloud-server-6090985ca3b21bfc6096aaeb943e4a75bc919b83.tar.gz
nextcloud-server-6090985ca3b21bfc6096aaeb943e4a75bc919b83.zip
refactor: Inject IRootFolderbackport/46124/stable30
Signed-off-by: Christopher Ng <chrng8@gmail.com>
-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 b2c40270778..f324d1e449a 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);
@@ -418,7 +419,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 {
@@ -457,7 +457,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);