web/website.php line 53

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) MASSIVE ART WebServices GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. use Symfony\Component\Debug\Debug;
  11. use Symfony\Component\HttpFoundation\Request;
  12. // Define application environment
  13. defined('SYMFONY_ENV') || define('SYMFONY_ENV'getenv('SYMFONY_ENV') ?: 'dev');
  14. defined('SULU_MAINTENANCE') || define('SULU_MAINTENANCE'getenv('SULU_MAINTENANCE') ?: false);
  15. // defined('SYMFONY_DEBUG') ||
  16. //     define('SYMFONY_DEBUG', filter_var(getenv('SYMFONY_DEBUG') ?: SYMFONY_ENV === 'dev', FILTER_VALIDATE_BOOLEAN));
  17. define('SYMFONY_DEBUG',true);
  18. // maintenance mode
  19. $maintenanceFilePath __DIR__ '/../app/maintenance.php';
  20. if (SULU_MAINTENANCE && file_exists($maintenanceFilePath)) {
  21.     // show maintenance mode and exit if no allowed IP is met
  22.     if (require $maintenanceFilePath) {
  23.         exit();
  24.     }
  25. }
  26. $loader = require __DIR__ '/../app/autoload.php';
  27. include_once __DIR__ '/../var/bootstrap.php.cache';
  28. if (SYMFONY_DEBUG) {
  29.     Debug::enable();
  30. }
  31. $kernel = new WebsiteKernel(SYMFONY_ENVSYMFONY_DEBUG);
  32. $kernel->loadClassCache();
  33. // Comment this line if you want to use the "varnish" http
  34. // caching strategy. See http://sulu.readthedocs.org/en/latest/cookbook/caching-with-varnish.html
  35. if (SYMFONY_ENV !== 'dev') {
  36.     $kernel = new WebsiteCache($kernel);
  37.     // When using the HttpCache, you need to call the method in your front controller
  38.     // instead of relying on the configuration parameter
  39.     Request::enableHttpMethodParameterOverride();
  40. }
  41. $request Request::createFromGlobals();
  42. $response $kernel->handle($request);
  43. $response->send();
  44. $kernel->terminate($request$response);