Skip broken shares when transferring ownership (#26527)
This commit is contained in:
parent
cebb689925
commit
2b61b89391
|
@ -224,6 +224,7 @@ class TransferOwnership extends Command {
|
||||||
$progress = new ProgressBar($output, count($this->shares));
|
$progress = new ProgressBar($output, count($this->shares));
|
||||||
|
|
||||||
foreach($this->shares as $share) {
|
foreach($this->shares as $share) {
|
||||||
|
try {
|
||||||
if ($share->getSharedWith() === $this->destinationUser) {
|
if ($share->getSharedWith() === $this->destinationUser) {
|
||||||
// Unmount the shares before deleting, so we don't try to get the storage later on.
|
// Unmount the shares before deleting, so we don't try to get the storage later on.
|
||||||
$shareMountPoint = $this->mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget());
|
$shareMountPoint = $this->mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget());
|
||||||
|
@ -241,6 +242,11 @@ class TransferOwnership extends Command {
|
||||||
|
|
||||||
$this->shareManager->updateShare($share);
|
$this->shareManager->updateShare($share);
|
||||||
}
|
}
|
||||||
|
} catch (\OCP\Files\NotFoundException $e) {
|
||||||
|
$output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>');
|
||||||
|
}
|
||||||
$progress->advance();
|
$progress->advance();
|
||||||
}
|
}
|
||||||
$progress->finish();
|
$progress->finish();
|
||||||
|
|
Loading…
Reference in New Issue