Merge pull request #3532 from owncloud/scan-update
Only update metadata that has changed
This commit is contained in:
commit
5bbc583b56
|
@ -78,19 +78,22 @@ class Scanner {
|
|||
$this->scanFile($parent);
|
||||
}
|
||||
}
|
||||
$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;
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue