function command_exists in Environment Indicator 7.2
Determines if a command exists on the current environment.
Parameters
string $command: The command to check.
Return value
bool TRUE if the command has been found; otherwise, FALSE.
1 call to command_exists()
- environment_indicator_environment_indicator_matched_indicator_alter in ./
environment_indicator.module - Implements hook_environment_indicator_matched_indicator_alter().
File
- ./
environment_indicator.module, line 641 - Module implementation file.
Code
function command_exists($command) {
if ($obj = cache_get('command_exists:' . $command)) {
return $obj->data;
}
$where_is_command = PHP_OS == 'WINNT' ? 'where' : 'which';
$command_return = environment_indicator_execute_os_command("{$where_is_command} {$command}");
$output = !empty($command_return);
cache_set('command_exists:' . $command, $output);
return $output;
}