index.php 1.2 KB
Newer Older
fettesvieh's avatar
fettesvieh committed
1
<?php
Tino Goratsch's avatar
Tino Goratsch committed
2

fettesvieh's avatar
fettesvieh committed
3
/**
Tino Goratsch's avatar
Tino Goratsch committed
4 5
 * Copyright (c) by the ACP3 Developers.
 * See the LICENSE file at the top-level module directory for licensing details.
fettesvieh's avatar
fettesvieh committed
6
 */
7

Tino Goratsch's avatar
Tino Goratsch committed
8
\define('ACP3_ROOT_DIR', \realpath(__DIR__) . '/');
9

Tino Goratsch's avatar
Tino Goratsch committed
10
require ACP3_ROOT_DIR . 'vendor/autoload.php';
fettesvieh's avatar
fettesvieh committed
11

12 13
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();

14
$appMode = \ACP3\Core\Environment\ApplicationMode::PRODUCTION;
Tino Goratsch's avatar
Tino Goratsch committed
15
if (\getenv('ACP3_APPLICATION_MODE') === \ACP3\Core\Environment\ApplicationMode::DEVELOPMENT) {
16 17 18
    $appMode = \ACP3\Core\Environment\ApplicationMode::DEVELOPMENT;
}

19 20
$kernel = new \ACP3\Core\Application\Bootstrap($appMode);

21
if (!$kernel->startupChecks()) {
Tino Goratsch's avatar
Tino Goratsch committed
22 23
    echo <<<HTML
The ACP3 is not correctly installed.
24
Please navigate to the <a href="{$request->getBasePath()}/installation/">installation wizard</a>
Tino Goratsch's avatar
Tino Goratsch committed
25 26
and follow its instructions.
HTML;
27 28 29
    exit;
}

30
$cacheStore = new \Toflar\Psr6HttpCacheStore\Psr6Store([
31
    'cache_directory' => __DIR__ . '/cache/' . $appMode . '/http',
32
]);
33

34
$appCache = new \ACP3\Core\Application\BootstrapCache(
35 36
    $kernel,
    $cacheStore,
37
    new \ACP3\Core\Application\BootstrapCache\Esi(),
38 39
    ['debug' => $appMode === \ACP3\Core\Environment\ApplicationMode::DEVELOPMENT]
);
40

41
$appCache->handle($request)->send();