Update exectool.php
This commit is contained in:
parent
a94501b20a
commit
00e5681bca
|
@ -107,6 +107,32 @@ if(!function_exists("exec_command")) {
|
||||||
function exec_command($command, $method="shell_exec", $options=array()) {
|
function exec_command($command, $method="shell_exec", $options=array()) {
|
||||||
$return = false;
|
$return = false;
|
||||||
|
|
||||||
|
// command cache
|
||||||
|
if(array_key_equals("cache", $options, true)) {
|
||||||
|
// set command cache filename
|
||||||
|
$filename = get_hashed_text($command, array(
|
||||||
|
"salt" => true,
|
||||||
|
"2p" => true
|
||||||
|
));
|
||||||
|
|
||||||
|
// read command cache
|
||||||
|
$return = read_storage_file($filename, array(
|
||||||
|
"storage_type" => "cache"
|
||||||
|
));
|
||||||
|
|
||||||
|
// write command cache
|
||||||
|
if(!$return) {
|
||||||
|
$options['cache'] = false;
|
||||||
|
$return = exec_command($command, $method, $options);
|
||||||
|
write_stroage_file($return, array(
|
||||||
|
"storage_type" => "cache",
|
||||||
|
"filename" => $filename
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($method == "") {
|
if ($method == "") {
|
||||||
// ob_start() will turn on output buffering to collect all output from
|
// ob_start() will turn on output buffering to collect all output from
|
||||||
// exec_test() and ob_end_clean() will clean the buffer afterwards ("garbage collection")
|
// exec_test() and ob_end_clean() will clean the buffer afterwards ("garbage collection")
|
||||||
|
@ -175,15 +201,6 @@ if(!function_exists("exec_command")) {
|
||||||
|
|
||||||
$return = ob_get_clean();
|
$return = ob_get_clean();
|
||||||
|
|
||||||
// save to cache
|
|
||||||
$fw = write_stroage_file($return, array(
|
|
||||||
"storage_type" => "cache",
|
|
||||||
"filename" => get_hashed_text($return, array(
|
|
||||||
"salt" => true,
|
|
||||||
"2p" => true
|
|
||||||
))
|
|
||||||
));
|
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user