forked from TYPO3-Solr/ext-solr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ext_tables.php
175 lines (159 loc) · 8.16 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
<?php
defined('TYPO3') || die();
(function () {
if (TYPO3_MODE == 'BE') {
$modulePrefix = 'extensions-solr-module';
$svgProvider = \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class;
/* @var \ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration $extensionConfiguration */
$extensionConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration::class
);
// register all module icons with extensions-solr-module-modulename
$extIconPath = 'EXT:solr/Resources/Public/Images/Icons/';
/* @var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$iconRegistry->registerIcon(
$modulePrefix . '-main',
$svgProvider,
['source' => $extIconPath . 'ModuleSolrMain.svg']
);
$iconRegistry->registerIcon(
$modulePrefix . '-solr-core-optimization',
$svgProvider,
['source' => $extIconPath . 'ModuleCoreOptimization.svg']
);
$iconRegistry->registerIcon(
$modulePrefix . '-index-administration',
$svgProvider,
['source' => $extIconPath . 'ModuleIndexAdministration.svg']
);
// all connections
$iconRegistry->registerIcon(
$modulePrefix . '-initsolrconnections',
$svgProvider,
['source' => $extIconPath . 'InitSolrConnections.svg']
);
// single connection - context menu
$iconRegistry->registerIcon(
$modulePrefix . '-initsolrconnection',
$svgProvider,
['source' => $extIconPath . 'InitSolrConnection.svg']
);
// register plugin icon
$iconRegistry->registerIcon(
'extensions-solr-plugin-contentelement',
$svgProvider,
['source' => $extIconPath . 'ContentElement.svg']
);
// Add Main module "APACHE SOLR".
// Acces to a main module is implicit, as soon as a user has access to at least one of its submodules. To make it possible, main module must be registered in that way and without any Actions!
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
'searchbackend',
'',
'',
null,
[
'name' => 'searchbackend',
'labels' => 'LLL:EXT:solr/Resources/Private/Language/locallang_mod.xlf',
'iconIdentifier' => 'extensions-solr-module-main',
]
);
$treeComponentId = 'TYPO3/CMS/Backend/PageTree/PageTreeElement';
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'Solr',
'searchbackend',
'Info',
'',
[
\ApacheSolrForTypo3\Solr\Controller\Backend\Search\InfoModuleController::class => 'index, switchSite, switchCore, documentsDetails',
],
[
'access' => 'user,group',
'icon' => 'EXT:solr/Resources/Public/Images/Icons/ModuleInfo.svg',
'labels' => 'LLL:EXT:solr/Resources/Private/Language/locallang_mod_info.xlf',
'navigationComponentId' => $treeComponentId,
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'Solr',
'searchbackend',
'CoreOptimization',
'',
[
\ApacheSolrForTypo3\Solr\Controller\Backend\Search\CoreOptimizationModuleController::class => 'index, addSynonyms, importSynonymList, deleteAllSynonyms, exportSynonyms, deleteSynonyms, saveStopWords, importStopWordList, exportStopWords, switchSite, switchCore',
],
[
'access' => 'user,group',
'icon' => 'EXT:solr/Resources/Public/Images/Icons/ModuleCoreOptimization.svg',
'labels' => 'LLL:EXT:solr/Resources/Private/Language/locallang_mod_coreoptimize.xlf',
'navigationComponentId' => $treeComponentId,
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'Solr',
'searchbackend',
'IndexQueue',
'',
[
\ApacheSolrForTypo3\Solr\Controller\Backend\Search\IndexQueueModuleController::class =>
'index, initializeIndexQueue, clearIndexQueue, requeueDocument, resetLogErrors, showError, doIndexingRun, switchSite',
],
[
'access' => 'user,group',
'icon' => 'EXT:solr/Resources/Public/Images/Icons/ModuleIndexQueue.svg',
'labels' => 'LLL:EXT:solr/Resources/Private/Language/locallang_mod_indexqueue.xlf',
'navigationComponentId' => $treeComponentId,
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'Solr',
'searchbackend',
'IndexAdministration',
'',
[
\ApacheSolrForTypo3\Solr\Controller\Backend\Search\IndexAdministrationModuleController::class =>
'index, emptyIndex, clearIndexQueue, reloadIndexConfiguration, switchSite',
],
[
'access' => 'user,group',
'icon' => 'EXT:solr/Resources/Public/Images/Icons/ModuleIndexAdministration.svg',
'labels' => 'LLL:EXT:solr/Resources/Private/Language/locallang_mod_indexadmin.xlf',
'navigationComponentId' => $treeComponentId,
]
);
// registering reports
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['solr'] = [
\ApacheSolrForTypo3\Solr\Report\SiteHandlingStatus::class,
\ApacheSolrForTypo3\Solr\Report\SchemaStatus::class,
\ApacheSolrForTypo3\Solr\Report\SolrConfigStatus::class,
\ApacheSolrForTypo3\Solr\Report\SolrConfigurationStatus::class,
\ApacheSolrForTypo3\Solr\Report\SolrStatus::class,
\ApacheSolrForTypo3\Solr\Report\SolrVersionStatus::class,
\ApacheSolrForTypo3\Solr\Report\AccessFilterPluginInstalledStatus::class,
\ApacheSolrForTypo3\Solr\Report\AllowUrlFOpenStatus::class,
\ApacheSolrForTypo3\Solr\Report\FilterVarStatus::class,
];
// Register Context Sensitive Help (CSH) translation labels
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
'pages',
'EXT:solr/Resources/Private/Language/locallang_csh_pages.xlf'
);
}
if ((TYPO3_MODE === 'BE') || (TYPO3_MODE === 'FE' && isset($_POST['TSFE_EDIT']))) {
// 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::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \ApacheSolrForTypo3\Solr\GarbageCollector::class;
// 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::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \ApacheSolrForTypo3\Solr\IndexQueue\RecordMonitor::class;
}
})();
// ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
$isComposerMode = defined('TYPO3_COMPOSER_MODE') && TYPO3_COMPOSER_MODE;
if (!$isComposerMode) {
// we load the autoloader for our libraries
$dir = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('solr');
require $dir . '/Resources/Private/Php/ComposerLibraries/vendor/autoload.php';
}