Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion apps/files/lib/Command/TransferOwnership.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ protected function configure() {
null,
InputOption::VALUE_NONE,
'move data from source user to root directory of destination user, which must be empty'
);
)->addOption(
'ignore-encryption-error',
null,
InputOption::VALUE_NONE,
'ignore encryption error. Usage: --ignore-encryption-error',
);
}

protected function execute(InputInterface $input, OutputInterface $output): int {
Expand All @@ -111,6 +116,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}

$GLOBALS['ignore-encryption-error'] = $input->getOption('ignore-encryption-error');

try {
$this->transferService->transfer(
$sourceUserObject,
Expand Down
8 changes: 7 additions & 1 deletion lib/private/Files/Storage/Wrapper/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,13 @@ private function copyBetweenStorage(Storage\IStorage $sourceStorage, $sourceInte
} catch (\Exception $e) {
fclose($source);
fclose($target);
throw $e;
$this->logger->logException(new \Exception("Fail to copy '$sourceInternalPath' to '$targetInternalPath'", 0, $e));
if ($GLOBALS['ignore-encryption-error']) {
fwrite(STDERR, " - Skipping '$sourceInternalPath'" . $e->getMessage() . PHP_EOL);
$result = true;
} else {
throw $e;
}
}
if ($result) {
if ($preserveMtime) {
Expand Down