[TASK] Streamline formatting of html templates
[Packages/TYPO3.CMS.git] / typo3 / sysext / indexed_search / ext_localconf.php
1 <?php
2 defined('TYPO3_MODE') or die();
3
4 // register extbase plugin
5 \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
6 'IndexedSearch',
7 'Pi2',
8 [\TYPO3\CMS\IndexedSearch\Controller\SearchController::class => 'form,search,noTypoScript'],
9 [\TYPO3\CMS\IndexedSearch\Controller\SearchController::class => 'form,search']
10 );
11
12 // Attach to hooks:
13 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'][] = \TYPO3\CMS\IndexedSearch\Indexer::class;
14 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['headerNoCache']['tx_indexedsearch'] = \TYPO3\CMS\IndexedSearch\Hook\TypoScriptFrontendHook::class . '->headerNoCache';
15 // Register with "crawler" extension:
16 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['procInstructions']['tx_indexedsearch_reindex'] = 'Re-indexing';
17 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['cli_hooks']['tx_indexedsearch_crawl'] = \TYPO3\CMS\IndexedSearch\Hook\CrawlerHook::class;
18 // Register with DataHandler:
19 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['tx_indexedsearch'] = \TYPO3\CMS\IndexedSearch\Hook\CrawlerHook::class;
20 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['tx_indexedsearch'] = \TYPO3\CMS\IndexedSearch\Hook\CrawlerHook::class;
21 // Configure default document parsers:
22 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['external_parsers'] = [
23 'pdf' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
24 'doc' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
25 'docx' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
26 'dotx' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
27 'pps' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
28 'ppsx' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
29 'ppt' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
30 'pptx' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
31 'potx' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
32 'xls' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
33 'xlsx' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
34 'xltx' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
35 'sxc' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
36 'sxi' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
37 'sxw' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
38 'ods' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
39 'odp' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
40 'odt' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
41 'rtf' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
42 'txt' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
43 'html' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
44 'htm' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
45 'csv' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
46 'xml' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
47 'jpg' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
48 'jpeg' => \TYPO3\CMS\IndexedSearch\FileContentParser::class,
49 'tif' => \TYPO3\CMS\IndexedSearch\FileContentParser::class
50 ];
51
52 $extConf = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
53 \TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class
54 )->get('indexed_search');
55
56 if (isset($extConf['useMysqlFulltext']) && (bool)$extConf['useMysqlFulltext']) {
57 // Use all index_* tables except "index_rel" and "index_words"
58 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['use_tables'] =
59 'index_phash,index_fulltext,index_section,index_grlist,index_stat_search,index_stat_word,index_debug,index_config';
60 // Register schema analyzer slot to hook in required fulltext index definition
61 $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
62 $signalSlotDispatcher->connect(
63 'TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService',
64 'tablesDefinitionIsBeingBuilt',
65 \TYPO3\CMS\IndexedSearch\Service\DatabaseSchemaService::class,
66 'addMysqlFulltextIndex'
67 );
68 unset($signalSlotDispatcher);
69 } else {
70 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['use_tables'] =
71 'index_phash,index_fulltext,index_rel,index_words,index_section,index_grlist,index_stat_search,index_stat_word,index_debug,index_config';
72 }
73
74 // Add search to new content element wizard
75 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
76 mod.wizards.newContentElement.wizardItems.forms {
77 elements.search {
78 iconIdentifier = content-elements-searchform
79 title = LLL:EXT:indexed_search/Resources/Private/Language/locallang_pi.xlf:pi_wizard_title
80 description = LLL:EXT:indexed_search/Resources/Private/Language/locallang_pi.xlf:pi_wizard_description
81 tt_content_defValues {
82 CType = list
83 list_type = indexedsearch_pi2
84 }
85 }
86 show :=addToList(search)
87 }
88 ');
89
90 // Use the advanced doubleMetaphone parser instead of the internal one (usage of metaphone parsers is generally disabled by default)
91 if (isset($extConf['enableMetaphoneSearch']) && (int)$extConf['enableMetaphoneSearch'] == 2) {
92 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['metaphone'] = \TYPO3\CMS\IndexedSearch\Utility\DoubleMetaPhoneUtility::class;
93 }
94 unset($extConf);
95
96 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables'])) {
97 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['index_stat_search'] = [
98 'dateField' => 'tstamp',
99 'expirePeriod' => 90
100 ];
101 }
102
103 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\IpAnonymizationTask::class]['options']['tables'])) {
104 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\IpAnonymizationTask::class]['options']['tables']['index_stat_search'] = [
105 'dateField' => 'tstamp',
106 'ipField' => 'IP'
107 ];
108 }