hitagi-entrada/includes/wrapper-noswoole.php

25 lines
677 B
PHP
Raw Normal View History

2024-12-12 18:39:48 +00:00
<?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);
}
}
};
}