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();
|
$checksum = $package->getDistSha1Checksum();
|
||||||
$cacheKey = $this->getCacheKey($package, $processedUrl);
|
$cacheKey = $this->getCacheKey($package, $processedUrl);
|
||||||
|
|
||||||
// download if we don't have it in cache or the cache is invalidated
|
// 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)) {
|
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) {
|
if (!$this->outputProgress) {
|
||||||
$this->io->writeError('Downloading', false);
|
$this->io->writeError('Downloading', false);
|
||||||
}
|
}
|
||||||
|
@ -168,10 +171,6 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
$this->lastCacheWrites[$package->getName()] = $cacheKey;
|
$this->lastCacheWrites[$package->getName()] = $cacheKey;
|
||||||
$this->cache->copyFrom($cacheKey, $fileName);
|
$this->cache->copyFrom($cacheKey, $fileName);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!$this->outputProgress) {
|
|
||||||
$this->io->writeError('Loading from cache', false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($fileName)) {
|
if (!file_exists($fileName)) {
|
||||||
|
@ -297,7 +296,9 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
$this->io = new NullIO;
|
$this->io = new NullIO;
|
||||||
$this->io->loadConfiguration($this->config);
|
$this->io->loadConfiguration($this->config);
|
||||||
$this->outputProgress = false;
|
$this->outputProgress = false;
|
||||||
|
$e = null;
|
||||||
|
|
||||||
|
try {
|
||||||
$this->download($package, $targetDir.'_compare', false);
|
$this->download($package, $targetDir.'_compare', false);
|
||||||
|
|
||||||
$comparer = new Comparer();
|
$comparer = new Comparer();
|
||||||
|
@ -306,10 +307,16 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
$comparer->doCompare();
|
$comparer->doCompare();
|
||||||
$output = $comparer->getChanged(true, true);
|
$output = $comparer->getChanged(true, true);
|
||||||
$this->filesystem->removeDirectory($targetDir.'_compare');
|
$this->filesystem->removeDirectory($targetDir.'_compare');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
$this->io = $prevIO;
|
$this->io = $prevIO;
|
||||||
$this->outputProgress = $prevProgress;
|
$this->outputProgress = $prevProgress;
|
||||||
|
|
||||||
|
if ($e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
return trim($output);
|
return trim($output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue