517 lines
18 KiB
PHP
517 lines
18 KiB
PHP
<?php
|
|
|
|
namespace KupShop\KupShopBundle;
|
|
|
|
if (!function_exists('findModule') && !defined('PHPSTAN')) {
|
|
global $cfg;
|
|
|
|
if (file_exists('config/config.php')) {
|
|
require_once 'config/config.php';
|
|
} else {
|
|
require_once 'include/config.php';
|
|
}
|
|
|
|
require_once './engine/web/functions.common.php';
|
|
}
|
|
|
|
use Answear\LuigisBoxBundle\AnswearLuigisBoxBundle;
|
|
use KupShop\AgeVerifyBundle\AgeVerifyBundle;
|
|
use KupShop\InventoroBundle\InventoroBundle;
|
|
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
|
|
use KupShop\KupShopBundle\Util\Contexts;
|
|
use KupShop\LabelsBundle\LabelsBundle;
|
|
use KupShop\LuigisBoxBundle\LuigisBoxBundle;
|
|
use KupShop\MessengerBundle\MessengerBundle;
|
|
use KupShop\PreordersBundle\PreordersBundle;
|
|
use KupShop\ProductReservationBundle\ProductReservationBundle;
|
|
use KupShop\ReclamationsBundle\ReclamationsBundle;
|
|
use KupShop\ReclamationsSuppliersBundle\ReclamationsSuppliersBundle;
|
|
use KupShop\RecommendersBundle\RecommendersBundle;
|
|
use KupShop\ReservationBundle\ReservationBundle;
|
|
use KupShop\ReturnsBundle\ReturnsBundle;
|
|
use KupShop\SalesBundle\SalesBundle;
|
|
use KupShop\SalesmanBundle\SalesmanBundle;
|
|
use KupShop\SellerBundle\SellerBundle;
|
|
use KupShop\SynchronizationBundle\SynchronizationBundle;
|
|
use KupShop\TwoFactorBundle\TwoFactorBundle;
|
|
use KupShop\UserManagerBundle\UserManagerBundle;
|
|
use KupShop\WatchdogBundle\WatchdogBundle;
|
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
use Symfony\Component\HttpKernel\Kernel;
|
|
|
|
class KupShopAppKernel extends Kernel
|
|
{
|
|
public function registerBundles(): iterable
|
|
{
|
|
$bundles = [
|
|
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
|
new \Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
|
new \Symfony\Bundle\TwigBundle\TwigBundle(),
|
|
new \Symfony\Bundle\MonologBundle\MonologBundle(),
|
|
new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
|
new \CKSource\Bundle\CKFinderBundle\CKSourceCKFinderBundle(),
|
|
|
|
new \KupShop\KupShopBundle\KupShopBundle(),
|
|
new \KupShop\OrderingBundle\OrderingBundle(),
|
|
new \KupShop\UserBundle\UserBundle(),
|
|
new \KupShop\CatalogBundle\CatalogBundle(),
|
|
new \KupShop\ContentBundle\ContentBundle(),
|
|
new \KupShop\AdminBundle\AdminBundle(),
|
|
new \KupShop\MarketingBundle\MarketingBundle(),
|
|
new \KupShop\GTMBundle\GTMBundle(),
|
|
new \KupShop\GTMOldBundle\GTMOldBundle(),
|
|
new MessengerBundle(),
|
|
new \KupShop\SystemInspectionBundle\SystemInspectionBundle(),
|
|
];
|
|
|
|
if (findModule(\Modules::CDN)) {
|
|
$bundles[] = new \KupShop\CDNBundle\CDNBundle();
|
|
}
|
|
|
|
if (in_array($this->getEnvironment(), ['dev', 'test', 'test_engine'], true) || isBeta()) {
|
|
$bundles = array_merge([new \KupShop\DevelopmentBundle\DevelopmentBundle()], $bundles);
|
|
$bundles[] = new \KupShop\StorybookBundle\StorybookBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::COMPONENTS)) {
|
|
$bundles[] = new \Twig\Extra\TwigExtraBundle\TwigExtraBundle();
|
|
$bundles[] = new \Symfony\UX\TwigComponent\TwigComponentBundle();
|
|
$bundles[] = new \Symfony\UX\Icons\UXIconsBundle();
|
|
$bundles[] = new \Symfony\UX\LiveComponent\LiveComponentBundle();
|
|
$bundles[] = new \Symfony\UX\StimulusBundle\StimulusBundle();
|
|
$bundles[] = new \KupShop\ComponentsBundle\ComponentsBundle();
|
|
$bundles[] = new \Translation\Bundle\TranslationBundle();
|
|
$bundles[] = new \Translation\PlatformAdapter\Loco\Bridge\Symfony\TranslationAdapterLocoBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::TWO_FACTOR)) {
|
|
$bundles[] = new \Scheb\TwoFactorBundle\SchebTwoFactorBundle();
|
|
$bundles[] = new TwoFactorBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::USER_OAUTH)) {
|
|
// If you require the php-http/httplug-bundle package.
|
|
$bundles[] = new \Http\HttplugBundle\HttplugBundle();
|
|
$bundles[] = new \HWI\Bundle\OAuthBundle\HWIOAuthBundle();
|
|
$bundles[] = new \KupShop\UserOauthBundle\UserOauthBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::PRODUCT_GIFTS)) {
|
|
$bundles[] = new \KupShop\ProductGiftsBundle\ProductGiftsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::CESKA_POSTA)) {
|
|
$bundles[] = new \KupShop\CeskaPostaBundle\CeskaPostaBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::CURRENCIES)) {
|
|
$bundles[] = new \KupShop\I18nBundle\I18nBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::INDEXED_FILTER)) {
|
|
$bundles[] = new \KupShop\IndexedFilterBundle\IndexedFilterBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::QUANTITY_DISCOUNT)) {
|
|
$bundles[] = new \KupShop\QuantityDiscountBundle\QuantityDiscountBundle();
|
|
}
|
|
|
|
$bundles[] = new \KupShop\FeedsBundle\FeedsBundle();
|
|
if (findModule(\Modules::FEED_GENERATOR)) {
|
|
$bundles[] = new \KupShop\FeedGeneratorBundle\FeedGeneratorBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::DELIVERY_PRICELIST)) {
|
|
$bundles[] = new \KupShop\DeliveryPriceListBundle\DeliveryPriceListBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::PRICELISTS) || \findModule(\Modules::B2B)) {
|
|
$bundles[] = new \KupShop\PricelistBundle\PricelistBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::EET)) {
|
|
$bundles[] = new \KupShop\EETBundle\EETBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::SKEET)) {
|
|
$bundles[] = new \KupShop\SKEETBundle\SKEETBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::XML_FEEDS_B2B) || \findModule(\Modules::B2B)) {
|
|
$bundles[] = new \KupShop\XMLFeedBundle\XMLFeedBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::B2B)) {
|
|
$bundles[] = new \KupShop\B2BBundle\B2BBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::MARGINS)) {
|
|
$bundles[] = new \KupShop\MarginsBundle\MarginsBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::BALIKONOS)) {
|
|
$bundles[] = new \KupShop\BalikonosBundle\BalikonosBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::API)) {
|
|
$bundles[] = new \KupShop\ApiBundle\ApiBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::PRODUCTS, \Modules::SUB_SETS)) {
|
|
$bundles[] = new \KupShop\ProductSetsBundle\ProductSetsBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::BONUS_PROGRAM)) {
|
|
$bundles[] = new \KupShop\BonusProgramBundle\BonusProgramBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::MAILERLITE)) {
|
|
$bundles[] = new \KupShop\MailerLiteBundle\MailerLiteBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::STORES)) {
|
|
$bundles[] = new \KupShop\StoresBundle\StoresBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::TELFA)) {
|
|
$bundles[] = new \KupShop\TelfaBundle\TelfaBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::DB_REWRITE)) {
|
|
$bundles[] = new \KupShop\RewriteBundle\RewriteBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::RESTRICTIONS) || \findModule(\Modules::B2B)) {
|
|
$bundles[] = new \KupShop\RestrictionsBundle\RestrictionsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::WAREHOUSE)) {
|
|
$bundles[] = new \KupShop\CheckAppBundle\CheckAppBundle();
|
|
$bundles[] = new \KupShop\WarehouseBundle\WarehouseBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::RETURNS)) {
|
|
$bundles[] = new ReturnsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::RECLAMATIONS)) {
|
|
$bundles[] = new ReclamationsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::RECLAMATIONS_ELNINO)) {
|
|
$bundles[] = new \KupShop\ReclamationsElninoBundle\ReclamationsElninoBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::WEBPACK)) {
|
|
$bundles[] = new \Symfony\WebpackEncoreBundle\WebpackEncoreBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::HEUREKA_CART) || findModule(\Modules::DROPSHIP)) {
|
|
$bundles[] = new \KupShop\HeurekaCartBundle\HeurekaCartBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::LOCALE_PREFIX)) {
|
|
$bundles[] = new \KupShop\LocalePrefixBundle\LocalePrefixBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::PRODUCTS, \Modules::SUB_UNITS)) {
|
|
$bundles[] = new \KupShop\UnitsBundle\UnitsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::ORDER_RESTRICTIONS)) {
|
|
$bundles[] = new \KupShop\OrderRestrictionsBundle\OrderRestrictionsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::GLOBAL_DISCOUNTS)) {
|
|
$bundles[] = new \KupShop\GlobalDiscountsBundle\GlobalDiscountsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::ORDER_DISCOUNT)) {
|
|
$bundles[] = new \KupShop\OrderDiscountBundle\OrderDiscountBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::METRICS)) {
|
|
$bundles[] = new \KupShop\MetricsBundle\MetricsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::POHODA)) {
|
|
$bundles[] = new \KupShop\PohodaBundle\PohodaBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::PARAMETER_GROUPS)) {
|
|
$bundles[] = new \KupShop\ParameterGroupsBundle\ParameterGroupsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::PRODUCTS_CHARGES)) {
|
|
$bundles[] = new \KupShop\ProductsChargesBundle\ProductsChargesBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::PRODUCTS_COMPARE)) {
|
|
$bundles[] = new \KupShop\ProductCompareBundle\ProductCompareBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::COMMENTS)) {
|
|
$bundles[] = new \KupShop\CommentsBundle\CommentsBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::INCOMAKER)) {
|
|
$bundles[] = new \KupShop\IncomakerBundle\IncomakerBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::ECOMAIL)) {
|
|
$bundles[] = new \KupShop\EcomailBundle\EcomailBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::BANK_AUTO_PAYMENTS)) {
|
|
$bundles[] = new \KupShop\BankAutoPaymentBundle\BankAutoPaymentBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::PRICE_HISTORY)) {
|
|
$bundles[] = new \KupShop\PriceHistoryBundle\PriceHistoryBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::PAYMENTS, \Modules::SUB_PAYPAL_CHECKOUT)) {
|
|
$bundles[] = new \KupShop\PayPalCheckoutBundle\PayPalCheckoutBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::RESPONSE_CACHE)) {
|
|
$bundles[] = new \KupShop\ResponseCacheBundle\ResponseCacheBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::PROXY_CACHE)) {
|
|
$bundles[] = new \KupShop\ProxyCacheBundle\ProxyCacheBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::AUTOPILOT)) {
|
|
$bundles[] = new \KupShop\AutopilotBundle\AutopilotBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::USER_MANAGER)) {
|
|
$bundles[] = new UserManagerBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::DROPSHIP)) {
|
|
$bundles[] = new \KupShop\DropshipBundle\DropshipBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::PRODUCTS_SERIAL_NUMBERS)) {
|
|
$bundles[] = new \KupShop\ProductsSerialNumbersBundle\ProductsSerialNumbersBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::PRODUCTS_BATCHES)) {
|
|
$bundles[] = new \KupShop\ProductsBatchesBundle\ProductsBatchesBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::PRODUCT_RESERVATIONS) || findModule(\Modules::RESERVATIONS)) {
|
|
$bundles[] = new ProductReservationBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::ARTICLES)) {
|
|
$bundles[] = new \KupShop\ArticlesBundle\ArticlesBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::DAKTELA)) {
|
|
$bundles[] = new \KupShop\DaktelaBundle\DaktelaBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::SAVE_FORMS)) {
|
|
$bundles[] = new \KupShop\SaveFormsBundle\SaveFormsBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::GRAPHQL)) {
|
|
if ($this->getEnvironment() === 'dev') {
|
|
$bundles[] = new \Overblog\GraphiQLBundle\OverblogGraphiQLBundle();
|
|
}
|
|
$bundles[] = new \TheCodingMachine\GraphQLite\Bundle\GraphQLiteBundle();
|
|
$bundles[] = new \KupShop\GraphQLBundle\GraphQLBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::OSS_VATS) && \findModule(\Modules::CURRENCIES)) {
|
|
$bundles[] = new \KupShop\OSSVatsBundle\OSSVatsBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::INVOICES)) {
|
|
$bundles[] = new \KupShop\InvoicesBundle\InvoicesBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::CHECK_APP) && !findModule(\Modules::WAREHOUSE)) {
|
|
$bundles[] = new \KupShop\CheckAppBundle\CheckAppBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::NEW_POS)) {
|
|
$bundles[] = new \KupShop\POSBundle\POSBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::SHOPPING_LIST)) {
|
|
$bundles[] = new \KupShop\ShoppingListBundle\ShoppingListBundle();
|
|
}
|
|
|
|
if (\findModule(\Modules::AUTOMATION_CONFIGURATOR)) {
|
|
$bundles[] = new \KupShop\AutomationConfiguratorBundle\AutomationConfiguratorBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::SELLERS)) {
|
|
$bundles[] = new SellerBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::INVENTORO)) {
|
|
$bundles[] = new InventoroBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::WATCHDOG)) {
|
|
$bundles[] = new WatchdogBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::AGE_VERIFY)) {
|
|
$bundles[] = new AgeVerifyBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::CONVERTORS)) {
|
|
$bundles[] = new \KupShop\ConvertorsBundle\ConvertorsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::RECLAMATIONS_SUPPLIERS)) {
|
|
$bundles[] = new ReclamationsSuppliersBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::SYNCHRONIZATION)) {
|
|
$bundles[] = new SynchronizationBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::RESERVATIONS)) {
|
|
$bundles[] = new ReservationBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::SALES)) {
|
|
$bundles[] = new SalesBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::LUIGIS_BOX)) {
|
|
// Ve složce shopu spustit: composer require answear/luigis-box-bundle
|
|
$bundles[] = new AnswearLuigisBoxBundle();
|
|
$bundles[] = new LuigisBoxBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::LABELS)) {
|
|
$bundles[] = new LabelsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::B2B_PREORDERS)) {
|
|
$bundles[] = new PreordersBundle();
|
|
}
|
|
|
|
if (in_array($this->getEnvironment(), ['dev', 'test', 'test_engine'], true)) {
|
|
$bundles[] = new \Symfony\Bundle\DebugBundle\DebugBundle();
|
|
$bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::DYNAMIC_RELATED_PRODUCTS)) {
|
|
$bundles[] = new \KupShop\DynamicRelatedProductsBundle\DynamicRelatedProductsBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::PRODUCTS_SECTIONS, \Modules::SUB_ELASTICSEARCH)) {
|
|
$bundles[] = new \KupShop\CatalogElasticBundle\CatalogElasticBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::RECOMMENDERS)) {
|
|
$bundles[] = new RecommendersBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::COWORKERS)) {
|
|
$bundles[] = new \KupShop\CoworkersBundle\CoworkersBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::KAFKA)) {
|
|
$bundles[] = new \KupShop\KafkaBundle\KafkaBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::USER_ADDRESSES)) {
|
|
$bundles[] = new \KupShop\UserAddressesBundle\UserAddressesBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::LLM)) {
|
|
$bundles[] = new \KupShop\LLMBundle\LLMBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::TRUSTPILOT)) {
|
|
$bundles[] = new \KupShop\TrustpilotBundle\TrustpilotBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::SALESMAN)) {
|
|
$bundles[] = new SalesmanBundle();
|
|
}
|
|
|
|
if (findModule(\Modules::RECAPTCHA, \Modules::SUB_GCLOUD)) {
|
|
$bundles[] = new \KupShop\RecaptchaBundle\RecaptchaBundle();
|
|
}
|
|
|
|
return $bundles;
|
|
}
|
|
|
|
public function boot()
|
|
{
|
|
if (true === $this->booted) {
|
|
return parent::boot();
|
|
}
|
|
|
|
parent::boot();
|
|
|
|
// Set current kernel to avoid duplicate kernel creation
|
|
ServiceContainer::setKernel($this);
|
|
}
|
|
|
|
public function getProjectDir(): string
|
|
{
|
|
global $cfg;
|
|
|
|
return realpath($cfg['Path']['web_root']);
|
|
}
|
|
|
|
public function getCacheDir(): string
|
|
{
|
|
if ($dir = getenv('CONTAINER_DIR')) {
|
|
return $this->getProjectDir().'/'.$dir;
|
|
}
|
|
|
|
return $this->getProjectDir().'/data/tmp/'.$this->getEnvironment();
|
|
}
|
|
|
|
public function getLogDir(): string
|
|
{
|
|
return $this->getProjectDir().'/data/tmp/logs';
|
|
}
|
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader)
|
|
{
|
|
$loader->load('@KupShopBundle/Resources/config/config_'.$this->getEnvironment().'.yml');
|
|
|
|
$kupshopEnv = getenv('KUPSHOP_ENV');
|
|
if (!empty($kupshopEnv)) {
|
|
$loader->load('@KupShopBundle/Resources/config/config_'.$kupshopEnv.'.yml');
|
|
}
|
|
|
|
if (!defined('TEST_SUITE') or TEST_SUITE == 'shop') {
|
|
if (static::class === \Shop\Kernel::class) {
|
|
// Component style folder structure
|
|
$loader->load($this->getProjectDir().'/config/config.yaml');
|
|
} else {
|
|
$loader->load($this->getProjectDir().'/app/config/config.yml');
|
|
}
|
|
}
|
|
|
|
// Na krakonosovi/pardalovi redis neni
|
|
// Staré shopy || local || nové shopy na komponentách
|
|
if ((getenv('REDIS') && isRunningOnCluster()) || isLocalDevelopment() || findModule(\Modules::COMPONENTS)) {
|
|
$loader->load('@KupShopBundle/Resources/config/config_redis.yml');
|
|
}
|
|
}
|
|
|
|
public function reboot(?string $warmupDir)
|
|
{
|
|
// Clear services caches on kernel reboot
|
|
Contexts::clear();
|
|
|
|
parent::reboot($warmupDir);
|
|
}
|
|
}
|