Browse Source

Merge pull request #23109 from nextcloud/trash-move-no-transaction

dont hold a transaction during the move to trash
tags/v21.0.0beta1
Joas Schilling 3 years ago
parent
commit
bbfbb90d50
No account linked to committer's email address
1 changed files with 7 additions and 5 deletions
  1. 7
    5
      apps/files_trashbin/lib/Trashbin.php

+ 7
- 5
apps/files_trashbin/lib/Trashbin.php View File

@@ -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]);

Loading…
Cancel
Save