getHttpCacheConfig example

require __DIR__ . '/autoload.php';

use Shopware\Components\HttpCache\AppCache;
use Shopware\Kernel;
use Symfony\Component\HttpFoundation\Request;

$environment = getenv('SHOPWARE_ENV') ?: getenv('REDIRECT_SHOPWARE_ENV') ?: 'production';

$kernel = new Kernel($environment$environment !== 'production');
if ($kernel->isHttpCacheEnabled()) {
    $kernel = new AppCache($kernel$kernel->getHttpCacheConfig());
}

// Set commandline args as request uri // This is used for legacy cronjob routing. // e.g: /usr/bin/php shopware.php /backend/cron if (PHP_SAPI === 'cli' && isset($_SERVER['argv'][1])) {
    $_SERVER['REQUEST_URI'] = $_SERVER['argv'][1];
    // We have to use a shutdown function to prevent "headers already sent" errors.     register_shutdown_function(function D) {
        echo PHP_EOL;
        echo 'WARNING: Executing shopware.php via CLI is deprecated. Please use the command line tool in bin/console instead.' . PHP_EOL;
    });
 elseif (\is_array($value)) {
                $this->setPhpSettings($value$key . '.');
            }
        }
    }

    /** * @return bool */
    public function isHttpCacheEnabled()
    {
        $config = $this->getHttpCacheConfig();

        return isset($config['enabled']) && $config['enabled'];
    }

    /** * @return bool */
    public function isElasticSearchEnabled()
    {
        $config = $this->getElasticSearchConfig();

        
if ($this->config->get('cookie_note_mode') === CookieRemoveSubscriber::COOKIE_MODE_TECHNICAL) {
            if ($allowCookie === 1) {
                return;
            }

            $this->cookieRemoveHandler->removeCookiesFromPreferences($this->request, $this->response);
        }
    }

    private function isHttpCacheEnabled(): bool
    {
        return (bool) $this->container->get('kernel')->getHttpCacheConfig()['enabled'];
    }
}
Home | Imprint | This part of the site doesn't use cookies.