diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-03-07 11:34:37 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-03-07 12:14:41 +0000 |
| commit | 7bb10f9aaa6f4a09e8676cda77d31edccd0cdad7 (patch) | |
| tree | ae30faa98eff8946ed85eb2be8565f6ac11c491d /app/Services | |
| parent | 5de77568e53cb80c9b7fc6044adc875464479a0b (diff) | |
| download | webtrees-7bb10f9aaa6f4a09e8676cda77d31edccd0cdad7.tar.gz webtrees-7bb10f9aaa6f4a09e8676cda77d31edccd0cdad7.tar.bz2 webtrees-7bb10f9aaa6f4a09e8676cda77d31edccd0cdad7.zip | |
Add example module to set PHP/MySQL configuration
Diffstat (limited to 'app/Services')
| -rw-r--r-- | app/Services/ServerCheckService.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/app/Services/ServerCheckService.php b/app/Services/ServerCheckService.php index 54966e9af5..09e22d495d 100644 --- a/app/Services/ServerCheckService.php +++ b/app/Services/ServerCheckService.php @@ -26,6 +26,7 @@ use function explode; use function extension_loaded; use function in_array; use function ini_get; +use function strtolower; use function sys_get_temp_dir; use function trim; use function version_compare; @@ -139,20 +140,34 @@ class ServerCheckService } /** - * Check if a PHP extension is loaded. + * Check if a PHP function is in the list of disabled functions. * * @param string $function * * @return string */ - private function checkPhpFunction(string $function): string + public function isFunctionDisabled(string $function): bool { $disable_functions = explode(',', ini_get('disable_functions')); $disable_functions = array_map(function (string $func): string { - return trim($func); + return trim(strtolower($func)); }, $disable_functions); - if (in_array($function, $disable_functions)) { + $function = strtolower($function); + + return in_array($function, $disable_functions, true) || !function_exists($function); + } + + /** + * Create a warning message for a disabled function. + * + * @param string $function + * + * @return string + */ + private function checkPhpFunction(string $function): string + { + if ($this->isFunctionDisabled($function)) { return I18N::translate('The PHP function ā%1$sā is disabled.', $function . '()'); } |
