Merge pull request #23186 from nextcloud/backport/23109/stable19
[stable19] dont hold a transaction during the move to trash
This commit is contained in:
commit
c75378ac86
|
@ -284,8 +284,6 @@ class Trashbin {
|
||||||
$trashStorage->unlink($trashInternalPath);
|
$trashStorage->unlink($trashInternalPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
$connection = \OC::$server->getDatabaseConnection();
|
|
||||||
$connection->beginTransaction();
|
|
||||||
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
|
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -309,12 +307,16 @@ class Trashbin {
|
||||||
} else {
|
} else {
|
||||||
$sourceStorage->unlink($sourceInternalPath);
|
$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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$connection->commit();
|
|
||||||
|
|
||||||
if ($moveSuccessful) {
|
if ($moveSuccessful) {
|
||||||
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
|
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
|
||||||
$result = $query->execute([$filename, $timestamp, $location, $owner]);
|
$result = $query->execute([$filename, $timestamp, $location, $owner]);
|
||||||
|
|
Loading…
Reference in New Issue