diff --git a/includes/common.php b/includes/common.php index deff57a3de..387cb09ad8 100644 --- a/includes/common.php +++ b/includes/common.php @@ -21,43 +21,10 @@ function format_number_short($number, $sf) function external_exec($command) { - global $debug , $exec_response; - - $exec_response = array('command' => $command); + global $debug; if ($debug) { echo($command."\n"); } - - $descriptorspec = array( - 0 => array('pipe', 'r'), // stdin - 1 => array('pipe', 'w'), // stdout - 2 => array('pipe', 'w') // stderr - ); - - $process = proc_open($command, $descriptorspec, $pipes); - stream_set_blocking($pipes[2], 0); - if (is_resource($process)) - { - $exec_response['error'] = stream_get_contents($pipes[2]); - if ($exec_response['error']) - { - $output = FALSE; - } else { - $output = stream_get_contents($pipes[1]); - } - fclose($pipes[0]); - fclose($pipes[1]); - fclose($pipes[2]); - $exec_response['status'] = proc_close($process); - } else { - fclose($pipes[0]); - fclose($pipes[1]); - fclose($pipes[2]); - proc_terminate($process); - $output = FALSE; - $exec_error['error'] = ''; - $exec_response['status'] = -1; - } - + $output = shell_exec($command); if ($debug) { echo($output."\n"); } return $output; diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 56e1c04020..708b114d26 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -47,7 +47,7 @@ function discover_new_device($hostname) function discover_device($device, $options = NULL) { - global $config, $valid, $exec_response; + global $config, $valid; $valid = array(); // Reset $valid array diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index c95a1c5aae..cca6720791 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -89,7 +89,7 @@ function poll_sensor($device, $class, $unit) function poll_device($device, $options) { - global $config, $device, $polled_devices, $db_stats, $memcache, $exec_response; + global $config, $device, $polled_devices, $db_stats, $memcache; $attribs = get_dev_attribs($device['device_id']);