From 9c7da263949c5e72d6d7aa36b897b112f99ce8f2 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 14 Feb 2020 22:09:11 +0100 Subject: [PATCH] dont try to get existing cache data during scanning if we already know its a new file Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Scanner.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 039041c1dce..99f334c6350 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -124,7 +124,7 @@ class Scanner extends BasicEmitter implements IScanner { * @param string $file * @param int $reuseExisting * @param int $parentId - * @param array | null $cacheData existing data in the cache for the file to be scanned + * @param array|null|false $cacheData existing data in the cache for the file to be scanned * @param bool $lock set to false to disable getting an additional read lock during scanning * @return array an array of metadata of the scanned file * @throws \OC\ServerNotAvailableException @@ -223,13 +223,13 @@ class Scanner extends BasicEmitter implements IScanner { $newData['parent'] = $parentId; $data['fileid'] = $this->addToCache($file, $newData, $fileId); } - if (isset($cacheData['size'])) { + if ($cacheData && isset($cacheData['size'])) { $data['oldSize'] = $cacheData['size']; } else { $data['oldSize'] = 0; } - if (isset($cacheData['encrypted'])) { + if ($cacheData && isset($cacheData['encrypted'])) { $data['encrypted'] = $cacheData['encrypted']; } @@ -437,7 +437,7 @@ class Scanner extends BasicEmitter implements IScanner { foreach ($newChildren as $file) { $child = $path ? $path . '/' . $file : $file; try { - $existingData = isset($existingChildren[$file]) ? $existingChildren[$file] : null; + $existingData = isset($existingChildren[$file]) ? $existingChildren[$file] : false; $data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock); if ($data) { if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE) { -- 2.39.5