diff --git a/CHANGELOG.md b/CHANGELOG.md index 5773b9e5..e3ff628d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), #### Fixed * [#309](https://github.com/shlinkio/shlink/issues/309) Added missing favicon to prevent 404 errors logged when an error page is loaded in a browser. +* [#310](https://github.com/shlinkio/shlink/issues/310) Fixed execution context not being properly detected, making `CloseDbConnectionMiddlware` to be always piped. Now the check is not even made, which simplifies everything. ## 1.15.0 - 2018-12-02 diff --git a/bin/cli b/bin/cli index 3284eea8..ea8cb5c3 100755 --- a/bin/cli +++ b/bin/cli @@ -3,11 +3,8 @@ declare(strict_types=1); use Interop\Container\ContainerInterface; -use Shlinkio\Shlink\Common\Exec\ExecutionContext; use Symfony\Component\Console\Application as CliApp; /** @var ContainerInterface $container */ $container = include __DIR__ . '/../config/container.php'; - -putenv(sprintf('CURRENT_SHLINK_CONTEXT=%s', ExecutionContext::CLI)); $container->get(CliApp::class)->run(); diff --git a/config/autoload/middleware-pipeline.global.php b/config/autoload/middleware-pipeline.global.php index 1e7877f5..19573e10 100644 --- a/config/autoload/middleware-pipeline.global.php +++ b/config/autoload/middleware-pipeline.global.php @@ -10,18 +10,11 @@ return [ 'middleware_pipeline' => [ 'pre-routing' => [ - 'middleware' => (function () { - $middleware = [ - ErrorHandler::class, - Expressive\Helper\ContentLengthMiddleware::class, - ]; - - if (Common\Exec\ExecutionContext::currentContextIsSwoole()) { - $middleware[] = Common\Middleware\CloseDbConnectionMiddleware::class; - } - - return $middleware; - })(), + 'middleware' => [ + ErrorHandler::class, + Expressive\Helper\ContentLengthMiddleware::class, + Common\Middleware\CloseDbConnectionMiddleware::class, + ], 'priority' => 12, ], 'pre-routing-rest' => [ diff --git a/module/Common/src/Exec/ExecutionContext.php b/module/Common/src/Exec/ExecutionContext.php deleted file mode 100644 index 214d7571..00000000 --- a/module/Common/src/Exec/ExecutionContext.php +++ /dev/null @@ -1,18 +0,0 @@ - config/params/* - public/index.php diff --git a/public/index.php b/public/index.php index f9469830..fa5d778c 100644 --- a/public/index.php +++ b/public/index.php @@ -2,11 +2,8 @@ declare(strict_types=1); use Psr\Container\ContainerInterface; -use Shlinkio\Shlink\Common\Exec\ExecutionContext; use Zend\Expressive\Application; /** @var ContainerInterface $container */ $container = include __DIR__ . '/../config/container.php'; - -putenv(sprintf('CURRENT_SHLINK_CONTEXT=%s', ExecutionContext::WEB)); $container->get(Application::class)->run();