summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files_trashbin/lib/Trashbin.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index e23368f825b..db00a7ed272 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -278,6 +278,8 @@ 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 {
@@ -300,9 +302,12 @@ class Trashbin {
} else {
$sourceStorage->unlink($sourceInternalPath);
}
+ $connection->rollBack();
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]);