first commit
This commit is contained in:
@@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Access\Rootline;
|
||||
use WapplerSystems\Meilisearch\Access\RootlineElement;
|
||||
use WapplerSystems\Meilisearch\Domain\Index\PageIndexer\Helper\UriBuilder\AbstractUriStrategy;
|
||||
use WapplerSystems\Meilisearch\Domain\Index\PageIndexer\Helper\UriStrategyFactory;
|
||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
@@ -57,8 +57,8 @@ class PageIndexer extends Indexer
|
||||
return false;
|
||||
}
|
||||
|
||||
$solrConnections = $this->getSolrConnectionsByItem($item);
|
||||
foreach ($solrConnections as $systemLanguageUid => $solrConnection) {
|
||||
$meilisearchConnections = $this->getMeilisearchConnectionsByItem($item);
|
||||
foreach ($meilisearchConnections as $systemLanguageUid => $meilisearchConnection) {
|
||||
$contentAccessGroups = $this->getAccessGroupsFromContent($item, $systemLanguageUid);
|
||||
|
||||
if (empty($contentAccessGroups)) {
|
||||
@@ -100,44 +100,44 @@ class PageIndexer extends Indexer
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Solr connections applicable for a page.
|
||||
* Gets the Meilisearch connections applicable for a page.
|
||||
*
|
||||
* The connections include the default connection and connections to be used
|
||||
* for translations of a page.
|
||||
*
|
||||
* @param Item $item An index queue item
|
||||
* @return array An array of WapplerSystems\Meilisearch\System\Solr\SolrConnection connections, the array's keys are the sys_language_uid of the language of the connection
|
||||
* @return array An array of WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection connections, the array's keys are the sys_language_uid of the language of the connection
|
||||
*/
|
||||
protected function getSolrConnectionsByItem(Item $item)
|
||||
protected function getMeilisearchConnectionsByItem(Item $item)
|
||||
{
|
||||
$solrConnections = parent::getSolrConnectionsByItem($item);
|
||||
$meilisearchConnections = parent::getMeilisearchConnectionsByItem($item);
|
||||
|
||||
$page = $item->getRecord();
|
||||
// may use \TYPO3\CMS\Core\Utility\GeneralUtility::hideIfDefaultLanguage($page['l18n_cfg']) with TYPO3 4.6
|
||||
if ($page['l18n_cfg'] & 1) {
|
||||
// page is configured to hide the default translation -> remove Solr connection for default language
|
||||
unset($solrConnections[0]);
|
||||
// page is configured to hide the default translation -> remove Meilisearch connection for default language
|
||||
unset($meilisearchConnections[0]);
|
||||
}
|
||||
|
||||
if (GeneralUtility::hideIfNotTranslated($page['l18n_cfg'])) {
|
||||
$accessibleSolrConnections = [];
|
||||
if (isset($solrConnections[0])) {
|
||||
$accessibleSolrConnections[0] = $solrConnections[0];
|
||||
$accessibleMeilisearchConnections = [];
|
||||
if (isset($meilisearchConnections[0])) {
|
||||
$accessibleMeilisearchConnections[0] = $meilisearchConnections[0];
|
||||
}
|
||||
|
||||
$translationOverlays = $this->pagesRepository->findTranslationOverlaysByPageId((int)$page['uid']);
|
||||
|
||||
foreach ($translationOverlays as $overlay) {
|
||||
$languageId = $overlay['sys_language_uid'];
|
||||
if (array_key_exists($languageId, $solrConnections)) {
|
||||
$accessibleSolrConnections[$languageId] = $solrConnections[$languageId];
|
||||
if (array_key_exists($languageId, $meilisearchConnections)) {
|
||||
$accessibleMeilisearchConnections[$languageId] = $meilisearchConnections[$languageId];
|
||||
}
|
||||
}
|
||||
|
||||
$solrConnections = $accessibleSolrConnections;
|
||||
$meilisearchConnections = $accessibleMeilisearchConnections;
|
||||
}
|
||||
|
||||
return $solrConnections;
|
||||
return $meilisearchConnections;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +169,7 @@ class PageIndexer extends Indexer
|
||||
|
||||
if ($this->loggingEnabled) {
|
||||
$this->logger->log(
|
||||
SolrLogManager::INFO,
|
||||
MeilisearchLogManager::INFO,
|
||||
'Page Access Groups',
|
||||
[
|
||||
'item' => (array)$item,
|
||||
@@ -278,7 +278,7 @@ class PageIndexer extends Indexer
|
||||
#
|
||||
|
||||
/**
|
||||
* Creates a single Solr Document for a page in a specific language and for
|
||||
* Creates a single Meilisearch Document for a page in a specific language and for
|
||||
* a specific frontend user group.
|
||||
*
|
||||
* @param Item $item The index queue item representing the page.
|
||||
@@ -300,10 +300,10 @@ class PageIndexer extends Indexer
|
||||
$indexActionResult = $response->getActionResult('indexPage');
|
||||
|
||||
if ($this->loggingEnabled) {
|
||||
$logSeverity = SolrLogManager::INFO;
|
||||
$logSeverity = MeilisearchLogManager::INFO;
|
||||
$logStatus = 'Info';
|
||||
if ($indexActionResult['pageIndexed']) {
|
||||
$logSeverity = SolrLogManager::NOTICE;
|
||||
$logSeverity = MeilisearchLogManager::NOTICE;
|
||||
$logStatus = 'Success';
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user