Catch file transfer error and stop transfer ownership command
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
a2046db6d0
commit
70f4e7e10a
|
@ -215,6 +215,9 @@ class OwnershipTransferService {
|
||||||
return $shares;
|
return $shares;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws TransferOwnershipException
|
||||||
|
*/
|
||||||
protected function transferFiles(string $sourceUid,
|
protected function transferFiles(string $sourceUid,
|
||||||
string $sourcePath,
|
string $sourcePath,
|
||||||
string $finalTarget,
|
string $finalTarget,
|
||||||
|
@ -228,7 +231,9 @@ class OwnershipTransferService {
|
||||||
$view->mkdir($finalTarget);
|
$view->mkdir($finalTarget);
|
||||||
$finalTarget = $finalTarget . '/' . basename($sourcePath);
|
$finalTarget = $finalTarget . '/' . basename($sourcePath);
|
||||||
}
|
}
|
||||||
$view->rename($sourcePath, $finalTarget);
|
if ($view->rename($sourcePath, $finalTarget) === false) {
|
||||||
|
throw new TransferOwnershipException("Could not transfer files", 1);
|
||||||
|
}
|
||||||
if (!is_dir("$sourceUid/files")) {
|
if (!is_dir("$sourceUid/files")) {
|
||||||
// because the files folder is moved away we need to recreate it
|
// because the files folder is moved away we need to recreate it
|
||||||
$view->mkdir("$sourceUid/files");
|
$view->mkdir("$sourceUid/files");
|
||||||
|
|
Loading…
Reference in New Issue