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);
foreach (get_loaded_extensions() as $name) {
if (in_array($name, array('standard', 'Core'))) {
continue;
}
$reflExt = new \ReflectionExtension($name);
try {
$prettyVersion = $reflExt->getVersion();
$version = $versionParser->normalize($prettyVersion);
} catch (\UnexpectedValueException $e) {
$prettyVersion = '0';
$version = $versionParser->normalize($prettyVersion);
switch ($name) {
// Skipped "extensions"
case 'standard':
case 'Core':
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);
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);