web/app.php line 55

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Enterprise License (PEL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  * @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  * @license    http://www.pimcore.org/license     GPLv3 and PEL
  13.  */
  14. use Pimcore\Tool;
  15. use Symfony\Component\Debug\Debug;
  16. use Symfony\Component\HttpFoundation\RedirectResponse;
  17. use Symfony\Component\HttpFoundation\Request;
  18. use Symfony\Component\HttpFoundation\Response;
  19. if (!defined('PIMCORE_PROJECT_ROOT')) {
  20.     define(
  21.         'PIMCORE_PROJECT_ROOT',
  22.         getenv('PIMCORE_PROJECT_ROOT')
  23.             ?: getenv('REDIRECT_PIMCORE_PROJECT_ROOT')
  24.             ?: realpath(__DIR__ '/..')
  25.     );
  26. }
  27. require_once PIMCORE_PROJECT_ROOT '/pimcore/config/bootstrap.php';
  28. $request Request::createFromGlobals();
  29. // set current request as property on tool as there's no
  30. // request stack available yet
  31. Tool::setCurrentRequest($request);
  32. // redirect to installer if pimcore is not installed
  33. if (!is_file(\Pimcore\Config::locateConfigFile('system.php'))) {
  34.     if (file_exists(__DIR__ '/install.php')) {
  35.         (new RedirectResponse('/install'Response::HTTP_FOUND))->send();
  36.         return;
  37.     }
  38.     Debug::enable(E_ALLtrue);
  39.     throw new RuntimeException('Pimcore is not installed and the installer is not available. Please add the installer or install via command line.');
  40. }
  41. /** @var \Pimcore\Kernel $kernel */
  42. $kernel = require_once PIMCORE_PROJECT_ROOT '/pimcore/config/kernel.php';
  43. // reset current request - will be read from request stack from now on
  44. Tool::setCurrentRequest(null);
  45. $response $kernel->handle($request);
  46. $response->send();
  47. $kernel->terminate($request$response);