- Some minor adjustements, also a WIP on the @Cronard annotation has begun
This commit is contained in:
parent
fd693fc8fc
commit
f72115aab4
|
@ -6,10 +6,13 @@ use Zend\Diactoros\Response\TextResponse;
|
||||||
|
|
||||||
use TheBugs\JavascriptMiddleware;
|
use TheBugs\JavascriptMiddleware;
|
||||||
|
|
||||||
use Cronard\CronardMiddleware;
|
use Cronard\CronardMiddleware,
|
||||||
|
Notes\Cronard\TaskFetcher;
|
||||||
|
|
||||||
use Lean\Lean;
|
use Lean\Lean;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
use Storage\Cookie,
|
use Storage\Cookie,
|
||||||
Storage\Session,
|
Storage\Session,
|
||||||
Storage\SessionMiddleware;
|
Storage\SessionMiddleware;
|
||||||
|
@ -57,6 +60,8 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
'routes' => [],
|
'routes' => [],
|
||||||
|
|
||||||
|
'cronard' => [],
|
||||||
],
|
],
|
||||||
|
|
||||||
Lean::class => autowire(Lean::class),
|
Lean::class => autowire(Lean::class),
|
||||||
|
@ -66,7 +71,17 @@ return [
|
||||||
return new TextResponse(sprintf("%s - cron task begin...", date('Y-m-d H:i:s')));
|
return new TextResponse(sprintf("%s - cron task begin...", date('Y-m-d H:i:s')));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $cronardMiddleware->fromFile(getenv("META_PATH")."/crontab.php");
|
return $cronardMiddleware->fromFile(getenv("META_PATH")."/crontab.php")->fromAnnotations($c->get(TaskFetcher::class));
|
||||||
|
},
|
||||||
|
|
||||||
|
TaskFetcher::class => function($c) {
|
||||||
|
$fetcher = new TaskFetcher();
|
||||||
|
|
||||||
|
$fetcher->setFolderList(array_map(function($item) {
|
||||||
|
return $item;
|
||||||
|
}, $c->get(Lean::class)->getCronard()));
|
||||||
|
|
||||||
|
return $fetcher;
|
||||||
},
|
},
|
||||||
|
|
||||||
JavascriptMiddleware::class => create(JavascriptMiddleware::class),
|
JavascriptMiddleware::class => create(JavascriptMiddleware::class),
|
||||||
|
|
|
@ -14,6 +14,8 @@ class Application
|
||||||
|
|
||||||
public array $routes;
|
public array $routes;
|
||||||
|
|
||||||
|
public array $cronard;
|
||||||
|
|
||||||
public array $entities;
|
public array $entities;
|
||||||
|
|
||||||
public array $tellJson;
|
public array $tellJson;
|
||||||
|
@ -52,10 +54,14 @@ class Application
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($routes = $data['routes'] ?? false)) {
|
if (is_array($data['routes'] ?? false)) {
|
||||||
$this->routes = $data['routes'];
|
$this->routes = $data['routes'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_array($data['cronard'] ?? false)) {
|
||||||
|
$this->cronard = $data['cronard'];
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -67,6 +67,11 @@ class Lean
|
||||||
return array_merge(...array_map(fn($app) => $app->routes ?? [], $this->applications));
|
return array_merge(...array_map(fn($app) => $app->routes ?? [], $this->applications));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCronard() : array
|
||||||
|
{
|
||||||
|
return array_merge(...array_map(fn($app) => $app->cronard ?? [], $this->applications));
|
||||||
|
}
|
||||||
|
|
||||||
public function getEntities() : array
|
public function getEntities() : array
|
||||||
{
|
{
|
||||||
return array_merge(...array_map(fn($app) => $app->entities ?? [], $this->applications));
|
return array_merge(...array_map(fn($app) => $app->entities ?? [], $this->applications));
|
||||||
|
|
Loading…
Reference in New Issue