This repository has been archived by the owner on May 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
ext_tables.php
246 lines (202 loc) · 9.82 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?php
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
}
// TODO change to a constant, so that it can't get manipulated
$GLOBALS['PATH_solr'] = t3lib_extMgm::extPath('solr');
$GLOBALS['PATHrel_solr'] = t3lib_extMgm::extRelPath('solr');
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
if (version_compare(TYPO3_version, '6.1.0', '<')) {
t3lib_div::loadTCA('tt_content');
}
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// adding the search plugin
t3lib_extMgm::addPlugin(
array(
'LLL:EXT:solr/locallang_db.xml:tt_content.list_type_pi_results',
$_EXTKEY . '_pi_results'
),
'list_type'
);
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pi_results'] = 'layout,select_key,pages,recursive';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY . '_pi_results'] = 'pi_flexform';
// add flexform to pi_results
t3lib_extMgm::addPiFlexFormValue($_EXTKEY . '_pi_results', 'FILE:EXT:solr/Configuration/FlexForms/Results.xml');
// add search plugin to content element wizard
if (TYPO3_MODE == 'BE') {
$TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']['Tx_Solr_Backend_ContentElementWizardIconProvider'] =
t3lib_extMgm::extPath($_EXTKEY) . 'Classes/Backend/ContentElementWizardIconProvider.php';
}
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// adding the Search Form plugin
t3lib_extMgm::addPlugin(
array(
'LLL:EXT:solr/locallang_db.xml:tt_content.list_type_pi_search',
$_EXTKEY . '_pi_search'
),
'list_type'
);
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pi_search'] = 'layout,select_key,pages,recursive';
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// adding the Frequent Searches plugin
t3lib_extMgm::addPlugin(
array(
'LLL:EXT:solr/locallang_db.xml:tt_content.list_type_pi_frequentsearches',
$_EXTKEY . '_pi_frequentsearches'
),
'list_type'
);
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pi_frequentsearches'] = 'layout,select_key,pages,recursive';
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// TypoScript
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Solr/', 'Apache Solr - Default Configuration');
// OpenSearch
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/OpenSearch/', 'Apache Solr - OpenSearch');
// Extension Pre-Configuration
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Examples/IndexQueueNews/', 'Apache Solr - Index Queue Configuration for news');
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Examples/IndexQueueTtNews/', 'Apache Solr - Index Queue Configuration for tt_news');
// Examples
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Examples/BoostQueries/', 'Apache Solr Example - Boost more recent results');
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Examples/EverythingOn/', 'Apache Solr Example - Everything On');
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Examples/FilterPages/', 'Apache Solr Example - Filter to only show page results');
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Examples/IntroPackageSearchBox/', 'Apache Solr Example - Replace Introduction Package search box');
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
if (TYPO3_MODE == 'BE') {
if (version_compare(TYPO3_version, '6.0.0', '>=')) {
\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:' . $_EXTKEY . '/Resources/Public/Images/Icons/ModuleAdministration.png',
'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/ModuleAdministration.xlf',
)
);
$iconPath = $GLOBALS['PATHrel_solr'] . 'Resources/Public/Images/Icons/';
\TYPO3\CMS\Backend\Sprite\SpriteManager::addSingleIcons(
array(
'ModuleOverview' => $iconPath . 'Search.png',
'ModuleIndexQueue' => $iconPath . 'IndexQueue.png',
'ModuleIndexMaintenance' => $iconPath . 'IndexMaintenance.png',
'ModuleIndexFields' => $iconPath . 'IndexFields.png',
'ModuleSynonyms' => $iconPath . 'Synonyms.png'
),
$_EXTKEY
);
ApacheSolrForTypo3\Solr\Backend\SolrModule\AdministrationModuleManager::registerModule(
'ApacheSolrForTypo3.' . $_EXTKEY,
'Overview',
array('index')
);
ApacheSolrForTypo3\Solr\Backend\SolrModule\AdministrationModuleManager::registerModule(
'ApacheSolrForTypo3.' . $_EXTKEY,
'IndexQueue',
array('index,initializeIndexQueue')
);
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,
'Synonyms',
array('index,addSynonyms,deleteSynonyms')
);
} else {
t3lib_extMgm::addModulePath('tools_txsolrMAdmin', t3lib_extMgm::extPath($_EXTKEY) . 'ModAdmin/');
t3lib_extMgm::addModule('tools', 'txsolrMAdmin', '', t3lib_extMgm::extPath($_EXTKEY) . 'ModAdmin/');
}
// registering reports
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['solr'] = array(
'Tx_Solr_Report_SchemaStatus',
'Tx_Solr_Report_SolrconfigStatus',
'Tx_Solr_Report_SolrConfigurationStatus',
'Tx_Solr_Report_SolrStatus',
'Tx_Solr_Report_SolrVersionStatus',
'Tx_Solr_Report_AccessFilterPluginInstalledStatus',
'Tx_Solr_Report_AllowUrlFOpenStatus',
'Tx_Solr_Report_FilterVarStatus'
);
if (t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) < 6000000) {
// registering the index report with the reports module
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_solr']['index'] = array(
'title' => 'LLL:EXT:solr/Resources/Private/Language/ModuleReports.xml:index_title',
'description' => 'LLL:EXT:solr/Resources/Private/Language/ModuleReports.xml:index_description',
'report' => 'Tx_Solr_Report_IndexReport',
'icon' => 'EXT:solr/Report/tx_solr_report.gif'
);
}
// Index Inspector
t3lib_extMgm::insertModuleFunction(
'web_info',
'Tx_Solr_ModIndex_IndexInspector',
$GLOBALS['PATH_solr'] . 'ModIndex/IndexInspector.php',
'LLL:EXT:solr/Resources/Private/Language/Backend.xml:module_indexinspector'
);
// register Clear Cache Menu hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions']['clearSolrConnectionCache'] = '&Tx_Solr_ConnectionManager';
// register Clear Cache Menu ajax call
$TYPO3_CONF_VARS['BE']['AJAX']['solr::clearSolrConnectionCache'] = 'Tx_Solr_ConnectionManager->updateConnections';
// 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'][] = 'Tx_Solr_IndexQueue_RecordMonitor';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'Tx_Solr_IndexQueue_RecordMonitor';
// 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'][] = '&Tx_Solr_GarbageCollector';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = '&Tx_Solr_GarbageCollector';
}
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// register click menu item to initialize the Solr connections for a single site
// visible for admin users only
t3lib_extMgm::addUserTSConfig('
[adminUser = 1]
options.contextMenu.table.pages.items.850 = ITEM
options.contextMenu.table.pages.items.850 {
name = Tx_Solr_initializeSolrConnections
label = Initialize Solr Connections
icon = ' . t3lib_div::locationHeaderUrl($GLOBALS['PATHrel_solr'] . 'Resources/Images/cache-init-solr-connections.png') . '
displayCondition = getRecord|is_siteroot = 1
callbackAction = initializeSolrConnections
}
options.contextMenu.table.pages.items.851 = DIVIDER
[global]
');
t3lib_extMgm::registerExtDirectComponent(
'TYPO3.Solr.ContextMenuActionController',
$GLOBALS['PATHrel_solr'] . 'Classes/ContextMenuActionController.php:Tx_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
t3lib_extMgm::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';
?>