Fix openssl/pcre matches, and skip other exts properly
parent
887d913eb6
commit
95bc5c4898
|
@ -38,9 +38,9 @@ class PlatformRepository extends ArrayRepository
|
||||||
$php = new MemoryPackage('php', $version, $prettyVersion);
|
$php = new MemoryPackage('php', $version, $prettyVersion);
|
||||||
$php->setDescription('The PHP interpreter');
|
$php->setDescription('The PHP interpreter');
|
||||||
parent::addPackage($php);
|
parent::addPackage($php);
|
||||||
|
|
||||||
$loadedExtensions = get_loaded_extensions();
|
$loadedExtensions = get_loaded_extensions();
|
||||||
|
|
||||||
// Extensions scanning
|
// Extensions scanning
|
||||||
foreach ($loadedExtensions as $name) {
|
foreach ($loadedExtensions as $name) {
|
||||||
if (in_array($name, array('standard', 'Core'))) {
|
if (in_array($name, array('standard', 'Core'))) {
|
||||||
|
@ -60,7 +60,7 @@ class PlatformRepository extends ArrayRepository
|
||||||
$ext->setDescription('The '.$name.' PHP extension');
|
$ext->setDescription('The '.$name.' PHP extension');
|
||||||
parent::addPackage($ext);
|
parent::addPackage($ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Another quick loop, just for possible libraries
|
// Another quick loop, just for possible libraries
|
||||||
// Doing it this way to know that functions or constants exist before
|
// Doing it this way to know that functions or constants exist before
|
||||||
// relying on them.
|
// relying on them.
|
||||||
|
@ -70,46 +70,47 @@ class PlatformRepository extends ArrayRepository
|
||||||
$curlVersion = curl_version();
|
$curlVersion = curl_version();
|
||||||
$prettyVersion = $curlVersion['version'];
|
$prettyVersion = $curlVersion['version'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'iconv':
|
case 'iconv':
|
||||||
$prettyVersion = ICONV_VERSION;
|
$prettyVersion = ICONV_VERSION;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'libxml':
|
case 'libxml':
|
||||||
$prettyVersion = LIBXML_DOTTED_VERSION;
|
$prettyVersion = LIBXML_DOTTED_VERSION;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'openssl':
|
case 'openssl':
|
||||||
$prettyVersion = str_replace('OpenSSL', '', OPENSSL_VERSION_TEXT);
|
$prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]?).*}', function ($match) {
|
||||||
$prettyVersion = trim($prettyVersion);
|
return $match[1] . (empty($match[2]) ? '' : '.'.(ord($match[2]) - 96));
|
||||||
|
}, OPENSSL_VERSION_TEXT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'pcre':
|
case 'pcre':
|
||||||
$prettyVersion = PCRE_VERSION;
|
$prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'uuid':
|
case 'uuid':
|
||||||
$prettyVersion = UUID_VERSION;
|
$prettyVersion = UUID_VERSION;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'xsl':
|
case 'xsl':
|
||||||
$prettyVersion = LIBXSLT_DOTTED_VERSION;
|
$prettyVersion = LIBXSLT_DOTTED_VERSION;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// None handled extensions have no special cases, skip
|
// None handled extensions have no special cases, skip
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$version = $versionParser->normalize($prettyVersion);
|
$version = $versionParser->normalize($prettyVersion);
|
||||||
} catch (\UnexpectedValueException $e) {
|
} catch (\UnexpectedValueException $e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ext = new MemoryPackage('lib-'.$name, $version, $prettyVersion);
|
$lib = new MemoryPackage('lib-'.$name, $version, $prettyVersion);
|
||||||
$ext->setDescription('The '.$name.' PHP library');
|
$lib->setDescription('The '.$name.' PHP library');
|
||||||
parent::addPackage($ext);
|
parent::addPackage($lib);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue