From edee7de39313697b3c327a8729cc06c8d0774fb1 Mon Sep 17 00:00:00 2001 From: Marco Cesarato Date: Sat, 15 May 2021 00:17:02 +0200 Subject: [PATCH] fix(shell): add is enabled method --- src/Helper/ShellCommand.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Helper/ShellCommand.php b/src/Helper/ShellCommand.php index 5cd2d30..75064fe 100644 --- a/src/Helper/ShellCommand.php +++ b/src/Helper/ShellCommand.php @@ -27,4 +27,14 @@ public static function exists(string $command) return !empty($return); } + + /** + * Check if can execute shell commands. + */ + public static function isEnabled(): bool + { + return function_exists('shell_exec') && + is_callable('shell_exec') && + stripos(ini_get('disable_functions'), 'shell_exec') === false; + } }