diff options
author | Robin Appelman <robin@icewind.nl> | 2020-02-14 22:09:11 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-04-01 14:17:25 +0200 |
commit | 9c7da263949c5e72d6d7aa36b897b112f99ce8f2 (patch) | |
tree | c2b83021800ecfb81201fc222b4d1cf91170741c /lib | |
parent | 3fb32f6f3d0bf3a665229c9f1bcf6ea6605860a4 (diff) | |
download | nextcloud-server-9c7da263949c5e72d6d7aa36b897b112f99ce8f2.tar.gz nextcloud-server-9c7da263949c5e72d6d7aa36b897b112f99ce8f2.zip |
dont try to get existing cache data during scanning if we already know its a new file
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 8 |
1 files 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) { |