Merge pull request #48746 from nextcloud/backport/46124/stable30

This commit is contained in:
John Molakvoæ 2024-10-29 11:33:42 +01:00 committed by GitHub
commit a9dd34ab35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -47,6 +47,7 @@ class OwnershipTransferService {
private IUserMountCache $userMountCache,
private IUserManager $userManager,
private IFactory $l10nFactory,
private IRootFolder $rootFolder,
) {
$this->encryptionManager = $encryptionManager;
}
@ -85,8 +86,10 @@ class OwnershipTransferService {
// Requesting the user folder will set it up if the user hasn't logged in before
// We need a setupFS for the full filesystem setup before as otherwise we will just return
// 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($destinationUser->getUID());
$this->rootFolder->getUserFolder($sourceUser->getUID());
$this->rootFolder->getUserFolder($destinationUser->getUID());
Filesystem::initMountPoints($sourceUid);
Filesystem::initMountPoints($destinationUid);
@ -416,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 {
@ -455,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);