mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix: move mountpoint when transfering share
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
e5f77f004e
commit
3385cd4342
1 changed files with 14 additions and 2 deletions
|
|
@ -577,14 +577,16 @@ class OwnershipTransferService {
|
|||
$output->writeln('');
|
||||
}
|
||||
|
||||
private function transferIncomingShares(string $sourceUid,
|
||||
private function transferIncomingShares(
|
||||
string $sourceUid,
|
||||
string $destinationUid,
|
||||
array $sourceShares,
|
||||
array $destinationShares,
|
||||
OutputInterface $output,
|
||||
string $path,
|
||||
string $finalTarget,
|
||||
bool $move): void {
|
||||
bool $move,
|
||||
): void {
|
||||
$output->writeln('Restoring incoming shares ...');
|
||||
$progress = new ProgressBar($output, count($sourceShares));
|
||||
$prefix = "$destinationUid/files";
|
||||
|
|
@ -623,8 +625,11 @@ class OwnershipTransferService {
|
|||
if ($move) {
|
||||
continue;
|
||||
}
|
||||
$oldMountPoint = $this->getShareMountPoint($destinationUid, $share->getTarget());
|
||||
$newMountPoint = $this->getShareMountPoint($destinationUid, $shareTarget);
|
||||
$share->setTarget($shareTarget);
|
||||
$this->shareManager->moveShare($share, $destinationUid);
|
||||
$this->mountManager->moveMount($oldMountPoint, $newMountPoint);
|
||||
continue;
|
||||
}
|
||||
$this->shareManager->deleteShare($share);
|
||||
|
|
@ -642,8 +647,11 @@ class OwnershipTransferService {
|
|||
if ($move) {
|
||||
continue;
|
||||
}
|
||||
$oldMountPoint = $this->getShareMountPoint($destinationUid, $share->getTarget());
|
||||
$newMountPoint = $this->getShareMountPoint($destinationUid, $shareTarget);
|
||||
$share->setTarget($shareTarget);
|
||||
$this->shareManager->moveShare($share, $destinationUid);
|
||||
$this->mountManager->moveMount($oldMountPoint, $newMountPoint);
|
||||
continue;
|
||||
}
|
||||
} catch (NotFoundException $e) {
|
||||
|
|
@ -656,4 +664,8 @@ class OwnershipTransferService {
|
|||
$progress->finish();
|
||||
$output->writeln('');
|
||||
}
|
||||
|
||||
private function getShareMountPoint(string $uid, string $target): string {
|
||||
return '/' . $uid . '/files/' . trim($target, '/') . '/';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue