From 3fb32f6f3d0bf3a665229c9f1bcf6ea6605860a4 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 14 Feb 2020 22:08:13 +0100 Subject: [PATCH] reuse known parentId when inserting cache entries in scanner Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Cache.php | 4 +++- lib/private/Files/Cache/Scanner.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 92e81cd0f0..e57124d6cb 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); diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 564428bb6a..039041c1dc 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -220,6 +220,7 @@ class Scanner extends BasicEmitter implements IScanner { if (!empty($newData)) { // Reset the checksum if the data has changed $newData['checksum'] = ''; + $newData['parent'] = $parentId; $data['fileid'] = $this->addToCache($file, $newData, $fileId); } if (isset($cacheData['size'])) {