1
0
Fork 0

Fix corrupt archives in cache from getting the installs stuck forever, and make sure it fails only once, fixes #10028

pull/10065/head
Jordi Boggiano 2021-08-17 16:49:36 +02:00
parent e49f24e355
commit ddd7920d2a
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 6 additions and 0 deletions

View File

@ -168,6 +168,12 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
if ($output) {
$io->writeError(" - Loading <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>) from cache", true, IOInterface::VERY_VERBOSE);
}
// mark the file as having been written in cache even though it is only read from cache, so that if
// the cache is corrupt the archive will be deleted and the next attempt will re-download it
// see https://github.com/composer/composer/issues/10028
if (!$cache->isReadOnly()) {
$this->lastCacheWrites[$package->getName()] = $cacheKey;
}
$result = \React\Promise\resolve($fileName);
} else {
if ($output) {