diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-07-23 21:35:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 21:35:18 +0200 |
commit | 173f8abc7ed48d2436d8df10ad66bc4907d4bb52 (patch) | |
tree | cd5c668168515b81e6fd5ef234c27c9eccc1631c /apps | |
parent | 9275823a3043f392a157da9ddfc5dd1b71c4c236 (diff) | |
parent | c8cf2e8a5bc6b093cbcd06e93d7599fafe641c06 (diff) | |
download | nextcloud-server-173f8abc7ed48d2436d8df10ad66bc4907d4bb52.tar.gz nextcloud-server-173f8abc7ed48d2436d8df10ad66bc4907d4bb52.zip |
Merge pull request #21628 from nextcloud/external-to-s3-trashbin-fix
fix moving files from external storage to object store trashbin
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_trashbin/lib/Trashbin.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index f73cc1f4aa6..db00a7ed272 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -278,6 +278,10 @@ class Trashbin { /** @var \OC\Files\Storage\Storage $sourceStorage */ [$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/' . $ownerPath); + $connection = \OC::$server->getDatabaseConnection(); + $connection->beginTransaction(); + $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); + try { $moveSuccessful = true; if ($trashStorage->file_exists($trashInternalPath)) { @@ -298,10 +302,11 @@ class Trashbin { } else { $sourceStorage->unlink($sourceInternalPath); } + $connection->rollBack(); return false; } - $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); + $connection->commit(); if ($moveSuccessful) { $query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)"); |