mirror of
https://github.com/mlocati/docker-php-extension-installer
synced 2025-05-09 00:22:40 +00:00
Add support for testing more than one PHP extension at once
This commit is contained in:
parent
9d30d8806f
commit
2de4f3462d
3 changed files with 99 additions and 44 deletions
|
@ -1,24 +1,35 @@
|
|||
<?php
|
||||
|
||||
$extension = isset($argv[1]) ? trim($argv[1]) : '';
|
||||
$rc = 1;
|
||||
|
||||
if ($extension === '') {
|
||||
fprintf(STDERR, "Missing module handle.\n");
|
||||
} else {
|
||||
$nameMap = array(
|
||||
'opcache' => 'Zend OPcache',
|
||||
);
|
||||
$extensionLowerCase = strtolower($extension);
|
||||
if (isset($nameMap[$extensionLowerCase])) {
|
||||
$extension = $nameMap[$extensionLowerCase];
|
||||
}
|
||||
if (!extension_loaded($extension)) {
|
||||
fprintf(STDERR, sprintf("Extension not loaded: %s\n", $extension));
|
||||
$rc = 0;
|
||||
$numTestedExtensions = 0;
|
||||
$nameMap = array(
|
||||
'opcache' => 'Zend OPcache',
|
||||
);
|
||||
for ($index = 1, $count = isset($argv) ? count($argv) : 0; $index < $count; $index++) {
|
||||
$numTestedExtensions++;
|
||||
$rcThis = 1;
|
||||
$extension = $argv[$index];
|
||||
if ($extension === '') {
|
||||
fprintf(STDERR, "Missing extension handle.\n");
|
||||
} else {
|
||||
fprintf(STDOUT, sprintf("Extension correctly loaded: %s\n", $extension));
|
||||
$rc = 0;
|
||||
$extensionLowerCase = strtolower($extension);
|
||||
if (isset($nameMap[$extensionLowerCase])) {
|
||||
$extension = $nameMap[$extensionLowerCase];
|
||||
}
|
||||
if (!extension_loaded($extension)) {
|
||||
fprintf(STDERR, sprintf("Extension not loaded: %s\n", $extension));
|
||||
} else {
|
||||
fprintf(STDOUT, sprintf("Extension correctly loaded: %s\n", $extension));
|
||||
$rcThis = 0;
|
||||
}
|
||||
}
|
||||
if ($rcThis !== 0) {
|
||||
$rc = $rcThis;
|
||||
}
|
||||
}
|
||||
if ($numTestedExtensions === 0) {
|
||||
fprintf(STDERR, "No extension handles specified.\n");
|
||||
$rc = 1;
|
||||
}
|
||||
|
||||
exit($rc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue