Always assume the cache file is fresh when loading a package again which was already loaded, even if it lacks a last-modified header.

main
Jordi Boggiano 4 years ago committed by GitHub
parent 9516d0dc98
commit cb3c71a18a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -568,13 +568,12 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
} elseif ($useLastModifiedCheck) {
if ($contents = $this->cache->read($cacheKey)) {
$contents = json_decode($contents, true);
if (isset($contents['last-modified'])) {
if (isset($alreadyLoaded[$name])) {
$packages = $contents;
} else {
$response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
$packages = true === $response ? $contents : $response;
}
// we already loaded some packages from this file, so assume it is fresh and avoid fetching it again
if (isset($alreadyLoaded[$name])) {
$packages = $contents;
} elseif (isset($contents['last-modified'])) {
$response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
$packages = true === $response ? $contents : $response;
}
}
}

Loading…
Cancel
Save