mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-22 09:56:11 +01:00
Remove compatibility layer, as only V9 is supported
This commit is contained in:
parent
ff6e721158
commit
9946276f43
10 changed files with 8 additions and 213 deletions
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
namespace Codappix\SearchCore;
|
||||
|
||||
use Codappix\SearchCore\Compatibility\ExtensionConfigurationInterface;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
||||
|
||||
class Bootstrap
|
||||
{
|
||||
/**
|
||||
* @return object|ObjectManager
|
||||
*/
|
||||
public static function getObjectManager()
|
||||
{
|
||||
return GeneralUtility::makeInstance(ObjectManager::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ExtensionConfigurationInterface
|
||||
*/
|
||||
public static function getExtensionConfiguration()
|
||||
{
|
||||
return static::getObjectManager()->get(
|
||||
ExtensionConfigurationInterface::class
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
namespace Codappix\SearchCore\Compatibility;
|
||||
|
||||
use Codappix\SearchCore\Bootstrap;
|
||||
|
||||
class ExtensionConfiguration implements ExtensionConfigurationInterface
|
||||
{
|
||||
/**
|
||||
* @return object|\TYPO3\CMS\Core\Configuration\ExtensionConfiguration
|
||||
*/
|
||||
private function base()
|
||||
{
|
||||
return Bootstrap::getObjectManager()->get(\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $extensionKey
|
||||
* @return mixed
|
||||
* @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException
|
||||
* @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException
|
||||
*/
|
||||
public function get($extensionKey)
|
||||
{
|
||||
return $this->base()->get($extensionKey);
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
namespace Codappix\SearchCore\Compatibility;
|
||||
|
||||
interface ExtensionConfigurationInterface
|
||||
{
|
||||
public function get($extensionKey);
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
namespace Codappix\SearchCore\Compatibility;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService;
|
||||
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableServiceInterface;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
|
||||
use TYPO3\CMS\Extbase\Object\Container\Container;
|
||||
|
||||
/**
|
||||
* Register different concrete implementations, depending on current TYPO3 version.
|
||||
* This way we can provide working implementations for multiple TYPO3 versions.
|
||||
*/
|
||||
class ImplementationRegistrationService
|
||||
{
|
||||
public static function registerImplementations()
|
||||
{
|
||||
/** @var Container $container */
|
||||
$container = GeneralUtility::makeInstance(Container::class);
|
||||
|
||||
if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 9000000) {
|
||||
$container->registerImplementation(
|
||||
ExtensionConfigurationInterface::class,
|
||||
ExtensionConfiguration::class
|
||||
);
|
||||
} elseif (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 8000000) {
|
||||
$container->registerImplementation(
|
||||
ExtensionConfigurationInterface::class,
|
||||
Version87\ExtensionConfiguration::class
|
||||
);
|
||||
}
|
||||
|
||||
$container->registerImplementation(
|
||||
TypoScriptServiceInterface::class,
|
||||
TypoScriptService::class
|
||||
);
|
||||
|
||||
$container->registerImplementation(
|
||||
TcaTableServiceInterface::class,
|
||||
TcaTableService::class
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
namespace Codappix\SearchCore\Compatibility;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\TypoScript\TypoScriptService as CoreTypoScriptService;
|
||||
|
||||
/**
|
||||
* Used since TYPO3 CMS 8.7.
|
||||
*/
|
||||
class TypoScriptService extends CoreTypoScriptService implements TypoScriptServiceInterface
|
||||
{
|
||||
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
namespace Codappix\SearchCore\Compatibility;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allows to use DI configuration to switch concrete implementation, depending
|
||||
* on current TYPO3 Version.
|
||||
*/
|
||||
interface TypoScriptServiceInterface
|
||||
{
|
||||
public function convertPlainArrayToTypoScriptArray(array $plainArray);
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<?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]);
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ namespace Codappix\SearchCore\DataProcessing;
|
|||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
use Codappix\SearchCore\Compatibility\TypoScriptServiceInterface;
|
||||
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
||||
|
||||
|
@ -30,11 +30,11 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
|||
class ContentObjectDataProcessorAdapterProcessor implements ProcessorInterface
|
||||
{
|
||||
/**
|
||||
* @var TypoScriptServiceInterface
|
||||
* @var TypoScriptService
|
||||
*/
|
||||
protected $typoScriptService;
|
||||
|
||||
public function __construct(TypoScriptServiceInterface $typoScriptService)
|
||||
public function __construct(TypoScriptService $typoScriptService)
|
||||
{
|
||||
$this->typoScriptService = $typoScriptService;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,7 @@ namespace Codappix\SearchCore\Tests\Functional\DataProcessing;
|
|||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
use Codappix\SearchCore\Compatibility\TypoScriptService76;
|
||||
use Codappix\SearchCore\Compatibility\TypoScriptService;
|
||||
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
|
||||
use Codappix\SearchCore\DataProcessing\ContentObjectDataProcessorAdapterProcessor;
|
||||
use Codappix\SearchCore\Tests\Functional\AbstractFunctionalTestCase;
|
||||
use TYPO3\CMS\Frontend\DataProcessing\SplitProcessor;
|
||||
|
@ -45,13 +44,7 @@ class ContentObjectDataProcessorAdapterProcessorTest extends AbstractFunctionalT
|
|||
'new_content' => ['value1', 'value2'],
|
||||
];
|
||||
|
||||
if ($this->isLegacyVersion()) {
|
||||
$typoScriptService = new TypoScriptService76();
|
||||
} else {
|
||||
$typoScriptService = new TypoScriptService();
|
||||
}
|
||||
|
||||
$subject = new ContentObjectDataProcessorAdapterProcessor($typoScriptService);
|
||||
$subject = new ContentObjectDataProcessorAdapterProcessor(new TypoScriptService());
|
||||
$processedData = $subject->processData($record, $configuration);
|
||||
$this->assertSame(
|
||||
$expectedData,
|
||||
|
|
|
@ -40,11 +40,9 @@ call_user_func(
|
|||
]
|
||||
);
|
||||
|
||||
\Codappix\SearchCore\Compatibility\ImplementationRegistrationService::registerImplementations();
|
||||
|
||||
|
||||
// API does make use of object manager, therefore use GLOBALS
|
||||
$extensionConfiguration = \Codappix\SearchCore\Bootstrap::getExtensionConfiguration()->get($extensionKey);
|
||||
$extensionConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
|
||||
\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class
|
||||
)->get($extensionKey);
|
||||
|
||||
if ($extensionConfiguration === false
|
||||
|| !isset($extensionConfiguration['disable']['elasticsearch'])
|
||||
|
|
Loading…
Reference in a new issue