From fa74af32615b299d8802553b9d622049f90e909a Mon Sep 17 00:00:00 2001 From: Daniel Maier Date: Tue, 30 Oct 2018 11:13:56 +0100 Subject: [PATCH] [task] implement extension configuration interface --- Classes/Bootstrap.php | 17 +++++++ .../ImplementationRegistrationService.php | 46 +++++++++++++++---- Classes/Utility/ExtensionConfiguration.php | 7 +++ Classes/Utility/ExtensionConfiguration87.php | 11 +++++ .../ExtensionConfigurationInterface.php | 8 ++++ ext_localconf.php | 6 +-- 6 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 Classes/Bootstrap.php create mode 100644 Classes/Utility/ExtensionConfiguration.php create mode 100644 Classes/Utility/ExtensionConfiguration87.php create mode 100644 Classes/Utility/ExtensionConfigurationInterface.php diff --git a/Classes/Bootstrap.php b/Classes/Bootstrap.php new file mode 100644 index 0000000..b156a28 --- /dev/null +++ b/Classes/Bootstrap.php @@ -0,0 +1,17 @@ +registerImplementation( - \Codappix\SearchCore\Compatibility\TypoScriptServiceInterface::class, - \Codappix\SearchCore\Compatibility\TypoScriptService::class - ); + if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 9000000) { + $container->registerImplementation( + ExtensionConfigurationInterface::class, + ExtensionConfiguration::class + ); - $container->registerImplementation( - \Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableServiceInterface::class, - \Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService::class - ); + $container->registerImplementation( + TypoScriptServiceInterface::class, + TypoScriptService::class + ); + + $container->registerImplementation( + TcaTableServiceInterface::class, + TcaTableService::class + ); + } else if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 8000000) { + $container->registerImplementation( + ExtensionConfigurationInterface::class, + ExtensionConfiguration87::class + ); + + $container->registerImplementation( + TypoScriptServiceInterface::class, + TypoScriptService::class + ); + + $container->registerImplementation( + TcaTableServiceInterface::class, + TcaTableService::class + ); + } } } diff --git a/Classes/Utility/ExtensionConfiguration.php b/Classes/Utility/ExtensionConfiguration.php new file mode 100644 index 0000000..029cd3c --- /dev/null +++ b/Classes/Utility/ExtensionConfiguration.php @@ -0,0 +1,7 @@ +get($extensionKey); - + $extensionConfiguration = \Codappix\SearchCore\Bootstrap::getObjectManager()->get(\Codappix\SearchCore\Utility\ExtensionConfigurationInterface::class)->get($extensionKey); + if ($extensionConfiguration === false || !isset($extensionConfiguration['disable']['elasticsearch']) || $extensionConfiguration['disable']['elasticsearch'] !== '1'