mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 14:38:39 +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
|
* Get model based on request object
|
||||||
*
|
*
|
||||||
|
* @todo: change to graphql
|
||||||
|
*
|
||||||
* @param RequestAbstract $request Request object
|
* @param RequestAbstract $request Request object
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@
|
||||||
*/
|
*/
|
||||||
namespace phpOMS\Datatypes;
|
namespace phpOMS\Datatypes;
|
||||||
|
|
||||||
use phpOMS\Validation\Base\IbanEnum;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tree class.
|
* Tree class.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ abstract class SchedulerAbstract
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn
|
* @author Dennis Eichhorn
|
||||||
*/
|
*/
|
||||||
public function list() : array
|
public function getAll() : array
|
||||||
{
|
{
|
||||||
return $this->tasks;
|
return $this->tasks;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,16 @@ namespace phpOMS\Utils\TaskSchedule;
|
||||||
class TaskScheduler extends SchedulerAbstract
|
class TaskScheduler extends SchedulerAbstract
|
||||||
{
|
{
|
||||||
|
|
||||||
|
const BIN = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Env variables.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private $envOptions = [];
|
||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -41,12 +51,69 @@ class TaskScheduler extends SchedulerAbstract
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn
|
* @author Dennis Eichhorn
|
||||||
*/
|
*/
|
||||||
public function run(string $cmd) : array
|
public function run(string $cmd) : array
|
||||||
{
|
{
|
||||||
// TODO: Implement run() method.
|
$cmd = 'cd ' . escapeshellarg(dirname(self::BIN)) . ' && ' . basename(self::BIN) . ' -C ' . escapeshellarg(__DIR__) . ' ' . $cmd;
|
||||||
return [];
|
|
||||||
|
$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