mirror of
https://github.com/mlocati/docker-php-extension-installer
synced 2025-05-09 00:22:40 +00:00
Add support to UOPZ
uopz disables exit() by default, so we can't assume that exit() will actually quit a PHP script
This commit is contained in:
parent
21f8edbea2
commit
25a58a500f
3 changed files with 26 additions and 14 deletions
|
@ -1,22 +1,24 @@
|
|||
<?php
|
||||
|
||||
$extension = isset($argv[1]) ? trim($argv[1]) : '';
|
||||
$rc = 1;
|
||||
|
||||
if ($extension === '') {
|
||||
fprintf(STDERR, "Missing module handle.\n");
|
||||
exit(1);
|
||||
}
|
||||
$nameMap = array(
|
||||
'opcache' => 'Zend OPcache',
|
||||
);
|
||||
$extensionLowerCase = strtolower($extension);
|
||||
if (isset($nameMap[$extensionLowerCase])) {
|
||||
$extension = $nameMap[$extensionLowerCase];
|
||||
} 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));
|
||||
} else {
|
||||
fprintf(STDOUT, sprintf("Extension correctly loaded: %s\n", $extension));
|
||||
$rc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (extension_loaded($extension)) {
|
||||
fprintf(STDOUT, sprintf("Extension correctly loaded: %s\n", $extension));
|
||||
exit(0);
|
||||
}
|
||||
fprintf(STDERR, sprintf("Extension not loaded: %s\n", $extension));
|
||||
exit(1);
|
||||
exit($rc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue