1
0
Fork 0

PlatformRepository now knows curl and libxml versions

pull/822/head
Christian Riesen 2012-06-22 13:51:26 +02:00
parent 537ead6aae
commit 7b49b013ec
1 changed files with 46 additions and 11 deletions

View File

@ -40,17 +40,52 @@ 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) {
continue; // Skipped "extensions"
} case 'standard':
case 'Core':
continue;
$reflExt = new \ReflectionExtension($name); // Curl exposes its version by the curl_version function
try { case 'curl':
$prettyVersion = $reflExt->getVersion(); $curlversion = curl_version();
$version = $versionParser->normalize($prettyVersion); $prettyVersion = $curlversion['version'];
} catch (\UnexpectedValueException $e) {
$prettyVersion = '0'; try {
$version = $versionParser->normalize($prettyVersion); $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);
try {
$prettyVersion = $reflExt->getVersion();
$version = $versionParser->normalize($prettyVersion);
} catch (\UnexpectedValueException $e) {
$prettyVersion = '0';
$version = $versionParser->normalize($prettyVersion);
}
break;
} }
$ext = new MemoryPackage('ext-'.$name, $version, $prettyVersion); $ext = new MemoryPackage('ext-'.$name, $version, $prettyVersion);