restart transaction when cache insert fails due to duplicate
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
f984512e33
commit
d9184584e0
|
@ -309,6 +309,10 @@ class Cache implements ICache {
|
||||||
}
|
}
|
||||||
} catch (UniqueConstraintViolationException $e) {
|
} catch (UniqueConstraintViolationException $e) {
|
||||||
// entry exists already
|
// entry exists already
|
||||||
|
if ($this->connection->inTransaction()) {
|
||||||
|
$this->connection->commit();
|
||||||
|
$this->connection->beginTransaction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The file was created in the mean time
|
// The file was created in the mean time
|
||||||
|
@ -611,8 +615,8 @@ class Cache implements ICache {
|
||||||
$sourceId = $sourceData['fileid'];
|
$sourceId = $sourceData['fileid'];
|
||||||
$newParentId = $this->getParentId($targetPath);
|
$newParentId = $this->getParentId($targetPath);
|
||||||
|
|
||||||
list($sourceStorageId, $sourcePath) = $sourceCache->getMoveInfo($sourcePath);
|
[$sourceStorageId, $sourcePath] = $sourceCache->getMoveInfo($sourcePath);
|
||||||
list($targetStorageId, $targetPath) = $this->getMoveInfo($targetPath);
|
[$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath);
|
||||||
|
|
||||||
if (is_null($sourceStorageId) || $sourceStorageId === false) {
|
if (is_null($sourceStorageId) || $sourceStorageId === false) {
|
||||||
throw new \Exception('Invalid source storage id: ' . $sourceStorageId);
|
throw new \Exception('Invalid source storage id: ' . $sourceStorageId);
|
||||||
|
@ -882,7 +886,7 @@ class Cache implements ICache {
|
||||||
->whereParent($id);
|
->whereParent($id);
|
||||||
|
|
||||||
if ($row = $query->execute()->fetch()) {
|
if ($row = $query->execute()->fetch()) {
|
||||||
list($sum, $min) = array_values($row);
|
[$sum, $min] = array_values($row);
|
||||||
$sum = 0 + $sum;
|
$sum = 0 + $sum;
|
||||||
$min = 0 + $min;
|
$min = 0 + $min;
|
||||||
if ($min === -1) {
|
if ($min === -1) {
|
||||||
|
|
Loading…
Reference in New Issue