mirror of
https://github.com/nadrad/h-m-m.git
synced 2024-05-19 23:06:33 +02:00
Merge pull request #2 from Wojciechem/main
fix: check that required extensions are enabled. Resolves #1
This commit is contained in:
commit
5f2dee1e2d
21
h-m-m
21
h-m-m
|
@ -149,6 +149,10 @@ function shutdown()
|
|||
exit;
|
||||
}
|
||||
|
||||
if (false === check_required_extensions()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
register_shutdown_function("shutdown");
|
||||
declare(ticks = 1);
|
||||
pcntl_signal(SIGINT,"shutdown");
|
||||
|
@ -2420,6 +2424,23 @@ function monitor_key_presses(&$mm)
|
|||
}
|
||||
}
|
||||
|
||||
function check_required_extensions(): bool
|
||||
{
|
||||
if (!function_exists('pcntl_signal')) {
|
||||
echo 'Required extension pcntl is not enabled; please check your php installation!';
|
||||
echo PHP_EOL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!function_exists('mb_strlen')) {
|
||||
echo 'Required extension mbstring is not enabled; please check your php installation!';
|
||||
echo PHP_EOL;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ main
|
||||
|
||||
|
|
Loading…
Reference in a new issue