index.php line 59

Open in your IDE?
  1. <?php
  2. // CLI/Nginx/Cron: We need to set the "current working directory" to this folder
  3. chdir(__DIR__);
  4. // vendors not installed
  5. if (!is_dir(__DIR__ '/vendor')) {
  6.     echo 'Your install is missing some dependencies. If you have composer
  7.          installed you should run: <code>composer install</code>. If you
  8.          don\'t have composer installed you really should, see
  9.          http://getcomposer.org for more information';
  10.     return;
  11. }
  12. require_once __DIR__ '/autoload.php';
  13. use ForkCMS\App\AppKernel;
  14. use Symfony\Component\DependencyInjection\ContainerInterface;
  15. use Symfony\Component\HttpFoundation\Request;
  16. use Symfony\Component\Debug\Debug;
  17. // get environment and debug mode from environment variables
  18. $env $_SERVER['FORK_ENV'] ?: 'prod';
  19. $debug $_SERVER['FORK_DEBUG'] === '1';
  20. // Fork has not yet been installed
  21. $parametersFile __DIR__ '/app/config/parameters.yml';
  22. $request Request::createFromGlobals();
  23. if (!file_exists($parametersFile)) {
  24.     $env 'install';
  25.     if (strpos($request->getRequestUri(), '/install') !== 0) {
  26.         // check .htaccess
  27.         if (!$request->query->has('skiphtaccess') && !file_exists('.htaccess')) {
  28.             echo 'Your install is missing the .htaccess file. Make sure you show
  29.                  hidden files while uploading Fork CMS. Read the article about
  30.                  <a href="http://www.fork-cms.com/community/documentation/detail/installation/webservers">webservers</a>
  31.                  for further information. <a href="?skiphtaccess">Skip .htaccess
  32.                  check</a>';
  33.             return;
  34.         }
  35.         header('Location: /install');
  36.         return;
  37.     }
  38. }
  39. if (extension_loaded('newrelic')) {
  40.     newrelic_name_transaction(strtok($request->getRequestUri(), '?'));
  41. }
  42. //if ($debug) {
  43.     Debug::enable(~E_NOTICEfalse);
  44. //}
  45. $kernel = new AppKernel($env$debug);
  46. $response $kernel->handle($request);
  47. if ($response->getCharset() === null && $kernel->getContainer() instanceof ContainerInterface) {
  48.     $response->setCharset(
  49.         $kernel->getContainer()->getParameter('kernel.charset')
  50.     );
  51. }
  52. $response->send();
  53. if (!$kernel->isInstallingModule()) {
  54.     $kernel->terminate($request$response);
  55. }