TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
indexed_search/ext_localconf.php
Go to the documentation of this file.
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 // unserializing the configuration so we can use it here:
48 $extConf = [];
49 if (isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search'])) {
50  $extConf = unserialize(
51  $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search'],
52  ['allowed_classes' => false]
53  );
54 }
55 
56 if (isset($extConf['useMysqlFulltext']) && $extConf['useMysqlFulltext'] === '1') {
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::class,
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 if (TYPO3_MODE === 'BE') {
77  mod.wizards.newContentElement.wizardItems.forms {
78  elements.search {
79  iconIdentifier = content-elements-searchform
80  title = LLL:EXT:indexed_search/Resources/Private/Language/locallang_pi.xlf:pi_wizard_title
81  description = LLL:EXT:indexed_search/Resources/Private/Language/locallang_pi.xlf:pi_wizard_description
82  tt_content_defValues {
83  CType = list
84  list_type = indexedsearch_pi2
85  }
86  }
87  show :=addToList(search)
88  }
89  ');
90 }
91 
92 // Use the advanced doubleMetaphone parser instead of the internal one (usage of metaphone parsers is generally disabled by default)
93 if (isset($extConf['enableMetaphoneSearch']) && (int)$extConf['enableMetaphoneSearch'] == 2) {
94  $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['metaphone'] = \TYPO3\CMS\IndexedSearch\Utility\DoubleMetaPhoneUtility::class;
95 }
96 unset($extConf);
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'][]
$signalSlotDispatcher
static makeInstance($className,...$constructorArguments)