25 lines
677 B
PHP
25 lines
677 B
PHP
|
<?php
|
||
|
function agiRunCmdWrapper($stdin, $stdout)
|
||
|
{
|
||
|
return function ($command) use ($stdin, $stdout) {
|
||
|
$texto = "-----> EXECUTAR COMANDO $command";
|
||
|
return $texto;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function agiLogWrapper($logEnabled)
|
||
|
{
|
||
|
return function ($texto, $options = array()) use ($logEnabled) {
|
||
|
if ($logEnabled) {
|
||
|
$target = 'log' . DIRECTORY_SEPARATOR . 'log.txt';
|
||
|
$texto .= PHP_EOL;
|
||
|
if (isset($options['new'])) {
|
||
|
file_put_contents($target, $texto);
|
||
|
} else {
|
||
|
$texto = $texto . PHP_EOL;
|
||
|
file_put_contents($target, $texto, FILE_APPEND);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|