mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 09:41:49 +08:00
parent
7bd3fa82b1
commit
3d812c287f
|
@ -62,8 +62,6 @@ abstract class AbstractServer
|
|||
if (file_exists($file = $this->basePath.'/config.php')) {
|
||||
$this->config = include $file;
|
||||
}
|
||||
|
||||
$this->app = $this->getApp();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,6 +133,10 @@ abstract class AbstractServer
|
|||
*/
|
||||
protected function getApp()
|
||||
{
|
||||
if ($this->app !== null) {
|
||||
return $this->app;
|
||||
}
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
$app = new Application($this->basePath, $this->publicPath);
|
||||
|
@ -182,6 +184,8 @@ abstract class AbstractServer
|
|||
|
||||
$app->boot();
|
||||
|
||||
$this->app = $app;
|
||||
|
||||
return $app;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,11 @@ abstract class AbstractServer extends BaseAbstractServer
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user