Merge remote-tracking branch 'ChristianRiesen/master'
commit
887d913eb6
|
@ -38,8 +38,11 @@ class PlatformRepository extends ArrayRepository
|
|||
$php = new MemoryPackage('php', $version, $prettyVersion);
|
||||
$php->setDescription('The PHP interpreter');
|
||||
parent::addPackage($php);
|
||||
|
||||
foreach (get_loaded_extensions() as $name) {
|
||||
|
||||
$loadedExtensions = get_loaded_extensions();
|
||||
|
||||
// Extensions scanning
|
||||
foreach ($loadedExtensions as $name) {
|
||||
if (in_array($name, array('standard', 'Core'))) {
|
||||
continue;
|
||||
}
|
||||
|
@ -57,5 +60,56 @@ class PlatformRepository extends ArrayRepository
|
|||
$ext->setDescription('The '.$name.' PHP extension');
|
||||
parent::addPackage($ext);
|
||||
}
|
||||
|
||||
// Another quick loop, just for possible libraries
|
||||
// Doing it this way to know that functions or constants exist before
|
||||
// relying on them.
|
||||
foreach ($loadedExtensions as $name) {
|
||||
switch ($name) {
|
||||
case 'curl':
|
||||
$curlVersion = curl_version();
|
||||
$prettyVersion = $curlVersion['version'];
|
||||
break;
|
||||
|
||||
case 'iconv':
|
||||
$prettyVersion = ICONV_VERSION;
|
||||
break;
|
||||
|
||||
case 'libxml':
|
||||
$prettyVersion = LIBXML_DOTTED_VERSION;
|
||||
break;
|
||||
|
||||
case 'openssl':
|
||||
$prettyVersion = str_replace('OpenSSL', '', OPENSSL_VERSION_TEXT);
|
||||
$prettyVersion = trim($prettyVersion);
|
||||
break;
|
||||
|
||||
case 'pcre':
|
||||
$prettyVersion = PCRE_VERSION;
|
||||
break;
|
||||
|
||||
case 'uuid':
|
||||
$prettyVersion = UUID_VERSION;
|
||||
break;
|
||||
|
||||
case 'xsl':
|
||||
$prettyVersion = LIBXSLT_DOTTED_VERSION;
|
||||
break;
|
||||
|
||||
default:
|
||||
// None handled extensions have no special cases, skip
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$version = $versionParser->normalize($prettyVersion);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ext = new MemoryPackage('lib-'.$name, $version, $prettyVersion);
|
||||
$ext->setDescription('The '.$name.' PHP library');
|
||||
parent::addPackage($ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue