mirror of
https://github.com/nextcloud/server.git
synced 2026-04-28 17:48:40 -04:00
refactor: Inject IRootFolder
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
53f0b3789e
commit
7ba52eae35
1 changed files with 4 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue