PlatformRepository now knows curl and libxml versions
parent
537ead6aae
commit
7b49b013ec
|
@ -40,11 +40,43 @@ class PlatformRepository extends ArrayRepository
|
||||||
parent::addPackage($php);
|
parent::addPackage($php);
|
||||||
|
|
||||||
foreach (get_loaded_extensions() as $name) {
|
foreach (get_loaded_extensions() as $name) {
|
||||||
if (in_array($name, array('standard', 'Core'))) {
|
switch ($name) {
|
||||||
|
// Skipped "extensions"
|
||||||
|
case 'standard':
|
||||||
|
case 'Core':
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Curl exposes its version by the curl_version function
|
||||||
|
case 'curl':
|
||||||
|
$curlversion = curl_version();
|
||||||
|
$prettyVersion = $curlversion['version'];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$version = $versionParser->normalize($prettyVersion);
|
||||||
|
} catch (\UnexpectedValueException $e) {
|
||||||
|
$prettyVersion = '0';
|
||||||
|
$version = $versionParser->normalize($prettyVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 'libxml':
|
||||||
|
$prettyVersion = LIBXML_DOTTED_VERSION;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$version = $versionParser->normalize($prettyVersion);
|
||||||
|
} catch (\UnexpectedValueException $e) {
|
||||||
|
$prettyVersion = '0';
|
||||||
|
$version = $versionParser->normalize($prettyVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
// All normal cases for standard extensions
|
||||||
|
default:
|
||||||
$reflExt = new \ReflectionExtension($name);
|
$reflExt = new \ReflectionExtension($name);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$prettyVersion = $reflExt->getVersion();
|
$prettyVersion = $reflExt->getVersion();
|
||||||
$version = $versionParser->normalize($prettyVersion);
|
$version = $versionParser->normalize($prettyVersion);
|
||||||
|
@ -53,6 +85,9 @@ class PlatformRepository extends ArrayRepository
|
||||||
$version = $versionParser->normalize($prettyVersion);
|
$version = $versionParser->normalize($prettyVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$ext = new MemoryPackage('ext-'.$name, $version, $prettyVersion);
|
$ext = new MemoryPackage('ext-'.$name, $version, $prettyVersion);
|
||||||
$ext->setDescription('The '.$name.' PHP extension');
|
$ext->setDescription('The '.$name.' PHP extension');
|
||||||
parent::addPackage($ext);
|
parent::addPackage($ext);
|
||||||
|
|
Loading…
Reference in New Issue