From 027482628e0485588171f9ac98f6c9d0c72a3d20 Mon Sep 17 00:00:00 2001 From: Danny van Wijk Date: Tue, 8 Oct 2024 15:54:25 +0200 Subject: [PATCH 1/6] Improve domain based locale router performance --- .../Router/DomainBasedLocaleRouter.php | 50 +------------------ 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php index 4a3a872192..d4a8159127 100644 --- a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php +++ b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php @@ -9,14 +9,10 @@ use Symfony\Component\Routing\Generator\UrlGenerator; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Matcher\UrlMatcher; -use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; class DomainBasedLocaleRouter extends SlugRouter { - /** @var RouteCollection */ - protected $routeCollectionMultiLanguage; - /** * @var array|null */ @@ -172,17 +168,6 @@ private function getReverseLocaleMap(): array */ public function getRouteCollection(): RouteCollection { - if (($this->otherSite && $this->isMultiLanguage($this->otherSite['host'])) || (!$this->otherSite && $this->isMultiLanguage())) { - if (!$this->routeCollectionMultiLanguage) { - $this->routeCollectionMultiLanguage = new RouteCollection(); - - $this->addMultiLangPreviewRoute(); - $this->addMultiLangSlugRoute(); - } - - return $this->routeCollectionMultiLanguage; - } - if (!$this->routeCollection) { $this->routeCollection = new RouteCollection(); @@ -202,39 +187,6 @@ protected function addSlugRoute() $this->addRoute('_slug', $routeParameters); } - /** - * Add the slug route to the route collection - */ - protected function addMultiLangPreviewRoute() - { - $routeParameters = $this->getPreviewRouteParameters(); - $this->addMultiLangRoute('_slug_preview', $routeParameters); - } - - /** - * Add the slug route to the route collection multilanguage - */ - protected function addMultiLangSlugRoute() - { - $routeParameters = $this->getSlugRouteParameters(); - $this->addMultiLangRoute('_slug', $routeParameters); - } - - /** - * @param string $name - */ - protected function addMultiLangRoute($name, array $parameters = []) - { - $this->routeCollectionMultiLanguage->add( - $name, - new Route( - $parameters['path'], - $parameters['defaults'], - $parameters['requirements'] - ) - ); - } - /** * Return slug route parameters * @@ -258,7 +210,7 @@ protected function getSlugRouteParameters() // If other site provided and multilingual, get the locales from the host config. if ($this->otherSite && $this->isMultiLanguage($this->otherSite['host'])) { $locales = $this->getHostLocales(); - } elseif ($this->isMultiLanguage() && !$this->otherSite) { + } elseif (!$this->otherSite && $this->isMultiLanguage()) { $locales = $this->getFrontendLocales(); } From 89758999aa0e78c00f207540f5349a8eebba4c39 Mon Sep 17 00:00:00 2001 From: Danny van Wijk Date: Wed, 9 Oct 2024 13:05:44 +0200 Subject: [PATCH 2/6] Remove unnecessary calls to getDefaultLocale --- .../Router/DomainBasedLocaleRouter.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php index d4a8159127..ed02e0d354 100644 --- a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php +++ b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php @@ -32,7 +32,7 @@ class DomainBasedLocaleRouter extends SlugRouter */ public function generate($name, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string { - if ('_slug' === $name && $this->isMultiLanguage() && $this->isMultiDomainHost()) { + if ('_slug' === $name && $this->isMultiDomainHost() && $this->isMultiLanguage()) { $locale = isset($parameters['_locale']) ? $parameters['_locale'] : $this->getRequestLocale(); $reverseLocaleMap = $this->getReverseLocaleMap(); @@ -96,13 +96,7 @@ public function match($pathinfo): array */ protected function getRequestLocale() { - $request = $this->getMasterRequest(); - $locale = $this->getDefaultLocale(); - if (!\is_null($request)) { - $locale = $request->getLocale(); - } - - return $locale; + return $this->getMasterRequest()?->getLocale() ?: $this->getDefaultLocale(); } /** From 4263384a8bc600169a602eb53c1559b1fd476f0f Mon Sep 17 00:00:00 2001 From: Danny van Wijk Date: Wed, 9 Oct 2024 14:24:18 +0200 Subject: [PATCH 3/6] Reduce some host calls --- .../Router/DomainBasedLocaleRouter.php | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php index ed02e0d354..e0465bbd0e 100644 --- a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php +++ b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php @@ -13,15 +13,8 @@ class DomainBasedLocaleRouter extends SlugRouter { - /** - * @var array|null - */ - private $otherSite; - - /** - * @var array - */ - private $cachedNodeTranslations = []; + private ?array $otherSite = null; + private array $cachedNodeTranslations = []; /** * Generate an url for a supplied route @@ -43,8 +36,6 @@ public function generate($name, $parameters = [], $referenceType = UrlGeneratorI if (isset($parameters['otherSite'])) { $this->otherSite = $this->domainConfiguration->getFullHostById($parameters['otherSite']); - } else { - $this->otherSite = null; } $this->urlGenerator = new UrlGenerator( @@ -72,13 +63,8 @@ public function match($pathinfo): array $result = $urlMatcher->match($pathinfo); if (!empty($result)) { // Remap locale for front-end requests - if ($this->isMultiDomainHost() - && $this->isMultiLanguage() - && !$result['preview'] - ) { - $localeMap = $this->getLocaleMap(); - $locale = $result['_locale']; - $result['_locale'] = $localeMap[$locale]; + if (!$result['preview'] && $this->isMultiDomainHost() && $this->isMultiLanguage()) { + $result['_locale'] = $this->getLocaleMap()[$result['_locale']]; } $nodeTranslation = $this->getNodeTranslation($result); @@ -193,26 +179,25 @@ protected function getSlugRouteParameters() '_controller' => SlugController::class . '::slugAction', 'preview' => false, 'url' => '', - '_locale' => $this->getDefaultLocale(), ]; $slugRequirements = [ 'url' => $this->getSlugPattern(), ]; - $locales = []; - // If other site provided and multilingual, get the locales from the host config. + $locales = []; if ($this->otherSite && $this->isMultiLanguage($this->otherSite['host'])) { $locales = $this->getHostLocales(); } elseif (!$this->otherSite && $this->isMultiLanguage()) { $locales = $this->getFrontendLocales(); } - // Make locale availables for the slug routes. + // Make locale available for the slug routes. if (!empty($locales)) { $slugPath = '/{_locale}' . $slugPath; - unset($slugDefaults['_locale']); - $slugRequirements['_locale'] = $this->getEscapedLocales($this->getHostLocales()); + $slugRequirements['_locale'] = $this->getEscapedLocales(!$this->otherSite ? $locales : $this->getHostLocales()); + } else { + $slugDefaults['_locale'] = $this->getDefaultLocale(); } return [ From b4c00400fac0dacddbbc59ad2cd551c6bf09829d Mon Sep 17 00:00:00 2001 From: Danny van Wijk Date: Wed, 9 Oct 2024 15:26:37 +0200 Subject: [PATCH 4/6] Reduce calls in SlugRouter --- src/Kunstmaan/NodeBundle/Router/SlugRouter.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Kunstmaan/NodeBundle/Router/SlugRouter.php b/src/Kunstmaan/NodeBundle/Router/SlugRouter.php index 41211af5f6..30568bab08 100644 --- a/src/Kunstmaan/NodeBundle/Router/SlugRouter.php +++ b/src/Kunstmaan/NodeBundle/Router/SlugRouter.php @@ -182,7 +182,6 @@ protected function getPreviewRouteParameters() '_controller' => SlugController::class . '::slugAction', 'preview' => true, 'url' => '', - '_locale' => $this->getDefaultLocale(), ]; $previewRequirements = [ 'url' => $this->getSlugPattern(), @@ -190,8 +189,9 @@ protected function getPreviewRouteParameters() if ($this->isMultiLanguage()) { $previewPath = '/{_locale}' . $previewPath; - unset($previewDefaults['_locale']); $previewRequirements['_locale'] = $this->getEscapedLocales($this->getBackendLocales()); + } else { + $previewDefaults['_locale'] = $this->getDefaultLocale(); } return [ @@ -213,7 +213,6 @@ protected function getSlugRouteParameters() '_controller' => SlugController::class . '::slugAction', 'preview' => false, 'url' => '', - '_locale' => $this->getDefaultLocale(), ]; $slugRequirements = [ 'url' => $this->getSlugPattern(), @@ -221,8 +220,9 @@ protected function getSlugRouteParameters() if ($this->isMultiLanguage()) { $slugPath = '/{_locale}' . $slugPath; - unset($slugDefaults['_locale']); $slugRequirements['_locale'] = $this->getEscapedLocales($this->getFrontendLocales()); + } else { + $slugDefaults['_locale'] = $this->getDefaultLocale(); } return [ From ee41e2941ceaa90c4ebe433a2fd00e650834995e Mon Sep 17 00:00:00 2001 From: Danny van Wijk Date: Mon, 4 Nov 2024 10:31:10 +0100 Subject: [PATCH 5/6] Restore methods --- UPGRADE-7.2.md | 7 +++ .../DependencyInjection/Configuration.php | 1 + .../Router/DomainBasedLocaleRouter.php | 62 +++++++++++++++++++ .../Router/DomainBasedLocaleRouterTest.php | 7 ++- .../DependencyInjection/Configuration.php | 1 + .../KunstmaanNodeExtension.php | 7 +++ .../NodeBundle/Router/SlugRouter.php | 17 +++++ .../DependencyInjection/ConfigurationTest.php | 1 + .../KunstmaanNodeExtensionTest.php | 15 ++++- 9 files changed, 116 insertions(+), 2 deletions(-) diff --git a/UPGRADE-7.2.md b/UPGRADE-7.2.md index 5a615fb460..1ecfc60cb7 100644 --- a/UPGRADE-7.2.md +++ b/UPGRADE-7.2.md @@ -10,3 +10,10 @@ PagePartBundle -------------- - Not passing a HasPagePartsInterface as second parameter in PagePartEvent is deprecated and will be required in 8.0. + + +NodeBundle +----------------- + +- The node-bundle/multidomain-bundle has now some improved logic in the router itself. Using the old router logic is deprecated and the new will be the default in 8.0. + To enable the new and improved router, set the `kunstmaan_node.enable_improved_router` config to `true`. diff --git a/src/Kunstmaan/MultiDomainBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/MultiDomainBundle/DependencyInjection/Configuration.php index bd52b3d98f..bdcb258e38 100644 --- a/src/Kunstmaan/MultiDomainBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/MultiDomainBundle/DependencyInjection/Configuration.php @@ -52,6 +52,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->end() ->end() ->end() + ->end() ->end() ->end(); diff --git a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php index e0465bbd0e..5513d49586 100644 --- a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php +++ b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php @@ -9,10 +9,18 @@ use Symfony\Component\Routing\Generator\UrlGenerator; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Matcher\UrlMatcher; +use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; class DomainBasedLocaleRouter extends SlugRouter { + /** + * @var RouteCollection + * + * @deprecated routeCollectionMultiLanguage property is deprecated in 7.2 and will be removed in 8.0. There is no replacement for this property. + */ + protected $routeCollectionMultiLanguage; + private ?array $otherSite = null; private array $cachedNodeTranslations = []; @@ -148,6 +156,21 @@ private function getReverseLocaleMap(): array */ public function getRouteCollection(): RouteCollection { + if (!$this->enabledImprovedRouter) { + trigger_deprecation('kunstmaan/multidomain-bundle', '7.2', 'Not enabling the improved router is deprecated and the changed and improved router will be the default in 8.0. Set the "kunstmaan_multi_domain.enable_improved_domain_based_local_router" config to true.'); + + if (($this->otherSite && $this->isMultiLanguage($this->otherSite['host'])) || (!$this->otherSite && $this->isMultiLanguage())) { + if (!$this->routeCollectionMultiLanguage) { + $this->routeCollectionMultiLanguage = new RouteCollection(); + + $this->addMultiLangPreviewRoute(); + $this->addMultiLangSlugRoute(); + } + + return $this->routeCollectionMultiLanguage; + } + } + if (!$this->routeCollection) { $this->routeCollection = new RouteCollection(); @@ -167,6 +190,45 @@ protected function addSlugRoute() $this->addRoute('_slug', $routeParameters); } + /** + * Add the slug route to the route collection + */ + protected function addMultiLangPreviewRoute() + { + trigger_deprecation('kunstmaan/multidomain-bundle', '7.2', 'This method is deprecated and will be removed in 8.0.'); + + $routeParameters = $this->getPreviewRouteParameters(); + $this->addMultiLangRoute('_slug_preview', $routeParameters); + } + + /** + * Add the slug route to the route collection multilanguage + */ + protected function addMultiLangSlugRoute() + { + trigger_deprecation('kunstmaan/multidomain-bundle', '7.2', 'This method is deprecated and will be removed in 8.0.'); + + $routeParameters = $this->getSlugRouteParameters(); + $this->addMultiLangRoute('_slug', $routeParameters); + } + + /** + * @param string $name + */ + protected function addMultiLangRoute($name, array $parameters = []) + { + trigger_deprecation('kunstmaan/multidomain-bundle', '7.2', 'This method is deprecated and will be removed in 8.0.'); + + $this->routeCollectionMultiLanguage->add( + $name, + new Route( + $parameters['path'], + $parameters['defaults'], + $parameters['requirements'] + ) + ); + } + /** * Return slug route parameters * diff --git a/src/Kunstmaan/MultiDomainBundle/Tests/Router/DomainBasedLocaleRouterTest.php b/src/Kunstmaan/MultiDomainBundle/Tests/Router/DomainBasedLocaleRouterTest.php index 7d7f372538..b3993020e2 100644 --- a/src/Kunstmaan/MultiDomainBundle/Tests/Router/DomainBasedLocaleRouterTest.php +++ b/src/Kunstmaan/MultiDomainBundle/Tests/Router/DomainBasedLocaleRouterTest.php @@ -97,6 +97,7 @@ public function testAddMultiLangSlugRoute() $request = $this->getRequest('http://singlelangdomain.tld/'); $object = new DomainBasedLocaleRouter($domainConfiguration, $this->getRequestStack($request), $this->getEntityManager(new NodeTranslation()), 'admin'); + $object->enabledImprovedRouter(true); $mirror = new \ReflectionClass(DomainBasedLocaleRouter::class); $property = $mirror->getProperty('otherSite'); @@ -140,6 +141,7 @@ public function testGetRouteCollection() /** @var Container $container */ $object = new DomainBasedLocaleRouter($domainConfiguration, $this->getRequestStack($request), $this->getEntityManager(new NodeTranslation()), 'admin'); + $object->enabledImprovedRouter(true); $mirror = new \ReflectionClass(DomainBasedLocaleRouter::class); $property = $mirror->getProperty('otherSite'); $property->setAccessible(true); @@ -216,6 +218,9 @@ private function getNodeTranslationRepository($nodeTranslation = null) private function getDomainBasedLocaleRouter($request, $nodeTranslation = null) { - return new DomainBasedLocaleRouter($this->getDomainConfiguration(), $this->getRequestStack($request), $this->getEntityManager($nodeTranslation), 'admin'); + $router = new DomainBasedLocaleRouter($this->getDomainConfiguration(), $this->getRequestStack($request), $this->getEntityManager($nodeTranslation), 'admin'); + $router->enabledImprovedRouter(true); + + return $router; } } diff --git a/src/Kunstmaan/NodeBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/NodeBundle/DependencyInjection/Configuration.php index d75987b283..f68289c1e1 100644 --- a/src/Kunstmaan/NodeBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/NodeBundle/DependencyInjection/Configuration.php @@ -57,6 +57,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->booleanNode('enabled')->defaultFalse()->end() ->end() ->end() + ->booleanNode('enable_improved_router')->defaultFalse()->end() ->end(); return $treeBuilder; diff --git a/src/Kunstmaan/NodeBundle/DependencyInjection/KunstmaanNodeExtension.php b/src/Kunstmaan/NodeBundle/DependencyInjection/KunstmaanNodeExtension.php index 3fcf64c64d..20fa7b0bd1 100644 --- a/src/Kunstmaan/NodeBundle/DependencyInjection/KunstmaanNodeExtension.php +++ b/src/Kunstmaan/NodeBundle/DependencyInjection/KunstmaanNodeExtension.php @@ -42,6 +42,13 @@ public function load(array $configs, ContainerBuilder $container): void $loader->load('services.yml'); $loader->load('commands.yml'); + + $enableImprovedRouter = $config['enable_improved_router'] ?? false; + if (!$enableImprovedRouter) { + trigger_deprecation('kunstmaan/node-bundle', '7.2', 'Not setting the "kunstmaan_node.enable_improved_router" config to true is deprecated, it will always be true in 8.0.'); + } + $slugRouter = $container->findDefinition('kunstmaan_node.slugrouter'); + $slugRouter->addMethodCall('enabledImprovedRouter', [$enableImprovedRouter]); } public function prepend(ContainerBuilder $container): void diff --git a/src/Kunstmaan/NodeBundle/Router/SlugRouter.php b/src/Kunstmaan/NodeBundle/Router/SlugRouter.php index 30568bab08..b7e7b943b2 100644 --- a/src/Kunstmaan/NodeBundle/Router/SlugRouter.php +++ b/src/Kunstmaan/NodeBundle/Router/SlugRouter.php @@ -52,6 +52,13 @@ class SlugRouter implements RouterInterface /** @var string */ protected $slugPattern; + /** + * NEXT_MAJOR: Remove property + * + * @internal + */ + protected bool $enabledImprovedRouter = false; + public function __construct( DomainConfigurationInterface $domainConfiguration, RequestStack $requestStack, @@ -341,4 +348,14 @@ protected function getEscapedLocales($locales) return implode('|', $escapedLocales); } + + /** + * NEXT_MAJOR: Remove method + * + * @interal + */ + public function enabledImprovedRouter(bool $enabled): void + { + $this->enabledImprovedRouter = $enabled; + } } diff --git a/src/Kunstmaan/NodeBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Kunstmaan/NodeBundle/Tests/DependencyInjection/ConfigurationTest.php index 6adef0d66f..997ab156b7 100644 --- a/src/Kunstmaan/NodeBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Kunstmaan/NodeBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -30,6 +30,7 @@ public function testConfigGeneratesAsExpected() 'threshold' => 35, ], 'enable_permissions' => true, + 'enable_improved_router' => false, ]; $this->assertProcessedConfigurationEquals([$array], $array); diff --git a/src/Kunstmaan/NodeBundle/Tests/DependencyInjection/KunstmaanNodeExtensionTest.php b/src/Kunstmaan/NodeBundle/Tests/DependencyInjection/KunstmaanNodeExtensionTest.php index 761a6afe1d..1d22ac9271 100644 --- a/src/Kunstmaan/NodeBundle/Tests/DependencyInjection/KunstmaanNodeExtensionTest.php +++ b/src/Kunstmaan/NodeBundle/Tests/DependencyInjection/KunstmaanNodeExtensionTest.php @@ -4,10 +4,13 @@ use Kunstmaan\NodeBundle\DependencyInjection\KunstmaanNodeExtension; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; +use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; class KunstmaanNodeExtensionTest extends AbstractExtensionTestCase { + use ExpectDeprecationTrait; + /** * @return ExtensionInterface[] */ @@ -19,7 +22,7 @@ protected function getContainerExtensions(): array public function testCorrectParametersHaveBeenSet() { $this->container->setParameter('twig.form.resources', []); - $this->load(); + $this->load(['enable_improved_router' => true]); $this->assertContainerBuilderHasParameter('twig.form.resources'); $this->assertContainerBuilderHasParameter('kunstmaan_node.show_add_homepage', true); @@ -30,4 +33,14 @@ public function testCorrectParametersHaveBeenSet() $this->assertContainerBuilderHasParameter('kunstmaan_node.version_timeout', 3600); $this->assertContainerBuilderHasParameter('kunstmaan_node.url_chooser.lazy_increment', 2); } + + /** + * @group legacy + */ + public function testImprovedRouterConfigDeprecation() + { + $this->expectDeprecation('Since kunstmaan/node-bundle 7.2: Not setting the "kunstmaan_node.enable_improved_router" config to true is deprecated, it will always be true in 8.0.'); + $this->container->setParameter('twig.form.resources', []); + $this->load(); + } } From 1644c131a88acd42ae4354d260c616073d2b7236 Mon Sep 17 00:00:00 2001 From: Danny v W Date: Sun, 10 Nov 2024 17:51:19 +0100 Subject: [PATCH 6/6] Update DomainBasedLocaleRouter.php --- .../MultiDomainBundle/Router/DomainBasedLocaleRouter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php index 5513d49586..de2e70cdae 100644 --- a/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php +++ b/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php @@ -157,7 +157,7 @@ private function getReverseLocaleMap(): array public function getRouteCollection(): RouteCollection { if (!$this->enabledImprovedRouter) { - trigger_deprecation('kunstmaan/multidomain-bundle', '7.2', 'Not enabling the improved router is deprecated and the changed and improved router will be the default in 8.0. Set the "kunstmaan_multi_domain.enable_improved_domain_based_local_router" config to true.'); + trigger_deprecation('kunstmaan/multidomain-bundle', '7.2', 'Not enabling the improved router is deprecated and the changed and improved router will be the default in 8.0. Set the "kunstmaan_node.enable_improved_router" config to true.'); if (($this->otherSite && $this->isMultiLanguage($this->otherSite['host'])) || (!$this->otherSite && $this->isMultiLanguage())) { if (!$this->routeCollectionMultiLanguage) {