Skip to content

Commit

Permalink
chore: update shopware/platform package
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim authored and github-actions[bot] committed Nov 22, 2023
1 parent 37fe3e3 commit 7f2978b
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 25 deletions.
2 changes: 1 addition & 1 deletion shopware/platform/6.6/bin/build-storefront.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --no-audit --
node "${STOREFRONT_ROOT}"/Resources/app/storefront/copy-to-vendor.js
npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run production
[[ ${SHOPWARE_SKIP_ASSET_COPY-""} ]] ||"${BIN_TOOL}" assets:install
[[ ${SHOPWARE_SKIP_THEME_COMPILE-""} ]] || "${BIN_TOOL}" theme:compile
[[ ${SHOPWARE_SKIP_THEME_COMPILE-""} ]] || "${BIN_TOOL}" theme:compile --active-only
5 changes: 4 additions & 1 deletion shopware/platform/6.6/bin/ci
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ return static function (array &$context) {
$context['INSTALL'] = true;
}

$_SERVER['DATABASE_URL'] = 'mysql://_placeholder.test';
if (trim($context['DATABASE_URL'] ?? '') === '') {
// fake DATABASE_URL
$_SERVER['DATABASE_URL'] = 'mysql://_placeholder.test';
}

$kernel = new HttpKernel($env, $debug, $classLoader);
$kernel->setPluginLoader($pluginLoader);
Expand Down
22 changes: 9 additions & 13 deletions shopware/platform/6.6/bin/console
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#!/usr/bin/env php
<?php

use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
use Shopware\Core\Framework\Plugin\KernelPluginLoader\DbalKernelPluginLoader;
use Shopware\Core\Framework\Plugin\KernelPluginLoader\StaticKernelPluginLoader;
use Shopware\Core\HttpKernel;
use Shopware\Core\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;

$envFile = __DIR__ . '/../.env';

if (!file_exists(__DIR__ . '/../.env') && !file_exists(__DIR__ . '/../.env.dist') && !file_exists(__DIR__ . '/../.env.local.php')) {
$_SERVER['APP_RUNTIME_OPTIONS']['disable_dotenv'] = true;
}
Expand Down Expand Up @@ -40,22 +37,21 @@ return static function (array &$context) {
$context['INSTALL'] = true;
}

if (trim($context['DATABASE_URL'] ?? '') !== '' && !isset($context['INSTALL'])) {
if (trim($context['DATABASE_URL'] ?? '') === '') {
// fake DATABASE_URL
$_SERVER['DATABASE_URL'] = 'mysql://_placeholder.test';
} else if (!isset($context['INSTALL'])) {
$pluginLoader = new DbalKernelPluginLoader($classLoader, null, \Shopware\Core\Kernel::getConnection());
}

$kernel = KernelFactory::create(
environment: $env,
debug: $debug,
classLoader: $classLoader,
pluginLoader: $pluginLoader
);
$kernel = new HttpKernel($env, $debug, $classLoader);
$kernel->setPluginLoader($pluginLoader);

$application = new Application($kernel);
$kernel->boot();
$application = new Application($kernel->getKernel());
$kernel->getKernel()->boot();

$application->setName('Shopware');
$application->setVersion($kernel->getContainer()->getParameter('kernel.shopware_version'));
$application->setVersion($kernel->getKernel()->getContainer()->getParameter('kernel.shopware_version'));

return $application;
};
2 changes: 1 addition & 1 deletion shopware/platform/6.6/bin/watch-storefront.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export STOREFRONT_ASSETS_PORT
export STOREFRONT_PROXY_PORT

DATABASE_URL="" "${CWD}"/console feature:dump
"${CWD}"/console theme:compile
"${CWD}"/console theme:compile --active-only
"${CWD}"/console theme:dump

if [[ $(command -v jq) ]]; then
Expand Down
50 changes: 41 additions & 9 deletions shopware/platform/6.6/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

use Shopware\Core\DevOps\Environment\EnvironmentHelper;
use Shopware\Core\Framework\Plugin\KernelPluginLoader\ComposerPluginLoader;
use Shopware\Core\HttpKernel;
use Shopware\Core\Installer\InstallerKernel;
use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\TerminableInterface;

$_SERVER['SCRIPT_FILENAME'] = __FILE__;

Expand All @@ -29,20 +33,48 @@
$appEnv = $context['APP_ENV'] ?? 'dev';
$debug = (bool) ($context['APP_DEBUG'] ?? ($appEnv !== 'prod'));

$trustedProxies = $context['TRUSTED_PROXIES'] ?? false;
if ($trustedProxies) {
Request::setTrustedProxies(
explode(',', $trustedProxies),
Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO
);
}

$trustedHosts = $context['TRUSTED_HOSTS'] ?? false;
if ($trustedHosts) {
Request::setTrustedHosts(explode(',', $trustedHosts));
}

if (!EnvironmentHelper::getVariable('SHOPWARE_SKIP_WEBINSTALLER', false) && !file_exists(dirname(__DIR__) . '/install.lock')) {
return new InstallerKernel($appEnv, $debug);
}

$pluginLoader = null;
$shopwareHttpKernel = new HttpKernel($appEnv, $debug, $classLoader);

if (EnvironmentHelper::getVariable('COMPOSER_PLUGIN_LOADER', false)) {
$pluginLoader = new ComposerPluginLoader($classLoader, null);
$shopwareHttpKernel->setPluginLoader(
new ComposerPluginLoader($classLoader, null)
);
}

return KernelFactory::create(
environment: $appEnv,
debug: $debug,
classLoader: $classLoader,
pluginLoader: $pluginLoader
);
return new class($shopwareHttpKernel) implements HttpKernelInterface, TerminableInterface {
private HttpKernel $httpKernel;

public function __construct(HttpKernel $httpKernel)
{
$this->httpKernel = $httpKernel;
}

public function handle(Request $request, int $type = self::MAIN_REQUEST, bool $catch = true): Response
{
return $this->httpKernel->handle($request, $type, $catch)->getResponse();
}

public function terminate(Request $request, Response $response): void
{
$this->httpKernel->terminate($request, $response);
}
};
};

0 comments on commit 7f2978b

Please sign in to comment.