Skip to content

Commit

Permalink
[TASK:T12] simplify FQDNs in ext_localconf.php
Browse files Browse the repository at this point in the history
  • Loading branch information
dkd-kaehm committed Jun 13, 2023
1 parent 93d7922 commit 8a15063
Showing 1 changed file with 63 additions and 47 deletions.
110 changes: 63 additions & 47 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
<?php

use ApacheSolrForTypo3\Solr\Controller\SearchController;
use ApacheSolrForTypo3\Solr\Controller\SuggestController;
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\Parser\GroupedResultParser;
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\Parser\ResultParserRegistry;
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\SearchResult;
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet;
use ApacheSolrForTypo3\Solr\Eid\ApiEid;
use ApacheSolrForTypo3\Solr\GarbageCollector;
use ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\AuthorizationService;
use ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\Manager;
use ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\PageIndexer;
use ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\UserGroupDetector;
use ApacheSolrForTypo3\Solr\IndexQueue\RecordMonitor;
use ApacheSolrForTypo3\Solr\Routing\Enhancer\SolrFacetMaskAndCombineEnhancer;
use ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration;
use ApacheSolrForTypo3\Solr\Task\EventQueueWorkerTask;
use ApacheSolrForTypo3\Solr\Task\EventQueueWorkerTaskAdditionalFieldProvider;
use ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask;
use ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTaskAdditionalFieldProvider;
use ApacheSolrForTypo3\Solr\Task\OptimizeIndexTask;
use ApacheSolrForTypo3\Solr\Task\OptimizeIndexTaskAdditionalFieldProvider;
use ApacheSolrForTypo3\Solr\Task\ReIndexTask;
use ApacheSolrForTypo3\Solr\Task\ReIndexTaskAdditionalFieldProvider;
use Psr\Log\LogLevel;
use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Log\Writer\FileWriter;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
use TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask;

defined('TYPO3') or die('Access denied.');

Expand All @@ -26,50 +51,44 @@

// ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// registering Index Queue page indexer helpers
\ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\Manager::registerFrontendHelper(
'findUserGroups',
\ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\UserGroupDetector::class
);
Manager::registerFrontendHelper('findUserGroups', UserGroupDetector::class);

\ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\Manager::registerFrontendHelper(
'indexPage',
\ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\PageIndexer::class
);
Manager::registerFrontendHelper('indexPage', PageIndexer::class);

// ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #

// adding scheduler tasks

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\ApacheSolrForTypo3\Solr\Task\OptimizeIndexTask::class] = [
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][OptimizeIndexTask::class] = [
'extension' => 'solr',
'title' => 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:optimizeindex_title',
'description' => 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:optimizeindex_description',
'additionalFields' => \ApacheSolrForTypo3\Solr\Task\OptimizeIndexTaskAdditionalFieldProvider::class,
'additionalFields' => OptimizeIndexTaskAdditionalFieldProvider::class,
];

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\ApacheSolrForTypo3\Solr\Task\ReIndexTask::class] = [
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][ReIndexTask::class] = [
'extension' => 'solr',
'title' => 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:reindex_title',
'description' => 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:reindex_description',
'additionalFields' => \ApacheSolrForTypo3\Solr\Task\ReIndexTaskAdditionalFieldProvider::class,
'additionalFields' => ReIndexTaskAdditionalFieldProvider::class,
];

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask::class] = [
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][IndexQueueWorkerTask::class] = [
'extension' => 'solr',
'title' => 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:indexqueueworker_title',
'description' => 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:indexqueueworker_description',
'additionalFields' => \ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTaskAdditionalFieldProvider::class,
'additionalFields' => IndexQueueWorkerTaskAdditionalFieldProvider::class,
];

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\ApacheSolrForTypo3\Solr\Task\EventQueueWorkerTask::class] = [
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][EventQueueWorkerTask::class] = [
'extension' => 'solr',
'title' => 'LLL:EXT:solr/Resources/Private/Language/locallang_be.xlf:task.eventQueueWorkerTask.title',
'description' => 'LLL:EXT:solr/Resources/Private/Language/locallang_be.xlf:task.eventQueueWorkerTask.description',
'additionalFields' => \ApacheSolrForTypo3\Solr\Task\EventQueueWorkerTaskAdditionalFieldProvider::class,
'additionalFields' => EventQueueWorkerTaskAdditionalFieldProvider::class,
];

