forked from GithubBackups/vichan
Revert 9920a51ff5a5c6914f5bc72ce60c22245d5f1352
This commit is contained in:
parent
0e63c5041a
commit
2a40d82c00
@ -2363,21 +2363,10 @@ function DNS($host) {
|
|||||||
function shell_exec_error($command, $suppress_stdout = false) {
|
function shell_exec_error($command, $suppress_stdout = false) {
|
||||||
global $config, $debug;
|
global $config, $debug;
|
||||||
|
|
||||||
if( $config['debug'] ) {
|
|
||||||
$which = microtime(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine if $command is a valid command. If we don't, the following is considered valid output.
|
|
||||||
// '$command' is not recognized as an internal or external command, operable program or batch file.
|
|
||||||
if( empty( shell_exec("which $command") ) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $config['debug'] ) {
|
if( $config['debug'] ) {
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$return = trim(shell_exec('PATH="' . escapeshellcmd($config['shell_path']) . ':$PATH";' .
|
$return = trim(shell_exec('PATH="' . escapeshellcmd($config['shell_path']) . ':$PATH";' .
|
||||||
$command . ' 2>&1 ' . ($suppress_stdout ? '> /dev/null ' : '') . '&& echo "TB_SUCCESS"'));
|
$command . ' 2>&1 ' . ($suppress_stdout ? '> /dev/null ' : '') . '&& echo "TB_SUCCESS"'));
|
||||||
$return = preg_replace('/TB_SUCCESS$/', '', $return);
|
$return = preg_replace('/TB_SUCCESS$/', '', $return);
|
||||||
@ -2388,7 +2377,7 @@ function shell_exec_error($command, $suppress_stdout = false) {
|
|||||||
|
|
||||||
$debug['exec'][] = array(
|
$debug['exec'][] = array(
|
||||||
'command' => $command,
|
'command' => $command,
|
||||||
'time' => '~' . round($time * 1000, 2) . 'ms + ~' . round($time_which * 1000, 2) . 'ms',
|
'time' => '~' . round($time * 1000, 2) . 'ms',
|
||||||
'response' => $return ? $return : null
|
'response' => $return ? $return : null
|
||||||
);
|
);
|
||||||
$debug['time']['exec'] += $time;
|
$debug['time']['exec'] += $time;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user