19
19
20
20
use ApacheSolrForTypo3 \Solr \Domain \Index \Queue \RecordMonitor \Helper \RootPageResolver ;
21
21
use ApacheSolrForTypo3 \Solr \Domain \Site \Exception \UnexpectedTYPO3SiteInitializationException ;
22
+ use ApacheSolrForTypo3 \Solr \Event \Site \AfterDomainHasBeenDeterminedForSiteEvent ;
22
23
use ApacheSolrForTypo3 \Solr \Exception \InvalidArgumentException ;
23
24
use ApacheSolrForTypo3 \Solr \FrontendEnvironment ;
24
25
use ApacheSolrForTypo3 \Solr \System \Cache \TwoLevelCache ;
27
28
use ApacheSolrForTypo3 \Solr \System \Util \SiteUtility ;
28
29
use Doctrine \DBAL \Exception as DBALException ;
29
30
use Generator ;
31
+ use Psr \EventDispatcher \EventDispatcherInterface ;
30
32
use Throwable ;
31
33
use TYPO3 \CMS \Backend \Utility \BackendUtility ;
32
34
use TYPO3 \CMS \Core \Exception \SiteNotFoundException ;
@@ -49,18 +51,22 @@ class SiteRepository
49
51
50
52
protected FrontendEnvironment $ frontendEnvironment ;
51
53
54
+ protected EventDispatcherInterface $ eventDispatcher ;
55
+
52
56
public function __construct (
53
57
?RootPageResolver $ rootPageResolver = null ,
54
58
?TwoLevelCache $ twoLevelCache = null ,
55
59
?SiteFinder $ siteFinder = null ,
56
60
?ExtensionConfiguration $ extensionConfiguration = null ,
57
61
?FrontendEnvironment $ frontendEnvironment = null ,
62
+ ?EventDispatcherInterface $ eventDispatcherInterface = null
58
63
) {
59
64
$ this ->rootPageResolver = $ rootPageResolver ?? GeneralUtility::makeInstance (RootPageResolver::class);
60
65
$ this ->runtimeCache = $ twoLevelCache ?? GeneralUtility::makeInstance (TwoLevelCache::class, 'runtime ' );
61
66
$ this ->siteFinder = $ siteFinder ?? GeneralUtility::makeInstance (SiteFinder::class);
62
67
$ this ->extensionConfiguration = $ extensionConfiguration ?? GeneralUtility::makeInstance (ExtensionConfiguration::class);
63
68
$ this ->frontendEnvironment = $ frontendEnvironment ?? GeneralUtility::makeInstance (FrontendEnvironment::class);
69
+ $ this ->eventDispatcher = $ eventDispatcherInterface ?? GeneralUtility::makeInstance (EventDispatcherInterface::class);
64
70
}
65
71
66
72
/**
@@ -291,6 +297,10 @@ protected function buildTypo3ManagedSite(array $rootPageRecord): ?Site
291
297
}
292
298
293
299
$ domain = $ typo3Site ->getBase ()->getHost ();
300
+ $ event = $ this ->eventDispatcher ->dispatch (
301
+ new AfterDomainHasBeenDeterminedForSiteEvent ($ domain , $ rootPageRecord , $ typo3Site , $ this ->extensionConfiguration )
302
+ );
303
+ $ domain = $ event ->getDomain ();
294
304
295
305
$ siteHash = $ this ->getSiteHashForDomain ($ domain );
296
306
$ defaultLanguage = $ typo3Site ->getDefaultLanguage ()->getLanguageId ();
0 commit comments