if (!isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['tx_solr_statistics'])) {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['tx_solr_statistics'] = [
if (!isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][TableGarbageCollectionTask::class]['options']['tables']['tx_solr_statistics'])) {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][TableGarbageCollectionTask::class]['options']['tables']['tx_solr_statistics'] = [
'dateField' => 'tstamp',
'expirePeriod' => 180,
];
Expand All @@ -79,7 +98,7 @@

// registering the eID scripts
// TODO move to suggest form modifier
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_solr_api'] = \ApacheSolrForTypo3\Solr\Eid\ApiEid::class . '::main';
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_solr_api'] = ApiEid::class . '::main';

// ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #

Expand All @@ -94,11 +113,11 @@
}

if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr_configuration']['backend'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr_configuration']['backend'] = \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr_configuration']['backend'] = Typo3DatabaseBackend::class;
}

if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr_configuration']['options'])) {
// default life time one day
// default life-time is one day
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr_configuration']['options'] = ['defaultLifetime' => 60 * 60 * 24];
}

Expand All @@ -107,13 +126,11 @@
}

// ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
/** @var \ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration $extensionConfiguration */
$extensionConfiguration = GeneralUtility::makeInstance(
\ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration::class
);
/** @var ExtensionConfiguration $extensionConfiguration */
$extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class);

// cacheHash handling
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
ArrayUtility::mergeRecursiveWithOverrule(
$GLOBALS['TYPO3_CONF_VARS'],
[
'FE' => [
Expand All @@ -127,25 +144,25 @@
// ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #

if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultClassName '])) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultClassName '] = \ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\SearchResult::class;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultClassName '] = SearchResult::class;
}

if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultSetClassName '])) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultSetClassName '] = \ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet::class;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultSetClassName '] = SearchResultSet::class;
}

if (!isset($GLOBALS['TYPO3_CONF_VARS']['LOG']['ApacheSolrForTypo3']['Solr']['writerConfiguration'])) {
$context = \TYPO3\CMS\Core\Core\Environment::getContext();
$context = Environment::getContext();
if ($context->isProduction()) {
$logLevel = \TYPO3\CMS\Core\Log\LogLevel::ERROR;
$logLevel = LogLevel::ERROR;
} elseif ($context->isDevelopment()) {
$logLevel = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
$logLevel = LogLevel::DEBUG;
} else {
$logLevel = \TYPO3\CMS\Core\Log\LogLevel::INFO;
$logLevel = LogLevel::INFO;
}
$GLOBALS['TYPO3_CONF_VARS']['LOG']['ApacheSolrForTypo3']['Solr']['writerConfiguration'] = [
$logLevel => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
FileWriter::class => [
'logFileInfix' => 'solr',
],
],
Expand All @@ -154,44 +171,44 @@

// ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Solr',
'pi_results',
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'results,form,detail',
SearchController::class => 'results,form,detail',
],
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'results',
SearchController::class => 'results',
]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Solr',
'pi_search',
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'form',
SearchController::class => 'form',
]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Solr',
'pi_frequentlySearched',
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'frequentlySearched',
SearchController::class => 'frequentlySearched',
],
[
\ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'frequentlySearched',
SearchController::class => 'frequentlySearched',
]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Solr',
'pi_suggest',
[
\ApacheSolrForTypo3\Solr\Controller\SuggestController::class => 'suggest',
SuggestController::class => 'suggest',
],
[
\ApacheSolrForTypo3\Solr\Controller\SuggestController::class => 'suggest',
SuggestController::class => 'suggest',
]
);

Expand All @@ -201,8 +218,7 @@
/*
* Solr route enhancer configuration
*/
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['enhancers']['SolrFacetMaskAndCombineEnhancer'] =
\ApacheSolrForTypo3\Solr\Routing\Enhancer\SolrFacetMaskAndCombineEnhancer::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['enhancers']['SolrFacetMaskAndCombineEnhancer'] = SolrFacetMaskAndCombineEnhancer::class;

// add solr field to rootline fields
if ($GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] === '') {
Expand Down Expand Up @@ -245,6 +261,6 @@
$isComposerMode = defined('TYPO3_COMPOSER_MODE') && TYPO3_COMPOSER_MODE;
if (!$isComposerMode) {
// we load the autoloader for our libraries
$dir = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('solr');
$dir = ExtensionManagementUtility::extPath('solr');
require $dir . '/Resources/Private/Php/ComposerLibraries/vendor/autoload.php';
}

0 comments on commit 8a15063

Please sign in to comment.