mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Comment fixes
This commit is contained in:
parent
9bbdbcaf38
commit
d1f6921b20
|
|
@ -1330,6 +1330,8 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
/**
|
||||
* Get model based on request object
|
||||
*
|
||||
* @todo: change to graphql
|
||||
*
|
||||
* @param RequestAbstract $request Request object
|
||||
*
|
||||
* @return mixed
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
namespace phpOMS\Datatypes;
|
||||
|
||||
use phpOMS\Validation\Base\IbanEnum;
|
||||
|
||||
/**
|
||||
* Tree class.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ abstract class SchedulerAbstract
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function list() : array
|
||||
public function getAll() : array
|
||||
{
|
||||
return $this->tasks;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,16 @@ namespace phpOMS\Utils\TaskSchedule;
|
|||
class TaskScheduler extends SchedulerAbstract
|
||||
{
|
||||
|
||||
const BIN = '';
|
||||
|
||||
/**
|
||||
* Env variables.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $envOptions = [];
|
||||
|
||||
public function save()
|
||||
{
|
||||
|
||||
|
|
@ -41,12 +51,69 @@ class TaskScheduler extends SchedulerAbstract
|
|||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn
|
||||
*/
|
||||
public function run(string $cmd) : array
|
||||
{
|
||||
// TODO: Implement run() method.
|
||||
return [];
|
||||
$cmd = 'cd ' . escapeshellarg(dirname(self::BIN)) . ' && ' . basename(self::BIN) . ' -C ' . escapeshellarg(__DIR__) . ' ' . $cmd;
|
||||
|
||||
$pipes = [];
|
||||
$desc = [
|
||||
1 => ['pipe', 'w'],
|
||||
2 => ['pipe', 'w'],
|
||||
];
|
||||
|
||||
if (count($_ENV) === 0) {
|
||||
$env = null;
|
||||
foreach ($this->envOptions as $key => $value) {
|
||||
putenv(sprintf("%s=%s", $key, $value));
|
||||
}
|
||||
} else {
|
||||
$env = array_merge($_ENV, $this->envOptions);
|
||||
}
|
||||
|
||||
$resource = proc_open($cmd, $desc, $pipes, __DIR__, $env);
|
||||
$stdout = stream_get_contents($pipes[1]);
|
||||
$stderr = stream_get_contents($pipes[2]);
|
||||
|
||||
foreach ($pipes as $pipe) {
|
||||
fclose($pipe);
|
||||
}
|
||||
|
||||
$status = trim(proc_close($resource));
|
||||
|
||||
if ($status == -1) {
|
||||
throw new \Exception($stderr);
|
||||
}
|
||||
|
||||
return trim($stdout);
|
||||
}
|
||||
|
||||
public function getAll() : array
|
||||
{
|
||||
return str_getcsv($this->run('/query /v /fo CSV'));
|
||||
}
|
||||
|
||||
public function get(string $id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getByName(string $name) : Schedule
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getAllByName(string $name) : array
|
||||
{
|
||||
return str_getcsv($this->run('/query /v /fo CSV /tn ' . escapeshellarg($name)));
|
||||
}
|
||||
|
||||
public function create(Schedule $task)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user