- Added a new Email defintion (which will soon see it's components changed)

- Added a new post-install script for composer which adds a project skeleton "ready to use".
- Error 500 are now handled properly in production; waiting to see if adjustements will be required before adding other code pages.
This commit is contained in:
mcndave committed 2021-03-01 16:01:27 +00:00
1 parent 09b3e47c19
commit 01bb926ca7
30 files changed
+887 -2

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
<?php
use function DI\create, DI\autowire, DI\get;
use Dump\DumpMiddleware;
if ($_GET['sql'] ?? false) {
\Ulmus\Common\PdoObject::$dump = "dump";
}
return [
"dump" => create(DumpMiddleware::class),
"errorHandler" => create(Middlewares\Whoops::class),
];
+42
View File
@@ -0,0 +1,42 @@
<?php
use Picea\Picea;
use CSLSJ\Debogueur\DebogueurMiddleware;
use Laminas\Diactoros\Response\HtmlResponse;
use Psr\Http\Server\MiddlewareInterface,
Psr\Http\Message\ServerRequestInterface,
Psr\Http\Server\RequestHandlerInterface,
Psr\Http\Message\ResponseInterface;
use function DI\{ create, get, autowire };
error_reporting(getenv('ERROR_REPORTING') ?: ( E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE ));
return [
/* do nothing in production !*/
"dump" => function($c) {
if (! function_exists('dump') ) {
function dump(...$what) {}
}
return new class implements MiddlewareInterface {
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface { return $handler->handle($request); }
};
},
"errorHandler" => create(DebogueurMiddleware::class)->constructor(getenv('DEBOGUEUR_HASH') ?: "", null, get('app.errorhandler.html')),
'app.errorhandler.html' => function($c, Picea $picea) {
return function(\Throwable $exception) use ($picea) {
return new HtmlResponse($picea->renderHtml('lean/error/500', [
'title' => "Une erreur s'est produite lors de l'exécution du script.",
'subtitle' => "Êtes-vous connecté avec le bon compte ?",
'message' => $exception->getMessage(),
'exception' => $exception,
]));
};
},
];