Revert "Merge pull request #158 from laf/issue-156"

This reverts commit e6fa7d433d, reversing
changes made to e2280aa603.

This commit does not constitute agreement with the claim of copyright violation made by Adam Armstrong at
https://github.com/librenms/librenms/commit/e6fa7d433d497abd0ffa56090eafda4630c96442
This commit is contained in:
Paul Gear
2014-04-28 20:14:06 +10:00
parent 45d8325e97
commit ee3ba9ceff
3 changed files with 4 additions and 37 deletions
+2 -35
View File
@@ -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;
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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']);