forked from TYPO3-Solr/ext-solr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathext_tables.php
191 lines (161 loc) · 8.7 KB
/
ext_tables.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
// TODO change to a constant, so that it can't get manipulated
$GLOBALS['PATH_solr'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('solr');
$GLOBALS['PATHrel_solr'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('solr');
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// add search plugin to content element wizard
if (TYPO3_MODE == 'BE') {
$TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']['ApacheSolrForTypo3\\Solr\\Backend\\ContentElementWizardIconProvider'] =
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Classes/Backend/ContentElementWizardIconProvider.php';
}
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
$extIconPath = 'EXT:solr/Resources/Public/Images/Icons/';
if (TYPO3_MODE === 'BE') {
$modulePrefix = 'extensions-solr-module';
$bitmapProvider = 'TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider';
$svgProvider = 'TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider';
// register all module icons with extensions-solr-module-modulename
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Imaging\IconRegistry');
$iconRegistry->registerIcon($modulePrefix . '-administration', $svgProvider,
array('source' => $extIconPath . 'ModuleAdministration.svg'));
$iconRegistry->registerIcon($modulePrefix . '-overview', $bitmapProvider,
array('source' => $extIconPath . 'Search.png'));
$iconRegistry->registerIcon($modulePrefix . '-indexqueue', $bitmapProvider,
array('source' => $extIconPath . 'IndexQueue.png'));
$iconRegistry->registerIcon($modulePrefix . '-indexmaintenance', $bitmapProvider,
array('source' => $extIconPath . 'IndexMaintenance.png'));
$iconRegistry->registerIcon($modulePrefix . '-indexfields', $bitmapProvider,
array('source' => $extIconPath . 'IndexFields.png'));
$iconRegistry->registerIcon($modulePrefix . '-stopwords', $bitmapProvider,
array('source' => $extIconPath . 'StopWords.png'));
$iconRegistry->registerIcon($modulePrefix . '-synonyms', $bitmapProvider,
array('source' => $extIconPath . 'Synonyms.png'));
$iconRegistry->registerIcon($modulePrefix . '-initsolrconnections', $bitmapProvider,
array('source' => $extIconPath . 'InitSolrConnections.png'));
}
if (TYPO3_MODE == 'BE') {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'ApacheSolrForTypo3.' . $_EXTKEY,
'tools',
'administration',
'',
array(
// An array holding the controller-action-combinations that are accessible
'Administration' => 'index,setSite,setCore'
),
array(
'access' => 'admin',
'icon' => 'EXT:solr/Resources/Public/Images/Icons/ModuleAdministration.svg',
'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/ModuleAdministration/locallang.xlf',
)
);
ApacheSolrForTypo3\Solr\Backend\SolrModule\AdministrationModuleManager::registerModule(
'ApacheSolrForTypo3.' . $_EXTKEY,
'Overview',
array('index')
);
ApacheSolrForTypo3\Solr\Backend\SolrModule\AdministrationModuleManager::registerModule(
'ApacheSolrForTypo3.' . $_EXTKEY,
'IndexQueue',
array('index,initializeIndexQueue,resetLogErrors,clearIndexQueue')
);
ApacheSolrForTypo3\Solr\Backend\SolrModule\AdministrationModuleManager::registerModule(
'ApacheSolrForTypo3.' . $_EXTKEY,
'IndexMaintenance',
array('index,cleanUpIndex,emptyIndex,reloadIndexConfiguration')
);
ApacheSolrForTypo3\Solr\Backend\SolrModule\AdministrationModuleManager::registerModule(
'ApacheSolrForTypo3.' . $_EXTKEY,
'IndexFields',
array('index')
);
ApacheSolrForTypo3\Solr\Backend\SolrModule\AdministrationModuleManager::registerModule(
'ApacheSolrForTypo3.' . $_EXTKEY,
'StopWords',
array('index,saveStopWords')
);
ApacheSolrForTypo3\Solr\Backend\SolrModule\AdministrationModuleManager::registerModule(
'ApacheSolrForTypo3.' . $_EXTKEY,
'Synonyms',
array('index,addSynonyms,deleteSynonyms')
);
// registering reports
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['solr'] = array(
'ApacheSolrForTypo3\\Solr\\Report\\SchemaStatus',
'ApacheSolrForTypo3\\Solr\\Report\\SolrConfigStatus',
'ApacheSolrForTypo3\\Solr\\Report\\SolrConfigurationStatus',
'ApacheSolrForTypo3\\Solr\\Report\\SolrStatus',
'ApacheSolrForTypo3\\Solr\\Report\\SolrVersionStatus',
'ApacheSolrForTypo3\\Solr\\Report\\AccessFilterPluginInstalledStatus',
'ApacheSolrForTypo3\\Solr\\Report\\AllowUrlFOpenStatus',
'ApacheSolrForTypo3\\Solr\\Report\\FilterVarStatus'
);
// Index Inspector
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction(
'web_info',
'ApacheSolrForTypo3\\Solr\\Backend\\IndexInspector\\IndexInspector',
null,
'LLL:EXT:solr/Resources/Private/Language/Backend/locallang.xml:module_indexinspector'
);
// register Clear Cache Menu hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions']['clearSolrConnectionCache'] = \ApacheSolrForTypo3\Solr\ConnectionManager::class;
// register Clear Cache Menu ajax call
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerAjaxHandler(
'solr::clearSolrConnectionCache',
'ApacheSolrForTypo3\\Solr\\ConnectionManager->updateConnections'
);
// the order of registering the garbage collector and the record monitor is important!
// for certain scenarios items must be removed by GC first, and then be re-added to to Index Queue
// hooking into TCE Main to monitor record updates that may require deleting documents from the index
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = '&ApacheSolrForTypo3\\Solr\\GarbageCollector';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = '&ApacheSolrForTypo3\\Solr\\GarbageCollector';
// hooking into TCE Main to monitor record updates that may require reindexing by the index queue
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\RecordMonitor';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\RecordMonitor';
}
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// register click menu item to initialize the Solr connections for a single site
// visible for admin users only
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('
[adminUser = 1]
options.contextMenu.table.pages.items.850 = ITEM
options.contextMenu.table.pages.items.850 {
name = Tx_Solr_initializeSolrConnections
label = Initialize Solr Connections
iconName = extensions-solr-module-initsolrconnections
displayCondition = getRecord|is_siteroot = 1
callbackAction = initializeSolrConnections
}
options.contextMenu.table.pages.items.851 = DIVIDER
[global]
');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerExtDirectComponent(
'TYPO3.Solr.ContextMenuActionController',
'ApacheSolrForTypo3\Solr\ContextMenuActionController',
'web',
'admin'
);
// include JS in backend
$GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems']['Solr.ContextMenuInitializeSolrConnectionsAction'] = $GLOBALS['PATH_solr'] . 'Classes/BackendItem/ContextMenuActionJavascriptRegistration.php';
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// replace the built-in search content element
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
'*',
'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/Results.xml',
'search'
);
$TCA['tt_content']['types']['search']['showitem'] =
'--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.general;general,
--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.header;header,
--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.plugin,
pi_flexform;;;;1-1-1,
--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,
--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.visibility;visibility,
--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.access;access,
--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.appearance,
--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.frames;frames,
--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.behaviour,
--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.extended';