Skip to content

Commit cda4948

Browse files
committed
wip
Signed-off-by: Daniel Kesselberg <[email protected]>
1 parent 94c5294 commit cda4948

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/private/Files/Cache/Cache.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -359,18 +359,12 @@ public function update($id, array $data) {
359359
}
360360

361361
if (count($extensionValues)) {
362-
try {
363-
$query = $this->getQueryBuilder();
364-
$query->insert('filecache_extended');
365-
$query->hintShardKey('storage', $this->getNumericStorageId());
366-
367-
$query->setValue('fileid', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT));
368-
foreach ($extensionValues as $column => $value) {
369-
$query->setValue($column, $query->createNamedParameter($value));
370-
}
362+
$insertCount = $this->connection->insertIgnoreConflict(
363+
'filecache_extended',
364+
array_merge(['fileid' => $id], $extensionValues)
365+
);
371366

372-
$query->execute();
373-
} catch (UniqueConstraintViolationException $e) {
367+
if ($insertCount === 0) {
374368
$query = $this->getQueryBuilder();
375369
$query->update('filecache_extended')
376370
->whereFileId($id)
@@ -386,7 +380,7 @@ public function update($id, array $data) {
386380
$query->set($key, $query->createNamedParameter($value));
387381
}
388382

389-
$query->execute();
383+
$query->executeStatement();
390384
}
391385
}
392386

0 commit comments

Comments
 (0)