function search_file_attachments_check_java in Search File Attachments 7
Check if java is available and executable.
Parameters
string $path: The full path to the Java binary. e.g. /usr/bin/java
3 calls to search_file_attachments_check_java()
- search_file_attachments_requirements in ./
search_file_attachments.install - Implements hook_requirements().
- search_file_attachments_settings_form in ./
search_file_attachments.admin.inc - Page callback to show the settings for the attachments.
- search_file_attachments_settings_form_validate in ./
search_file_attachments.admin.inc - Validation handler for the settings form.
File
- ./
search_file_attachments.inc, line 14 - Heler functions, to hold the .module file clean and smart.
Code
function search_file_attachments_check_java($path = NULL) {
$path = $path ? $path : 'java';
$temp = tempnam(file_directory_temp(), 'asa');
if (strpos(ini_get('extension_dir'), 'MAMP/')) {
$path = 'export DYLD_LIBRARY_PATH=""; ' . $path;
}
exec($path . ' -version > ' . $temp . ' 2>&1');
$stderror = file_get_contents($temp);
$found = preg_match('/Runtime Environment/', $stderror);
return $found ? TRUE : FALSE;
}