예제 #1
0
    /**
     * Run application method
     *
     * @return mixed
     */
    public function run()
    {
        $app = $this->Application();
        $loader = $app->Loader();

        $classMap = $this->Application()->AppPath('Proxies') . 'ClassMap.php';
        $loader->readClassMap($classMap);

        if (($config = $app->getOption('httpCache')) !== null && !empty($config['enabled'])) {
            $loader->registerNamespace('Symfony', 'Symfony/');
            $kernel = new HttpKernel($app);
            $cache = new AppCache($kernel, $config);
            $cache->handle(
                Request::createFromGlobals()
            )->send();
        } else {
            /** @var $front Enlight_Controller_Front */
            $front = $this->getResource('Front');
            $front->Response()->setHeader(
                'Content-Type', 'text/html; charset=' . $front->getParam('charset')
            );
            $front->dispatch();
        }

        $loader->saveClassMap($classMap);
    }
예제 #2
0
    echo file_get_contents(__DIR__ . '/recovery/update/maintenance.html');
    return;
}
// Check for active auto update
if (is_file('files/update/update.json')) {
    header('Content-type: text/html; charset=utf-8', true, 503);
    header('Status: 503 Service Temporarily Unavailable');
    header('Retry-After: 1200');
    echo file_get_contents(__DIR__ . '/recovery/update/maintenance.html');
    return;
}
// check for composer autoloader
if (!file_exists('vendor/autoload.php')) {
    header('Content-type: text/html; charset=utf-8', true, 503);
    echo '<h2>Error</h2>';
    echo 'Please execute "composer install" from the command line to install the required dependencies for Shopware 4';
    echo '<h2>Fehler</h2>';
    echo 'Bitte führen Sie zuerst "composer install" aus.';
    return;
}
require __DIR__ . '/autoload.php';
use Shopware\Kernel;
use Shopware\Components\HttpCache\AppCache;
use Symfony\Component\HttpFoundation\Request;
$environment = getenv('ENV') ?: getenv('REDIRECT_ENV') ?: 'production';
$kernel = new Kernel($environment, $environment !== 'production');
if ($kernel->isHttpCacheEnabled()) {
    $kernel = new AppCache($kernel, $kernel->getHttpCacheConfig());
}
$request = Request::createFromGlobals();
$kernel->handle($request)->send();
예제 #3
0
<?php

use Shopware\Components\HttpCache\AppCache;
use Symfony\Component\HttpFoundation\Request;
/**
 * @var Composer\Autoload\ClassLoader
 */
$loader = (require __DIR__ . '/../app/autoload.php');
$environment = getenv('SHOPWARE_ENV');
$kernel = new AppKernel($environment, $environment !== 'production');
if ($kernel->isHttpCacheEnabled()) {
    $kernel = new AppCache($kernel, $kernel->getHttpCacheConfig());
}
$request = Request::createFromGlobals();
// Trust the heroku load balancer
// see: https://devcenter.heroku.com/articles/getting-started-with-symfony#trusting-the-load-balancer
Request::setTrustedProxies([$request->server->get('REMOTE_ADDR')]);
Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null);
$response = $kernel->handle($request);
$response->send();