From 06c6163265bf10e7aa84c2621d58323b3ad94963 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 3 Mar 2014 16:48:28 +0100 Subject: [PATCH] Check if fields we need are actually set to prevent errors --- lib/private/files/cache/cache.php | 4 ++-- lib/private/files/cache/scanner.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index d886fd0fe7..abc11e7647 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -520,7 +520,7 @@ class Cache { */ public function calculateFolderSize($path, $entry = null) { $totalSize = 0; - if (is_null($entry)) { + if (is_null($entry) or !isset($entry['fileid'])) { $entry = $this->get($path); } if ($entry && $entry['mimetype'] === 'httpd/unix-directory') { @@ -544,7 +544,7 @@ class Cache { if ($entry['size'] !== $totalSize) { $update['size'] = $totalSize; } - if ($entry['unencrypted_size'] !== $unencryptedSum) { + if (!isset($entry['unencrypted_size']) or $entry['unencrypted_size'] !== $unencryptedSum) { $update['unencrypted_size'] = $unencryptedSum; } if (count($update) > 0) { diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index ee6a828f7c..79159724d1 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -155,7 +155,7 @@ class Scanner extends BasicEmitter { } } if (!empty($newData)) { - $this->cache->put($file, $newData); + $data['fileid'] = $this->cache->put($file, $newData); $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId)); \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId)); }