mirror of
https://github.com/nextcloud/server.git
synced 2026-05-12 16:39:39 -04:00
fix: Transfer incomming shares first, do not delete non-migratable ones
Canceling the previous add of deletion of invalid shares in transferownership because in some cases it deletes valid reshares, if incoming shares are not transfered on purpose. Inverting the order of transfer between incoming and outgoing so that reshare can be migrated when incoming shares are transfered. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
257b516f4e
commit
58b64ad567
1 changed files with 10 additions and 13 deletions
|
|
@ -176,16 +176,6 @@ class OwnershipTransferService {
|
|||
$output
|
||||
);
|
||||
|
||||
$destinationPath = $finalTarget . '/' . $path;
|
||||
// restore the shares
|
||||
$this->restoreShares(
|
||||
$sourceUid,
|
||||
$destinationUid,
|
||||
$destinationPath,
|
||||
$shares,
|
||||
$output
|
||||
);
|
||||
|
||||
// transfer the incoming shares
|
||||
if ($transferIncomingShares === true) {
|
||||
$sourceShares = $this->collectIncomingShares(
|
||||
|
|
@ -210,6 +200,16 @@ class OwnershipTransferService {
|
|||
$move
|
||||
);
|
||||
}
|
||||
|
||||
$destinationPath = $finalTarget . '/' . $path;
|
||||
// restore the shares
|
||||
$this->restoreShares(
|
||||
$sourceUid,
|
||||
$destinationUid,
|
||||
$destinationPath,
|
||||
$shares,
|
||||
$output
|
||||
);
|
||||
}
|
||||
|
||||
private function walkFiles(View $view, $path, Closure $callBack) {
|
||||
|
|
@ -488,9 +488,6 @@ class OwnershipTransferService {
|
|||
}
|
||||
} catch (\OCP\Files\NotFoundException $e) {
|
||||
$output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>');
|
||||
} catch (\OCP\Share\Exceptions\GenericShareException $e) {
|
||||
$output->writeln('<error>Share with id ' . $share->getId() . ' is broken, deleting</error>');
|
||||
$this->shareManager->deleteShare($share);
|
||||
} catch (\Throwable $e) {
|
||||
$output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getMessage() . ' : ' . $e->getTraceAsString() . '</error>');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue