Cache root packages.json, refs #10326

main
Jordi Boggiano 2 years ago
parent 483eac1c2f
commit 7c8267f57c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -931,7 +931,17 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
}
$data = $this->fetchFile($this->getPackagesJsonUrl(), 'packages.json');
if ($cachedData = $this->cache->read('packages.json')) {
$cachedData = json_decode($cachedData, true);
if (isset($cachedData['last-modified'])) {
$response = $this->fetchFileIfLastModified($this->getPackagesJsonUrl(), 'packages.json', $cachedData['last-modified']);
$data = true === $response ? $cachedData : $response;
}
}
if (!isset($data)) {
$data = $this->fetchFile($this->getPackagesJsonUrl(), 'packages.json', null, true);
}
if (!empty($data['notify-batch'])) {
$this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);

Loading…
Cancel
Save