mirror of
https://github.com/flarum/framework.git
synced 2025-02-08 19:01:01 +08:00
parent
73b6ef520f
commit
7459afb89e
|
@ -62,8 +62,6 @@ abstract class AbstractServer
|
||||||
if (file_exists($file = $this->basePath.'/config.php')) {
|
if (file_exists($file = $this->basePath.'/config.php')) {
|
||||||
$this->config = include $file;
|
$this->config = include $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app = $this->getApp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,6 +133,10 @@ abstract class AbstractServer
|
||||||
*/
|
*/
|
||||||
protected function getApp()
|
protected function getApp()
|
||||||
{
|
{
|
||||||
|
if ($this->app !== null) {
|
||||||
|
return $this->app;
|
||||||
|
}
|
||||||
|
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
$app = new Application($this->basePath, $this->publicPath);
|
$app = new Application($this->basePath, $this->publicPath);
|
||||||
|
@ -182,6 +184,8 @@ abstract class AbstractServer
|
||||||
|
|
||||||
$app->boot();
|
$app->boot();
|
||||||
|
|
||||||
|
$this->app = $app;
|
||||||
|
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,11 @@ abstract class AbstractServer extends BaseAbstractServer
|
||||||
*/
|
*/
|
||||||
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $out = null)
|
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $out = null)
|
||||||
{
|
{
|
||||||
$this->collectGarbage($this->app);
|
$app = $this->getApp();
|
||||||
|
|
||||||
$middleware = $this->getMiddleware($this->app);
|
$this->collectGarbage($app);
|
||||||
|
|
||||||
|
$middleware = $this->getMiddleware($app);
|
||||||
|
|
||||||
return $middleware($request, $response, $out);
|
return $middleware($request, $response, $out);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user