diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-05-29 10:23:41 -0700 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-05-29 10:23:41 -0700 |
commit | 5bbc583b56bbcbf68eb189aa219900d832e90116 (patch) | |
tree | b1e281d41cec5612193550446a1e8d9a446dda32 | |
parent | 8a5dec777553eab92c6ddf7a5a131b47761f1e28 (diff) | |
parent | ea553676789a4b62c1850dc156552ba8276fde5f (diff) | |
download | nextcloud-server-5bbc583b56bbcbf68eb189aa219900d832e90116.tar.gz nextcloud-server-5bbc583b56bbcbf68eb189aa219900d832e90116.zip |
Merge pull request #3532 from owncloud/scan-update
Only update metadata that has changed
-rw-r--r-- | lib/files/cache/scanner.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php index 46122221dc2..8f9a7921956 100644 --- a/lib/files/cache/scanner.php +++ b/lib/files/cache/scanner.php @@ -78,18 +78,21 @@ class Scanner { $this->scanFile($parent); } } - if($cacheData = $this->cache->get($file)) { + $newData = $data; + if ($cacheData = $this->cache->get($file)) { + if ($checkExisting && $data['size'] === -1) { + $data['size'] = $cacheData['size']; + } if ($data['mtime'] === $cacheData['mtime'] && $data['size'] === $cacheData['size']) { $data['etag'] = $cacheData['etag']; } + // Only update metadata that has changed + $newData = array_diff($data, $cacheData); } - if ($checkExisting and $cacheData) { - if ($data['size'] === -1) { - $data['size'] = $cacheData['size']; - } + if (!empty($newData)) { + $this->cache->put($file, $newData); } - $this->cache->put($file, $data); } return $data; } |