Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/files/cache/cache.php')
-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);
}
}