summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-03-06 15:32:58 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-03-06 17:41:51 +0100
commitf6ceb0b0d58e00ee4a216b39e377ef1539e55fb9 (patch)
treec92efcb40492a3d9a24d22a9b2cf85d3effac57a /lib
parente5aefc8bda802e97406bd78ee51a307a1fe60bcd (diff)
downloadnextcloud-server-f6ceb0b0d58e00ee4a216b39e377ef1539e55fb9.tar.gz
nextcloud-server-f6ceb0b0d58e00ee4a216b39e377ef1539e55fb9.zip
use insertIfNotExist() in cache put
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/cache/cache.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 3c097a34962..56c9bfa3ac5 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -240,13 +240,19 @@ class Cache {
list($queryParts, $params) = $this->buildParts($data);
$queryParts[] = '`storage`';
$params[] = $this->getNumericStorageId();
- $valuesPlaceholder = array_fill(0, count($queryParts), '?');
- $sql = 'INSERT INTO `*PREFIX*filecache` (' . implode(', ', $queryParts) . ')'
- . ' VALUES (' . implode(', ', $valuesPlaceholder) . ')';
- \OC_DB::executeAudited($sql, $params);
+ $params = array_map(function($item) {
+ return trim($item, "`");
+ }, $params);
+ $queryParts = array_map(function($item) {
+ return trim($item, "`");
+ }, $queryParts);
+ $values = array_combine($queryParts, $params);
+ if (\OC::$server->getDatabaseConnection()->insertIfNotExist('*PREFIX*filecache', $values)) {
+ return (int)\OC_DB::insertid('*PREFIX*filecache');
+ }
- return (int)\OC_DB::insertid('*PREFIX*filecache');
+ return $this->getId($file);
}
}