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