first commit
This commit is contained in:
@@ -152,7 +152,7 @@ class SiteRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all available TYPO3 sites with Solr configured.
|
||||
* Gets all available TYPO3 sites with Meilisearch configured.
|
||||
*
|
||||
* @param bool $stopOnInvalidSite
|
||||
* @throws \Exception
|
||||
@@ -180,18 +180,18 @@ class SiteRepository
|
||||
*/
|
||||
protected function getAvailableTYPO3ManagedSites(bool $stopOnInvalidSite): array
|
||||
{
|
||||
$typo3ManagedSolrSites = [];
|
||||
$typo3ManagedMeilisearchSites = [];
|
||||
$typo3Sites = $this->siteFinder->getAllSites();
|
||||
foreach ($typo3Sites as $typo3Site) {
|
||||
try {
|
||||
$rootPageId = $typo3Site->getRootPageId();
|
||||
if (isset($typo3ManagedSolrSites[$rootPageId])) {
|
||||
if (isset($typo3ManagedMeilisearchSites[$rootPageId])) {
|
||||
//get each site only once
|
||||
continue;
|
||||
}
|
||||
$typo3ManagedSolrSite = $this->buildSite($rootPageId);
|
||||
if ($typo3ManagedSolrSite->isEnabled()) {
|
||||
$typo3ManagedSolrSites[$rootPageId] = $typo3ManagedSolrSite;
|
||||
$typo3ManagedMeilisearchSite = $this->buildSite($rootPageId);
|
||||
if ($typo3ManagedMeilisearchSite->isEnabled()) {
|
||||
$typo3ManagedMeilisearchSites[$rootPageId] = $typo3ManagedMeilisearchSite;
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
@@ -200,7 +200,7 @@ class SiteRepository
|
||||
}
|
||||
}
|
||||
}
|
||||
return $typo3ManagedSolrSites;
|
||||
return $typo3ManagedMeilisearchSites;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +262,7 @@ class SiteRepository
|
||||
*/
|
||||
protected function buildTypo3ManagedSite(array $rootPageRecord): ?Typo3ManagedSite
|
||||
{
|
||||
$solrConfiguration = $this->frontendEnvironment->getSolrConfigurationFromPageId($rootPageRecord['uid']);
|
||||
$meilisearchConfiguration = $this->frontendEnvironment->getMeilisearchConfigurationFromPageId($rootPageRecord['uid']);
|
||||
/** @var \TYPO3\CMS\Core\Site\Entity\Site $typo3Site */
|
||||
try {
|
||||
$typo3Site = $this->siteFinder->getSiteByPageId($rootPageRecord['uid']);
|
||||
@@ -278,36 +278,26 @@ class SiteRepository
|
||||
return $language->getLanguageId();
|
||||
}, $typo3Site->getLanguages());
|
||||
|
||||
$solrConnectionConfigurations = [];
|
||||
$meilisearchConnectionConfigurations = [];
|
||||
|
||||
foreach ($availableLanguageIds as $languageUid) {
|
||||
$solrEnabled = SiteUtility::getConnectionProperty($typo3Site, 'enabled', $languageUid, 'read', true);
|
||||
if ($solrEnabled) {
|
||||
$solrConnectionConfigurations[$languageUid] = [
|
||||
$meilisearchEnabled = SiteUtility::getConnectionProperty($typo3Site, 'enabled', $languageUid, 'read', true);
|
||||
if ($meilisearchEnabled) {
|
||||
$meilisearchConnectionConfigurations[$languageUid] = [
|
||||
'connectionKey' => $rootPageRecord['uid'] . '|' . $languageUid,
|
||||
'rootPageTitle' => $rootPageRecord['title'],
|
||||
'rootPageUid' => $rootPageRecord['uid'],
|
||||
'read' => [
|
||||
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'read', 'http'),
|
||||
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'read', 'localhost'),
|
||||
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'read', 8983),
|
||||
// @todo: transform core to path
|
||||
'path' =>
|
||||
SiteUtility::getConnectionProperty($typo3Site, 'path', $languageUid, 'read', '/solr/') .
|
||||
SiteUtility::getConnectionProperty($typo3Site, 'core', $languageUid, 'read', 'core_en') . '/' ,
|
||||
'username' => SiteUtility::getConnectionProperty($typo3Site, 'username', $languageUid, 'read', ''),
|
||||
'password' => SiteUtility::getConnectionProperty($typo3Site, 'password', $languageUid, 'read', '')
|
||||
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'read', 7700),
|
||||
'apiKey' => SiteUtility::getConnectionProperty($typo3Site, 'apiKey', $languageUid, 'read', ''),
|
||||
],
|
||||
'write' => [
|
||||
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'write', 'http'),
|
||||
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'write', 'localhost'),
|
||||
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'write', 8983),
|
||||
// @todo: transform core to path
|
||||
'path' =>
|
||||
SiteUtility::getConnectionProperty($typo3Site, 'path', $languageUid, 'read', '/solr/') .
|
||||
SiteUtility::getConnectionProperty($typo3Site, 'core', $languageUid, 'read', 'core_en') . '/' ,
|
||||
'username' => SiteUtility::getConnectionProperty($typo3Site, 'username', $languageUid, 'write', ''),
|
||||
'password' => SiteUtility::getConnectionProperty($typo3Site, 'password', $languageUid, 'write', '')
|
||||
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'write', 7700),
|
||||
'apiKey' => SiteUtility::getConnectionProperty($typo3Site, 'apiKey', $languageUid, 'write', ''),
|
||||
],
|
||||
|
||||
'language' => $languageUid
|
||||
@@ -318,7 +308,7 @@ class SiteRepository
|
||||
return GeneralUtility::makeInstance(
|
||||
Typo3ManagedSite::class,
|
||||
/** @scrutinizer ignore-type */
|
||||
$solrConfiguration,
|
||||
$meilisearchConfiguration,
|
||||
/** @scrutinizer ignore-type */
|
||||
$rootPageRecord,
|
||||
/** @scrutinizer ignore-type */
|
||||
@@ -332,7 +322,7 @@ class SiteRepository
|
||||
/** @scrutinizer ignore-type */
|
||||
$availableLanguageIds,
|
||||
/** @scrutinizer ignore-type */
|
||||
$solrConnectionConfigurations,
|
||||
$meilisearchConnectionConfigurations,
|
||||
/** @scrutinizer ignore-type */
|
||||
$typo3Site
|
||||
);
|
||||
|
Reference in New Issue
Block a user