|
@@ -4,8 +4,10 @@ namespace OrpheusNET\Logchecker; |
|
|
|
|
|
|
|
|
class Util { |
|
|
class Util { |
|
|
public static function commandExists($cmd) { |
|
|
public static function commandExists($cmd) { |
|
|
$return = shell_exec(sprintf("which %s", escapeshellarg($cmd))); |
|
|
|
|
|
return !empty($return); |
|
|
|
|
|
|
|
|
$where = substr(strtolower(PHP_OS), 0, 3) === 'win' ? 'where' : 'command -v'; |
|
|
|
|
|
|
|
|
|
|
|
exec("{$where} {$cmd} 2>/dev/null", $output, $return_var); |
|
|
|
|
|
return $return_var === 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static function strposArray(string $haystack, array $needles) { |
|
|
public static function strposArray(string $haystack, array $needles) { |
|
|