|
@@ -20,6 +20,7 @@ use Composer\DependencyResolver\Pool;
|
|
|
use Composer\Json\JsonFile;
|
|
|
use Composer\Cache;
|
|
|
use Composer\Config;
|
|
|
+use Composer\Composer;
|
|
|
use Composer\Factory;
|
|
|
use Composer\IO\IOInterface;
|
|
|
use Composer\Util\RemoteFilesystem;
|
|
@@ -699,12 +700,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|
|
}
|
|
|
|
|
|
$data = JsonFile::parseJson($json, $filename);
|
|
|
- if (!empty($data['warning'])) {
|
|
|
- $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>');
|
|
|
- }
|
|
|
+ $this->outputWarnings($data);
|
|
|
|
|
|
if ($cacheKey) {
|
|
|
if ($storeLastModifiedTime) {
|
|
@@ -769,12 +765,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|
|
}
|
|
|
|
|
|
$data = JsonFile::parseJson($json, $filename);
|
|
|
- if (!empty($data['warning'])) {
|
|
|
- $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>');
|
|
|
- }
|
|
|
+ $this->outputWarnings($data);
|
|
|
|
|
|
$lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
|
|
|
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
|
|
|
$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.'>');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|