summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-02-28 17:36:38 +0100
committerRobin Appelman <robin@icewind.nl>2020-04-01 14:17:34 +0200
commitd9184584e08def794a298966afde24f232b7abf5 (patch)
treec3229f6afdbd8f9090d4d8d1d1d9e6d0207c74c8 /lib/private
parentf984512e334373c9689c1093f10927a120aeffbc (diff)
downloadnextcloud-server-d9184584e08def794a298966afde24f232b7abf5.tar.gz
nextcloud-server-d9184584e08def794a298966afde24f232b7abf5.zip
restart transaction when cache insert fails due to duplicate
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Cache/Cache.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index e57124d6cbd..11f7eedea26 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -309,6 +309,10 @@ class Cache implements ICache {
}
} catch (UniqueConstraintViolationException $e) {
// entry exists already
+ if ($this->connection->inTransaction()) {
+ $this->connection->commit();
+ $this->connection->beginTransaction();
+ }
}
// The file was created in the mean time
@@ -611,8 +615,8 @@ class Cache implements ICache {
$sourceId = $sourceData['fileid'];
$newParentId = $this->getParentId($targetPath);
- list($sourceStorageId, $sourcePath) = $sourceCache->getMoveInfo($sourcePath);
- list($targetStorageId, $targetPath) = $this->getMoveInfo($targetPath);
+ [$sourceStorageId, $sourcePath] = $sourceCache->getMoveInfo($sourcePath);
+ [$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath);
if (is_null($sourceStorageId) || $sourceStorageId === false) {
throw new \Exception('Invalid source storage id: ' . $sourceStorageId);
@@ -882,7 +886,7 @@ class Cache implements ICache {
->whereParent($id);
if ($row = $query->execute()->fetch()) {
- list($sum, $min) = array_values($row);
+ [$sum, $min] = array_values($row);
$sum = 0 + $sum;
$min = 0 + $min;
if ($min === -1) {