Fix output when loading zips from cache, fixes #7498
parent
a53b3c6b66
commit
73f14c0c7c
|
@ -137,8 +137,11 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
$checksum = $package->getDistSha1Checksum();
|
||||
$cacheKey = $this->getCacheKey($package, $processedUrl);
|
||||
|
||||
// download if we don't have it in cache or the cache is invalidated
|
||||
if (!$this->cache || ($checksum && $checksum !== $this->cache->sha1($cacheKey)) || !$this->cache->copyTo($cacheKey, $fileName)) {
|
||||
// use from cache if it is present and has a valid checksum or we have no checksum to check against
|
||||
if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
|
||||
$this->io->writeError('Loading from cache', false);
|
||||
} else {
|
||||
// download if cache restore failed
|
||||
if (!$this->outputProgress) {
|
||||
$this->io->writeError('Downloading', false);
|
||||
}
|
||||
|
@ -168,10 +171,6 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
$this->lastCacheWrites[$package->getName()] = $cacheKey;
|
||||
$this->cache->copyFrom($cacheKey, $fileName);
|
||||
}
|
||||
} else {
|
||||
if (!$this->outputProgress) {
|
||||
$this->io->writeError('Loading from cache', false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists($fileName)) {
|
||||
|
@ -297,7 +296,9 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
$this->io = new NullIO;
|
||||
$this->io->loadConfiguration($this->config);
|
||||
$this->outputProgress = false;
|
||||
$e = null;
|
||||
|
||||
try {
|
||||
$this->download($package, $targetDir.'_compare', false);
|
||||
|
||||
$comparer = new Comparer();
|
||||
|
@ -306,10 +307,16 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|||
$comparer->doCompare();
|
||||
$output = $comparer->getChanged(true, true);
|
||||
$this->filesystem->removeDirectory($targetDir.'_compare');
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
$this->io = $prevIO;
|
||||
$this->outputProgress = $prevProgress;
|
||||
|
||||
if ($e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return trim($output);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue