From 1a8105f3c6048a8da7ff78576f82cf766caa2164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 23 Sep 2020 17:21:47 +0200 Subject: [PATCH] WIP: Try to resolve issue where the running db transaction causes the trashbin move between storages to fail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files_trashbin/lib/Trashbin.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 276cdf4e2d..7bafcdf18e 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -287,7 +287,6 @@ class Trashbin { $connection = \OC::$server->getDatabaseConnection(); $connection->beginTransaction(); - $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); try { $moveSuccessful = true; @@ -304,7 +303,9 @@ class Trashbin { \OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']); } - if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort + $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); + + if (!$moveSuccessful && $sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort if ($sourceStorage->is_dir($sourceInternalPath)) { $sourceStorage->rmdir($sourceInternalPath); } else {