[task] resturcture compatibility layer

This commit is contained in:
Daniel Maier 2018-10-30 11:30:06 +01:00
parent fa74af3261
commit d1607ac1b4
7 changed files with 29 additions and 18 deletions

View file

@ -2,6 +2,7 @@
namespace Codappix\SearchCore;
use Codappix\SearchCore\Compatibility\ExtensionConfigurationInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
@ -14,4 +15,14 @@ class Bootstrap
{
return GeneralUtility::makeInstance(ObjectManager::class);
}
/**
* @return ExtensionConfigurationInterface
*/
public static function getExtensionConfiguration()
{
return static::getObjectManager()->get(
ExtensionConfigurationInterface::class
);
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Codappix\SearchCore\Utility;
namespace Codappix\SearchCore\Compatibility;
class ExtensionConfiguration extends \TYPO3\CMS\Core\Configuration\ExtensionConfiguration implements ExtensionConfigurationInterface
{

View file

@ -1,6 +1,6 @@
<?php
namespace Codappix\SearchCore\Utility;
namespace Codappix\SearchCore\Compatibility;
interface ExtensionConfigurationInterface
{

View file

@ -23,12 +23,10 @@ namespace Codappix\SearchCore\Compatibility;
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService;
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableServiceInterface;
use Codappix\SearchCore\Utility\ExtensionConfiguration;
use Codappix\SearchCore\Utility\ExtensionConfiguration87;
use Codappix\SearchCore\Utility\ExtensionConfigurationInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Object\Container\Container;
use TYPO3\CMS\Extbase\Persistence\Generic\Qom\Comparison;
/**
* Register different concrete implementations, depending on current TYPO3 version.
@ -59,7 +57,7 @@ class ImplementationRegistrationService
} else if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 8000000) {
$container->registerImplementation(
ExtensionConfigurationInterface::class,
ExtensionConfiguration87::class
Version87\ExtensionConfiguration::class
);
$container->registerImplementation(

View file

@ -0,0 +1,13 @@
<?php
namespace Codappix\SearchCore\Compatibility\Version87;
use Codappix\SearchCore\Compatibility\ExtensionConfigurationInterface;
class ExtensionConfiguration implements ExtensionConfigurationInterface
{
public function get($extensionKey)
{
return unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]);
}
}

View file

@ -1,11 +0,0 @@
<?php
namespace Codappix\SearchCore\Utility;
class ExtensionConfiguration87 implements ExtensionConfigurationInterface
{
public function get($extensionKey)
{
return unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]);
}
}

View file

@ -44,7 +44,7 @@ call_user_func(
// API does make use of object manager, therefore use GLOBALS
$extensionConfiguration = \Codappix\SearchCore\Bootstrap::getObjectManager()->get(\Codappix\SearchCore\Utility\ExtensionConfigurationInterface::class)->get($extensionKey);
$extensionConfiguration = \Codappix\SearchCore\Bootstrap::getExtensionConfiguration()->get($extensionKey);
if ($extensionConfiguration === false
|| !isset($extensionConfiguration['disable']['elasticsearch'])