Allow filtering of warning/info msgs by composer version
parent
4271167495
commit
0f36a42d61
|
@ -20,6 +20,7 @@ use Composer\DependencyResolver\Pool;
|
||||||
use Composer\Json\JsonFile;
|
use Composer\Json\JsonFile;
|
||||||
use Composer\Cache;
|
use Composer\Cache;
|
||||||
use Composer\Config;
|
use Composer\Config;
|
||||||
|
use Composer\Composer;
|
||||||
use Composer\Factory;
|
use Composer\Factory;
|
||||||
use Composer\IO\IOInterface;
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Util\RemoteFilesystem;
|
use Composer\Util\RemoteFilesystem;
|
||||||
|
@ -699,12 +700,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = JsonFile::parseJson($json, $filename);
|
$data = JsonFile::parseJson($json, $filename);
|
||||||
if (!empty($data['warning'])) {
|
$this->outputWarnings($data);
|
||||||
$this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
|
|
||||||
}
|
|
||||||
if (!empty($data['info'])) {
|
|
||||||
$this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($cacheKey) {
|
if ($cacheKey) {
|
||||||
if ($storeLastModifiedTime) {
|
if ($storeLastModifiedTime) {
|
||||||
|
@ -769,12 +765,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = JsonFile::parseJson($json, $filename);
|
$data = JsonFile::parseJson($json, $filename);
|
||||||
if (!empty($data['warning'])) {
|
$this->outputWarnings($data);
|
||||||
$this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
|
|
||||||
}
|
|
||||||
if (!empty($data['info'])) {
|
|
||||||
$this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
|
|
||||||
}
|
|
||||||
|
|
||||||
$lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
|
$lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
|
||||||
if ($lastModifiedDate) {
|
if ($lastModifiedDate) {
|
||||||
|
@ -835,4 +826,24 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
// wipe rootData as it is fully consumed at this point and this saves some memory
|
// wipe rootData as it is fully consumed at this point and this saves some memory
|
||||||
$this->rootData = true;
|
$this->rootData = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function outputWarnings($data)
|
||||||
|
{
|
||||||
|
foreach (array('warning', 'info') as $type) {
|
||||||
|
if (empty($data[$type])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data[$type . '-versions'])) {
|
||||||
|
$versionParser = new VersionParser();
|
||||||
|
$constraint = $versionParser->parseConstraints($data[$type . '-versions']);
|
||||||
|
$composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
|
||||||
|
if (!$constraint->matches($composer)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->io->writeError('<'.$type.'>'.ucfirst($type).' from '.$this->url.': '.$data[$type].'</'.$type.'>');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue