Cache: Do not overwrite ETag when file did not change

This commit is contained in:
Arthur Schiwon 2013-03-26 16:03:40 +01:00
parent 2a2d409733
commit 3d29a82150
1 changed files with 6 additions and 4 deletions

View File

@ -74,14 +74,16 @@ class Scanner {
$this->scanFile($parent);
}
}
if ($checkExisting and $cacheData = $this->cache->get($file)) {
if ($data['size'] === -1) {
$data['size'] = $cacheData['size'];
}
if($cacheData = $this->cache->get($file)) {
if ($data['mtime'] === $cacheData['mtime']) {
$data['etag'] = $cacheData['etag'];
}
}
if ($checkExisting and $cacheData) {
if ($data['size'] === -1) {
$data['size'] = $cacheData['size'];
}
}
$this->cache->put($file, $data);
}
return $data;