summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Cache/Cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/Cache/Cache.php')
-rw-r--r--lib/private/Files/Cache/Cache.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index 92e81cd0f07..11f7eedea26 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -274,7 +274,9 @@ class Cache implements ICache {
}
$data['path'] = $file;
- $data['parent'] = $this->getParentId($file);
+ if (!isset($data['parent'])) {
+ $data['parent'] = $this->getParentId($file);
+ }
$data['name'] = basename($file);
[$values, $extensionValues] = $this->normalizeData($data);
@@ -307,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
@@ -609,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);
@@ -880,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) {