2021-04-17 00:26:33 +02:00
< ? php
defined ( 'TYPO3_MODE' ) || die ();
( function () {
if ( TYPO3_MODE == 'BE' ) {
2021-04-17 21:20:54 +02:00
$modulePrefix = 'extensions-meilisearch-module' ;
2021-04-17 00:26:33 +02:00
$svgProvider = \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider :: class ;
/* @var \WapplerSystems\Meilisearch\System\Configuration\ExtensionConfiguration $extensionConfiguration */
$extensionConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility :: makeInstance (
\WapplerSystems\Meilisearch\System\Configuration\ExtensionConfiguration :: class
);
2021-04-17 21:20:54 +02:00
// register all module icons with extensions-meilisearch-module-modulename
2021-04-17 00:26:33 +02:00
$extIconPath = 'EXT:meilisearch/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 ,
2021-04-17 21:20:54 +02:00
[ 'source' => $extIconPath . 'ModuleMeilisearchMain.svg' ]);
$iconRegistry -> registerIcon ( $modulePrefix . '-meilisearch-core-optimization' , $svgProvider ,
2021-04-17 00:26:33 +02:00
[ 'source' => $extIconPath . 'ModuleCoreOptimization.svg' ]);
$iconRegistry -> registerIcon ( $modulePrefix . '-index-administration' , $svgProvider ,
[ 'source' => $extIconPath . 'ModuleIndexAdministration.svg' ]);
// all connections
2021-04-17 21:20:54 +02:00
$iconRegistry -> registerIcon ( $modulePrefix . '-initmeilisearchconnections' , $svgProvider ,
[ 'source' => $extIconPath . 'InitMeilisearchConnections.svg' ]);
2021-04-17 00:26:33 +02:00
// single connection - context menu
2021-04-17 21:20:54 +02:00
$iconRegistry -> registerIcon ( $modulePrefix . '-initmeilisearchconnection' , $svgProvider ,
[ 'source' => $extIconPath . 'InitMeilisearchConnection.svg' ]);
2021-04-17 00:26:33 +02:00
// register plugin icon
2021-04-17 21:20:54 +02:00
$iconRegistry -> registerIcon ( 'extensions-meilisearch-plugin-contentelement' , $svgProvider ,
2021-04-17 00:26:33 +02:00
[ '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:meilisearch/Resources/Private/Language/locallang_mod.xlf' ,
2021-04-17 21:20:54 +02:00
'iconIdentifier' => 'extensions-meilisearch-module-main'
2021-04-17 00:26:33 +02:00
]
);
$treeComponentId = 'TYPO3/CMS/Backend/PageTree/PageTreeElement' ;
\TYPO3\CMS\Extbase\Utility\ExtensionUtility :: registerModule (
2021-04-17 21:20:54 +02:00
'WapplerSystems.meilisearch' ,
2021-04-17 00:26:33 +02:00
'searchbackend' ,
'Info' ,
'' ,
[
'Backend\\Search\\InfoModule' => 'index, switchSite, switchCore, documentsDetails' ,
],
[
'access' => 'user,group' ,
'icon' => 'EXT:meilisearch/Resources/Public/Images/Icons/ModuleInfo.svg' ,
'labels' => 'LLL:EXT:meilisearch/Resources/Private/Language/locallang_mod_info.xlf' ,
'navigationComponentId' => $treeComponentId
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility :: registerModule (
2021-04-17 21:20:54 +02:00
'WapplerSystems.meilisearch' ,
2021-04-17 00:26:33 +02:00
'searchbackend' ,
'IndexQueue' ,
'' ,
[
'Backend\\Search\\IndexQueueModule' => 'index, initializeIndexQueue, requeueDocument, resetLogErrors, showError, doIndexingRun, switchSite'
],
[
'access' => 'user,group' ,
'icon' => 'EXT:meilisearch/Resources/Public/Images/Icons/ModuleIndexQueue.svg' ,
'labels' => 'LLL:EXT:meilisearch/Resources/Private/Language/locallang_mod_indexqueue.xlf' ,
'navigationComponentId' => $treeComponentId
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility :: registerModule (
2021-04-17 21:20:54 +02:00
'WapplerSystems.meilisearch' ,
2021-04-17 00:26:33 +02:00
'searchbackend' ,
'IndexAdministration' ,
'' ,
[
'Backend\\Search\\IndexAdministrationModule' => 'index, emptyIndex, clearIndexQueue, reloadIndexConfiguration, switchSite'
],
[
'access' => 'user,group' ,
'icon' => 'EXT:meilisearch/Resources/Public/Images/Icons/ModuleIndexAdministration.svg' ,
'labels' => 'LLL:EXT:meilisearch/Resources/Private/Language/locallang_mod_indexadmin.xlf' ,
'navigationComponentId' => $treeComponentId
]
);
// registering reports
2021-04-17 21:20:54 +02:00
$GLOBALS [ 'TYPO3_CONF_VARS' ][ 'SC_OPTIONS' ][ 'reports' ][ 'tx_reports' ][ 'status' ][ 'providers' ][ 'meilisearch' ] = [
2021-04-17 00:26:33 +02:00
\WapplerSystems\Meilisearch\Report\SiteHandlingStatus :: class ,
\WapplerSystems\Meilisearch\Report\SchemaStatus :: class ,
2021-04-17 21:20:54 +02:00
\WapplerSystems\Meilisearch\Report\MeilisearchConfigStatus :: class ,
\WapplerSystems\Meilisearch\Report\MeilisearchConfigurationStatus :: class ,
\WapplerSystems\Meilisearch\Report\MeilisearchStatus :: class ,
\WapplerSystems\Meilisearch\Report\MeilisearchVersionStatus :: class ,
2021-04-17 00:26:33 +02:00
\WapplerSystems\Meilisearch\Report\AccessFilterPluginInstalledStatus :: class ,
\WapplerSystems\Meilisearch\Report\AllowUrlFOpenStatus :: class ,
\WapplerSystems\Meilisearch\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' ][] = \WapplerSystems\Meilisearch\GarbageCollector :: class ;
$GLOBALS [ 'TYPO3_CONF_VARS' ][ 'SC_OPTIONS' ][ 't3lib/class.t3lib_tcemain.php' ][ 'processDatamapClass' ][] = \WapplerSystems\Meilisearch\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' ][] = \WapplerSystems\Meilisearch\IndexQueue\RecordMonitor :: class ;
$GLOBALS [ 'TYPO3_CONF_VARS' ][ 'SC_OPTIONS' ][ 't3lib/class.t3lib_tcemain.php' ][ 'processDatamapClass' ][] = \WapplerSystems\Meilisearch\IndexQueue\RecordMonitor :: class ;
}
})();
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
$isComposerMode = defined ( 'TYPO3_COMPOSER_MODE' ) && TYPO3_COMPOSER_MODE ;
if ( ! $isComposerMode ) {
// we load the autoloader for our libraries
2021-04-17 21:20:54 +02:00
$dir = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility :: extPath ( 'meilisearch' );
2021-04-17 00:26:33 +02:00
require $dir . '/Resources/Private/Php/ComposerLibraries/vendor/autoload.php' ;
}