forked from TYPO3-Solr/ext-solr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ext_tables.php
150 lines (134 loc) · 7.57 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
<?php
defined('TYPO3_MODE') || 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(
'ApacheSolrForTypo3.solr',
'searchbackend',
'Info',
'',
[
'Backend\\Search\\InfoModule' => '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(
'ApacheSolrForTypo3.solr',
'searchbackend',
'CoreOptimization',
'',
[
'Backend\\Search\\CoreOptimizationModule' => '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(
'ApacheSolrForTypo3.solr',
'searchbackend',
'IndexQueue',
'',
[
'Backend\\Search\\IndexQueueModule' => 'index, initializeIndexQueue, 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(
'ApacheSolrForTypo3.solr',
'searchbackend',
'IndexAdministration',
'',
[
'Backend\\Search\\IndexAdministrationModule' => '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
];
}
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';
}