aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2020-10-05 15:04:56 +0200
committerGitHub <noreply@github.com>2020-10-05 15:04:56 +0200
commitbbfbb90d50cbe88dc686eb02a5e2976b00241a77 (patch)
tree1d15c7768c2a207039c3d208e4af44e83b793f6d
parent7511e710cc2c452707eed058ff920adff4d828d2 (diff)
parente0d688c3656ed4024ca82482c83a27418e30130f (diff)
downloadnextcloud-server-bbfbb90d50cbe88dc686eb02a5e2976b00241a77.tar.gz
nextcloud-server-bbfbb90d50cbe88dc686eb02a5e2976b00241a77.zip
Merge pull request #23109 from nextcloud/trash-move-no-transaction
dont hold a transaction during the move to trash
-rw-r--r--apps/files_trashbin/lib/Trashbin.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index b1e1d0600b0..2626f439d11 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -293,8 +293,6 @@ class Trashbin {
return false;
}
- $connection = \OC::$server->getDatabaseConnection();
- $connection->beginTransaction();
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
try {
@@ -318,12 +316,16 @@ class Trashbin {
} else {
$sourceStorage->unlink($sourceInternalPath);
}
- $connection->rollBack();
+
+ if ($sourceStorage->file_exists($sourceInternalPath)) {
+ // undo the cache move
+ $sourceStorage->getUpdater()->renameFromStorage($trashStorage, $trashInternalPath, $sourceInternalPath);
+ } else {
+ $trashStorage->getUpdater()->remove($trashInternalPath);
+ }
return false;
}
- $connection->commit();
-
if ($moveSuccessful) {
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
$result = $query->execute([$filename, $timestamp, $location, $owner]);