mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-22 21:56:12 +01:00
Merge pull request #136 from Codappix/feature/support-typo3-7-to-8
FEATURE: Support TYPO3 CMS 7 to 8
This commit is contained in:
commit
0461cf3b21
39 changed files with 962 additions and 123 deletions
|
@ -13,6 +13,7 @@ language: php
|
||||||
php:
|
php:
|
||||||
- 7.0
|
- 7.0
|
||||||
- 7.1
|
- 7.1
|
||||||
|
- 7.2
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
@ -24,6 +25,9 @@ env:
|
||||||
- typo3DatabaseHost="127.0.0.1"
|
- typo3DatabaseHost="127.0.0.1"
|
||||||
- typo3DatabaseUsername="travis"
|
- typo3DatabaseUsername="travis"
|
||||||
- typo3DatabasePassword=""
|
- typo3DatabasePassword=""
|
||||||
|
matrix:
|
||||||
|
- TYPO3_VERSION="~7.6"
|
||||||
|
- TYPO3_VERSION="~8.7"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
|
56
Classes/Compatibility/ImplementationRegistrationService.php
Normal file
56
Classes/Compatibility/ImplementationRegistrationService.php
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?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\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()
|
||||||
|
{
|
||||||
|
$container = GeneralUtility::makeInstance(Container::class);
|
||||||
|
if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 8000000) {
|
||||||
|
$container->registerImplementation(
|
||||||
|
\Codappix\SearchCore\Compatibility\TypoScriptServiceInterface::class,
|
||||||
|
\Codappix\SearchCore\Compatibility\TypoScriptService::class
|
||||||
|
);
|
||||||
|
$container->registerImplementation(
|
||||||
|
\Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableServiceInterface::class,
|
||||||
|
\Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService::class
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$container->registerImplementation(
|
||||||
|
\Codappix\SearchCore\Compatibility\TypoScriptServiceInterface::class,
|
||||||
|
\Codappix\SearchCore\Compatibility\TypoScriptService76::class
|
||||||
|
);
|
||||||
|
$container->registerImplementation(
|
||||||
|
\Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableServiceInterface::class,
|
||||||
|
\Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService76::class
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
Classes/Compatibility/TypoScriptService.php
Normal file
31
Classes/Compatibility/TypoScriptService.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?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
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
31
Classes/Compatibility/TypoScriptService76.php
Normal file
31
Classes/Compatibility/TypoScriptService76.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?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\Extbase\Service\TypoScriptService as CoreTypoScriptService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used before TYPO3 CMS 8.7.
|
||||||
|
*/
|
||||||
|
class TypoScriptService76 extends CoreTypoScriptService implements TypoScriptServiceInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
30
Classes/Compatibility/TypoScriptServiceInterface.php
Normal file
30
Classes/Compatibility/TypoScriptServiceInterface.php
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?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);
|
||||||
|
}
|
|
@ -37,6 +37,21 @@ class IndexFactory implements Singleton
|
||||||
*/
|
*/
|
||||||
protected $configuration;
|
protected $configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \TYPO3\CMS\Core\Log\Logger
|
||||||
|
*/
|
||||||
|
protected $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inject log manager to get concrete logger from it.
|
||||||
|
*
|
||||||
|
* @param \TYPO3\CMS\Core\Log\LogManager $logManager
|
||||||
|
*/
|
||||||
|
public function injectLogger(\TYPO3\CMS\Core\Log\LogManager $logManager)
|
||||||
|
{
|
||||||
|
$this->logger = $logManager->getLogger(__CLASS__);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ConfigurationContainerInterface $configuration
|
* @param ConfigurationContainerInterface $configuration
|
||||||
*/
|
*/
|
||||||
|
@ -53,7 +68,10 @@ class IndexFactory implements Singleton
|
||||||
$index = $connection->getClient()->getIndex('typo3content');
|
$index = $connection->getClient()->getIndex('typo3content');
|
||||||
|
|
||||||
if ($index->exists() === false) {
|
if ($index->exists() === false) {
|
||||||
$index->create($this->getConfigurationFor($documentType));
|
$config = $this->getConfigurationFor($documentType);
|
||||||
|
$this->logger->debug(sprintf('Create index %s.', $documentType), [$documentType, $config]);
|
||||||
|
$index->create($config);
|
||||||
|
$this->logger->debug(sprintf('Created index %s.', $documentType), [$documentType]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $index;
|
return $index;
|
||||||
|
@ -64,9 +82,13 @@ class IndexFactory implements Singleton
|
||||||
try {
|
try {
|
||||||
$configuration = $this->configuration->get('indexing.' . $documentType . '.index');
|
$configuration = $this->configuration->get('indexing.' . $documentType . '.index');
|
||||||
|
|
||||||
if (isset($configuration['analysis']['analyzer'])) {
|
foreach (['analyzer', 'filter'] as $optionsToExpand) {
|
||||||
foreach ($configuration['analysis']['analyzer'] as $key => $analyzer) {
|
if (isset($configuration['analysis'][$optionsToExpand])) {
|
||||||
$configuration['analysis']['analyzer'][$key] = $this->prepareAnalyzerConfiguration($analyzer);
|
foreach ($configuration['analysis'][$optionsToExpand] as $key => $options) {
|
||||||
|
$configuration['analysis'][$optionsToExpand][$key] = $this->prepareAnalyzerConfiguration(
|
||||||
|
$options
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +100,7 @@ class IndexFactory implements Singleton
|
||||||
|
|
||||||
protected function prepareAnalyzerConfiguration(array $analyzer) : array
|
protected function prepareAnalyzerConfiguration(array $analyzer) : array
|
||||||
{
|
{
|
||||||
$fieldsToExplode = ['char_filter', 'filter'];
|
$fieldsToExplode = ['char_filter', 'filter', 'word_list'];
|
||||||
|
|
||||||
foreach ($fieldsToExplode as $fieldToExplode) {
|
foreach ($fieldsToExplode as $fieldToExplode) {
|
||||||
if (isset($analyzer[$fieldToExplode])) {
|
if (isset($analyzer[$fieldToExplode])) {
|
||||||
|
|
|
@ -20,8 +20,8 @@ namespace Codappix\SearchCore\DataProcessing;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\SearchCore\Compatibility\TypoScriptServiceInterface;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
|
|
||||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,11 +30,11 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
||||||
class ContentObjectDataProcessorAdapterProcessor implements ProcessorInterface
|
class ContentObjectDataProcessorAdapterProcessor implements ProcessorInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var TypoScriptService
|
* @var TypoScriptServiceInterface
|
||||||
*/
|
*/
|
||||||
protected $typoScriptService;
|
protected $typoScriptService;
|
||||||
|
|
||||||
public function __construct(TypoScriptService $typoScriptService)
|
public function __construct(TypoScriptServiceInterface $typoScriptService)
|
||||||
{
|
{
|
||||||
$this->typoScriptService = $typoScriptService;
|
$this->typoScriptService = $typoScriptService;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,10 +68,6 @@ abstract class AbstractIndexer implements IndexerInterface
|
||||||
$this->identifier = $identifier;
|
$this->identifier = $identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ConnectionInterface $connection
|
|
||||||
* @param ConfigurationContainerInterface $configuration
|
|
||||||
*/
|
|
||||||
public function __construct(ConnectionInterface $connection, ConfigurationContainerInterface $configuration)
|
public function __construct(ConnectionInterface $connection, ConfigurationContainerInterface $configuration)
|
||||||
{
|
{
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
|
|
|
@ -23,8 +23,7 @@ namespace Codappix\SearchCore\Domain\Index;
|
||||||
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
||||||
use Codappix\SearchCore\Configuration\InvalidArgumentException;
|
use Codappix\SearchCore\Configuration\InvalidArgumentException;
|
||||||
use Codappix\SearchCore\Domain\Index\IndexerInterface;
|
use Codappix\SearchCore\Domain\Index\IndexerInterface;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer;
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableServiceInterface;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService;
|
|
||||||
use TYPO3\CMS\Core\SingletonInterface as Singleton;
|
use TYPO3\CMS\Core\SingletonInterface as Singleton;
|
||||||
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
||||||
|
|
||||||
|
@ -82,13 +81,13 @@ class IndexerFactory implements Singleton
|
||||||
) {
|
) {
|
||||||
$indexer = $this->objectManager->get(
|
$indexer = $this->objectManager->get(
|
||||||
$indexerClass,
|
$indexerClass,
|
||||||
$this->objectManager->get(TcaTableService::class, $identifier),
|
$this->objectManager->get(TcaTableServiceInterface::class, $identifier),
|
||||||
$this->objectManager->get(TcaTableService::class, 'tt_content')
|
$this->objectManager->get(TcaTableServiceInterface::class, 'tt_content')
|
||||||
);
|
);
|
||||||
} elseif (is_subclass_of($indexerClass, TcaIndexer::class) || $indexerClass === TcaIndexer::class) {
|
} elseif (is_subclass_of($indexerClass, TcaIndexer::class) || $indexerClass === TcaIndexer::class) {
|
||||||
$indexer = $this->objectManager->get(
|
$indexer = $this->objectManager->get(
|
||||||
$indexerClass,
|
$indexerClass,
|
||||||
$this->objectManager->get(TcaTableService::class, $identifier)
|
$this->objectManager->get(TcaTableServiceInterface::class, $identifier)
|
||||||
);
|
);
|
||||||
} elseif (class_exists($indexerClass) && in_array(IndexerInterface::class, class_implements($indexerClass))) {
|
} elseif (class_exists($indexerClass) && in_array(IndexerInterface::class, class_implements($indexerClass))) {
|
||||||
$indexer = $this->objectManager->get($indexerClass);
|
$indexer = $this->objectManager->get($indexerClass);
|
||||||
|
|
|
@ -22,10 +22,7 @@ namespace Codappix\SearchCore\Domain\Index;
|
||||||
|
|
||||||
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
||||||
use Codappix\SearchCore\Connection\ConnectionInterface;
|
use Codappix\SearchCore\Connection\ConnectionInterface;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService;
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableServiceInterface;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
|
||||||
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
|
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will index the given table using configuration from TCA.
|
* Will index the given table using configuration from TCA.
|
||||||
|
@ -33,17 +30,17 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
class TcaIndexer extends AbstractIndexer
|
class TcaIndexer extends AbstractIndexer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var TcaIndexer\TcaTableService
|
* @var TcaTableServiceInterface
|
||||||
*/
|
*/
|
||||||
protected $tcaTableService;
|
protected $tcaTableService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TcaIndexer\TcaTableService $tcaTableService
|
* @param TcaTableServiceInterface $tcaTableService
|
||||||
* @param ConnectionInterface $connection
|
* @param ConnectionInterface $connection
|
||||||
* @param ConfigurationContainerInterface $configuration
|
* @param ConfigurationContainerInterface $configuration
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TcaIndexer\TcaTableService $tcaTableService,
|
TcaTableServiceInterface $tcaTableService,
|
||||||
ConnectionInterface $connection,
|
ConnectionInterface $connection,
|
||||||
ConfigurationContainerInterface $configuration
|
ConfigurationContainerInterface $configuration
|
||||||
) {
|
) {
|
||||||
|
@ -56,13 +53,8 @@ class TcaIndexer extends AbstractIndexer
|
||||||
*/
|
*/
|
||||||
protected function getRecords(int $offset, int $limit)
|
protected function getRecords(int $offset, int $limit)
|
||||||
{
|
{
|
||||||
$records = $this->getQuery()
|
$records = $this->tcaTableService->getRecords($offset, $limit);
|
||||||
->setFirstResult($offset)
|
if ($records === []) {
|
||||||
->setMaxResults($limit)
|
|
||||||
->execute()
|
|
||||||
->fetchAll();
|
|
||||||
|
|
||||||
if ($records === null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,11 +71,9 @@ class TcaIndexer extends AbstractIndexer
|
||||||
*/
|
*/
|
||||||
protected function getRecord(int $identifier) : array
|
protected function getRecord(int $identifier) : array
|
||||||
{
|
{
|
||||||
$query = $this->getQuery();
|
$record = $this->tcaTableService->getRecord($identifier);
|
||||||
$query = $query->andWhere($this->tcaTableService->getTableName() . '.uid = ' . $identifier);
|
|
||||||
$record = $query->execute()->fetch();
|
|
||||||
|
|
||||||
if ($record === false || $record === null) {
|
if ($record === []) {
|
||||||
throw new NoRecordFoundException(
|
throw new NoRecordFoundException(
|
||||||
'Record could not be fetched from database: "' . $identifier . '". Perhaps record is not active.',
|
'Record could not be fetched from database: "' . $identifier . '". Perhaps record is not active.',
|
||||||
1484225364
|
1484225364
|
||||||
|
@ -98,29 +88,4 @@ class TcaIndexer extends AbstractIndexer
|
||||||
{
|
{
|
||||||
return $this->tcaTableService->getTableName();
|
return $this->tcaTableService->getTableName();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getQuery(TcaTableService $tcaTableService = null) : QueryBuilder
|
|
||||||
{
|
|
||||||
if ($tcaTableService === null) {
|
|
||||||
$tcaTableService = $this->tcaTableService;
|
|
||||||
}
|
|
||||||
$queryBuilder = $this->getDatabaseConnection()->getQueryBuilderForTable($tcaTableService->getTableName());
|
|
||||||
$where = $tcaTableService->getWhereClause();
|
|
||||||
$query = $queryBuilder->select(... $tcaTableService->getFields())
|
|
||||||
->from($tcaTableService->getTableClause())
|
|
||||||
->where($where->getStatement())
|
|
||||||
->setParameters($where->getParameters());
|
|
||||||
|
|
||||||
foreach ($tcaTableService->getJoins() as $join) {
|
|
||||||
$query->from($join->getTable());
|
|
||||||
$query->andWhere($join->getCondition());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getDatabaseConnection() : ConnectionPool
|
|
||||||
{
|
|
||||||
return GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Codappix\SearchCore\Domain\Index\TcaIndexer;
|
||||||
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
||||||
use Codappix\SearchCore\Connection\ConnectionInterface;
|
use Codappix\SearchCore\Connection\ConnectionInterface;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer;
|
use Codappix\SearchCore\Domain\Index\TcaIndexer;
|
||||||
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specific indexer for Pages, will basically add content of page.
|
* Specific indexer for Pages, will basically add content of page.
|
||||||
|
@ -30,19 +31,25 @@ use Codappix\SearchCore\Domain\Index\TcaIndexer;
|
||||||
class PagesIndexer extends TcaIndexer
|
class PagesIndexer extends TcaIndexer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var TcaTableService
|
* @var TcaTableServiceInterface
|
||||||
*/
|
*/
|
||||||
protected $contentTableService;
|
protected $contentTableService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TcaTableService $tcaTableService
|
* @var \TYPO3\CMS\Core\Resource\FileRepository
|
||||||
* @param TcaTableService $contentTableService
|
* @inject
|
||||||
|
*/
|
||||||
|
protected $fileRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param TcaTableServiceInterface $tcaTableService
|
||||||
|
* @param TcaTableServiceInterface $contentTableService
|
||||||
* @param ConnectionInterface $connection
|
* @param ConnectionInterface $connection
|
||||||
* @param ConfigurationContainerInterface $configuration
|
* @param ConfigurationContainerInterface $configuration
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TcaTableService $tcaTableService,
|
TcaTableServiceInterface $tcaTableService,
|
||||||
TcaTableService $contentTableService,
|
TcaTableServiceInterface $contentTableService,
|
||||||
ConnectionInterface $connection,
|
ConnectionInterface $connection,
|
||||||
ConfigurationContainerInterface $configuration
|
ConfigurationContainerInterface $configuration
|
||||||
) {
|
) {
|
||||||
|
@ -60,28 +67,73 @@ class PagesIndexer extends TcaIndexer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$record['content'] = $this->fetchContentForPage($record['uid']);
|
$record['media'] = $this->fetchMediaForPage($record['uid']);
|
||||||
|
$content = $this->fetchContentForPage($record['uid']);
|
||||||
|
if ($content !== []) {
|
||||||
|
$record['content'] = $content['content'];
|
||||||
|
$record['media'] = array_values(array_unique(array_merge($record['media'], $content['images'])));
|
||||||
|
}
|
||||||
parent::prepareRecord($record);
|
parent::prepareRecord($record);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fetchContentForPage(int $uid) : string
|
protected function fetchContentForPage(int $uid) : array
|
||||||
{
|
{
|
||||||
$contentElements = $this->getQuery($this->contentTableService)->execute()->fetchAll();
|
if ($this->contentTableService instanceof TcaTableService) {
|
||||||
|
$contentElements = $this->contentTableService->getQuery()
|
||||||
|
->execute()->fetchAll();
|
||||||
|
} else {
|
||||||
|
$contentElements = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||||||
|
$this->contentTableService->getFields(),
|
||||||
|
$this->contentTableService->getTableClause(),
|
||||||
|
$this->contentTableService->getWhereClause() .
|
||||||
|
sprintf(' AND %s.pid = %u', $this->contentTableService->getTableName(), $uid)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($contentElements === null) {
|
if ($contentElements === null) {
|
||||||
$this->logger->debug('No content for page ' . $uid);
|
$this->logger->debug('No content for page ' . $uid);
|
||||||
return '';
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->debug('Fetched content for page ' . $uid);
|
$this->logger->debug('Fetched content for page ' . $uid);
|
||||||
|
$images = [];
|
||||||
$content = [];
|
$content = [];
|
||||||
foreach ($contentElements as $contentElement) {
|
foreach ($contentElements as $contentElement) {
|
||||||
|
$images = array_merge(
|
||||||
|
$images,
|
||||||
|
$this->getContentElementImages($contentElement['uid'])
|
||||||
|
);
|
||||||
$content[] = $contentElement['bodytext'];
|
$content[] = $contentElement['bodytext'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
// Remove Tags.
|
// Remove Tags.
|
||||||
// Interpret escaped new lines and special chars.
|
// Interpret escaped new lines and special chars.
|
||||||
// Trim, e.g. trailing or leading new lines.
|
// Trim, e.g. trailing or leading new lines.
|
||||||
return trim(stripcslashes(strip_tags(implode(' ', $content))));
|
'content' => trim(stripcslashes(strip_tags(implode(' ', $content)))),
|
||||||
|
'images' => $images,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getContentElementImages(int $uidOfContentElement) : array
|
||||||
|
{
|
||||||
|
return $this->fetchSysFileReferenceUids($uidOfContentElement, 'tt_content', 'image');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function fetchMediaForPage(int $uid) : array
|
||||||
|
{
|
||||||
|
return $this->fetchSysFileReferenceUids($uid, 'pages', 'media');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function fetchSysFileReferenceUids(int $uid, string $tablename, string $fieldname) : array
|
||||||
|
{
|
||||||
|
$imageRelationUids = [];
|
||||||
|
$imageRelations = $this->fileRepository->findByRelation($tablename, $fieldname, $uid);
|
||||||
|
|
||||||
|
foreach ($imageRelations as $relation) {
|
||||||
|
$imageRelationUids[] = $relation->getUid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $imageRelationUids;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
*/
|
*/
|
||||||
class RelationResolver implements Singleton
|
class RelationResolver implements Singleton
|
||||||
{
|
{
|
||||||
public function resolveRelationsForRecord(TcaTableService $service, array &$record)
|
public function resolveRelationsForRecord(TcaTableServiceInterface $service, array &$record)
|
||||||
{
|
{
|
||||||
foreach (array_keys($record) as $column) {
|
foreach (array_keys($record) as $column) {
|
||||||
// TODO: Define / configure fields to exclude?!
|
// TODO: Define / configure fields to exclude?!
|
||||||
|
|
|
@ -21,11 +21,13 @@ namespace Codappix\SearchCore\Domain\Index\TcaIndexer;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer\InvalidArgumentException;
|
|
||||||
use Codappix\SearchCore\Database\Doctrine\Join;
|
use Codappix\SearchCore\Database\Doctrine\Join;
|
||||||
use Codappix\SearchCore\Database\Doctrine\Where;
|
use Codappix\SearchCore\Database\Doctrine\Where;
|
||||||
use Codappix\SearchCore\Domain\Index\IndexingException;
|
use Codappix\SearchCore\Domain\Index\IndexingException;
|
||||||
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\InvalidArgumentException;
|
||||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||||
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||||
|
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\CMS\Core\Utility\RootlineUtility;
|
use TYPO3\CMS\Core\Utility\RootlineUtility;
|
||||||
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
||||||
|
@ -33,7 +35,7 @@ use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
||||||
/**
|
/**
|
||||||
* Encapsulate logik related to TCA configuration.
|
* Encapsulate logik related to TCA configuration.
|
||||||
*/
|
*/
|
||||||
class TcaTableService
|
class TcaTableService implements TcaTableServiceInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* TCA for current table.
|
* TCA for current table.
|
||||||
|
@ -117,9 +119,26 @@ class TcaTableService
|
||||||
return $this->tableName;
|
return $this->tableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getRecords(int $offset, int $limit) : array
|
||||||
* Filter the given records by root line blacklist settings.
|
{
|
||||||
*/
|
$records = $this->getQuery()
|
||||||
|
->setFirstResult($offset)
|
||||||
|
->setMaxResults($limit)
|
||||||
|
->execute()
|
||||||
|
->fetchAll();
|
||||||
|
|
||||||
|
return $records ?: [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecord(int $identifier) : array
|
||||||
|
{
|
||||||
|
$query = $this->getQuery();
|
||||||
|
$query = $query->andWhere($this->getTableName() . '.uid = ' . $identifier);
|
||||||
|
$record = $query->execute()->fetch();
|
||||||
|
|
||||||
|
return $record ?: [];
|
||||||
|
}
|
||||||
|
|
||||||
public function filterRecordsByRootLineBlacklist(array &$records)
|
public function filterRecordsByRootLineBlacklist(array &$records)
|
||||||
{
|
{
|
||||||
$records = array_filter(
|
$records = array_filter(
|
||||||
|
@ -142,7 +161,7 @@ class TcaTableService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWhereClause() : Where
|
protected function getWhereClause() : Where
|
||||||
{
|
{
|
||||||
$parameters = [];
|
$parameters = [];
|
||||||
$whereClause = $this->getSystemWhereClause();
|
$whereClause = $this->getSystemWhereClause();
|
||||||
|
@ -155,7 +174,7 @@ class TcaTableService
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isBlackListedRootLineConfigured()) {
|
if ($this->isBlackListedRootLineConfigured()) {
|
||||||
$parameters[':blacklistedRootLine'] = $this->getBlackListedRootLine();
|
$parameters[':blacklistedRootLine'] = implode(',', $this->getBlackListedRootLine());
|
||||||
$whereClause .= ' AND pages.uid NOT IN (:blacklistedRootLine)'
|
$whereClause .= ' AND pages.uid NOT IN (:blacklistedRootLine)'
|
||||||
. ' AND pages.pid NOT IN (:blacklistedRootLine)';
|
. ' AND pages.pid NOT IN (:blacklistedRootLine)';
|
||||||
}
|
}
|
||||||
|
@ -164,7 +183,7 @@ class TcaTableService
|
||||||
return new Where($whereClause, $parameters);
|
return new Where($whereClause, $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFields() : array
|
protected function getFields() : array
|
||||||
{
|
{
|
||||||
$fields = array_merge(
|
$fields = array_merge(
|
||||||
['uid','pid'],
|
['uid','pid'],
|
||||||
|
@ -187,7 +206,7 @@ class TcaTableService
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJoins() : array
|
protected function getJoins() : array
|
||||||
{
|
{
|
||||||
if ($this->tableName === 'pages') {
|
if ($this->tableName === 'pages') {
|
||||||
return [];
|
return [];
|
||||||
|
@ -202,7 +221,7 @@ class TcaTableService
|
||||||
* Generate SQL for TYPO3 as a system, to make sure only available records
|
* Generate SQL for TYPO3 as a system, to make sure only available records
|
||||||
* are fetched.
|
* are fetched.
|
||||||
*/
|
*/
|
||||||
public function getSystemWhereClause() : string
|
protected function getSystemWhereClause() : string
|
||||||
{
|
{
|
||||||
$whereClause = '1=1'
|
$whereClause = '1=1'
|
||||||
. BackendUtility::BEenableFields($this->tableName)
|
. BackendUtility::BEenableFields($this->tableName)
|
||||||
|
@ -344,4 +363,26 @@ class TcaTableService
|
||||||
$this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist')
|
$this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getQuery() : QueryBuilder
|
||||||
|
{
|
||||||
|
$queryBuilder = $this->getDatabaseConnection()->getQueryBuilderForTable($this->getTableName());
|
||||||
|
$where = $this->getWhereClause();
|
||||||
|
$query = $queryBuilder->select(... $this->getFields())
|
||||||
|
->from($this->getTableClause())
|
||||||
|
->where($where->getStatement())
|
||||||
|
->setParameters($where->getParameters());
|
||||||
|
|
||||||
|
foreach ($this->getJoins() as $join) {
|
||||||
|
$query->from($join->getTable());
|
||||||
|
$query->andWhere($join->getCondition());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getDatabaseConnection() : ConnectionPool
|
||||||
|
{
|
||||||
|
return GeneralUtility::makeInstance(ConnectionPool::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
378
Classes/Domain/Index/TcaIndexer/TcaTableService76.php
Normal file
378
Classes/Domain/Index/TcaIndexer/TcaTableService76.php
Normal file
|
@ -0,0 +1,378 @@
|
||||||
|
<?php
|
||||||
|
namespace Codappix\SearchCore\Domain\Index\TcaIndexer;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 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\Configuration\ConfigurationContainerInterface;
|
||||||
|
use Codappix\SearchCore\Domain\Index\IndexingException;
|
||||||
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\InvalidArgumentException;
|
||||||
|
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||||
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
|
use TYPO3\CMS\Core\Utility\RootlineUtility;
|
||||||
|
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encapsulate logik related to TCA configuration.
|
||||||
|
*/
|
||||||
|
class TcaTableService76 implements TcaTableServiceInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* TCA for current table.
|
||||||
|
* !REFERENCE! To save memory.
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $tca;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $tableName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ConfigurationContainerInterface
|
||||||
|
*/
|
||||||
|
protected $configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var RelationResolver
|
||||||
|
*/
|
||||||
|
protected $relationResolver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \TYPO3\CMS\Core\Log\Logger
|
||||||
|
*/
|
||||||
|
protected $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ObjectManagerInterface
|
||||||
|
*/
|
||||||
|
protected $objectManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inject log manager to get concrete logger from it.
|
||||||
|
*
|
||||||
|
* @param \TYPO3\CMS\Core\Log\LogManager $logManager
|
||||||
|
*/
|
||||||
|
public function injectLogger(\TYPO3\CMS\Core\Log\LogManager $logManager)
|
||||||
|
{
|
||||||
|
$this->logger = $logManager->getLogger(__CLASS__);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ObjectManagerInterface $objectManager
|
||||||
|
*/
|
||||||
|
public function injectObjectManager(ObjectManagerInterface $objectManager)
|
||||||
|
{
|
||||||
|
$this->objectManager = $objectManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $tableName
|
||||||
|
* @param ConfigurationContainerInterface $configuration
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
$tableName,
|
||||||
|
RelationResolver $relationResolver,
|
||||||
|
ConfigurationContainerInterface $configuration
|
||||||
|
) {
|
||||||
|
if (!isset($GLOBALS['TCA'][$tableName])) {
|
||||||
|
throw new IndexingException(
|
||||||
|
'Table "' . $tableName . '" is not configured in TCA.',
|
||||||
|
IndexingException::CODE_UNKOWN_TCA_TABLE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tableName = $tableName;
|
||||||
|
$this->tca = &$GLOBALS['TCA'][$this->tableName];
|
||||||
|
$this->configuration = $configuration;
|
||||||
|
$this->relationResolver = $relationResolver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTableName() : string
|
||||||
|
{
|
||||||
|
return $this->tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTableClause() : string
|
||||||
|
{
|
||||||
|
if ($this->tableName === 'pages') {
|
||||||
|
return $this->tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->tableName . ' LEFT JOIN pages on ' . $this->tableName . '.pid = pages.uid';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecords(int $offset, int $limit) : array
|
||||||
|
{
|
||||||
|
$records = $this->getConnection()->exec_SELECTgetRows(
|
||||||
|
$this->getFields(),
|
||||||
|
$this->getTableClause(),
|
||||||
|
$this->getWhereClause(),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
(int) $offset . ',' . (int) $limit
|
||||||
|
);
|
||||||
|
|
||||||
|
return $records ?: [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecord(int $identifier) : array
|
||||||
|
{
|
||||||
|
$record = $this->getConnection()->exec_SELECTgetSingleRow(
|
||||||
|
$this->getFields(),
|
||||||
|
$this->getTableClause(),
|
||||||
|
$this->getWhereClause()
|
||||||
|
. ' AND ' . $this->getTableName() . '.uid = ' . (int) $identifier
|
||||||
|
);
|
||||||
|
|
||||||
|
return $record ?: [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function filterRecordsByRootLineBlacklist(array &$records)
|
||||||
|
{
|
||||||
|
$records = array_filter(
|
||||||
|
$records,
|
||||||
|
function ($record) {
|
||||||
|
return ! $this->isRecordBlacklistedByRootline($record);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepareRecord(array &$record)
|
||||||
|
{
|
||||||
|
$this->relationResolver->resolveRelationsForRecord($this, $record);
|
||||||
|
|
||||||
|
if (isset($record['uid']) && !isset($record['search_identifier'])) {
|
||||||
|
$record['search_identifier'] = $record['uid'];
|
||||||
|
}
|
||||||
|
if (isset($record[$this->tca['ctrl']['label']]) && !isset($record['search_title'])) {
|
||||||
|
$record['search_title'] = $record[$this->tca['ctrl']['label']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWhereClause() : string
|
||||||
|
{
|
||||||
|
$whereClause = '1=1'
|
||||||
|
. BackendUtility::BEenableFields($this->tableName)
|
||||||
|
. BackendUtility::deleteClause($this->tableName)
|
||||||
|
. ' AND pages.no_search = 0'
|
||||||
|
;
|
||||||
|
|
||||||
|
if ($this->tableName !== 'pages') {
|
||||||
|
$whereClause .= BackendUtility::BEenableFields('pages')
|
||||||
|
. BackendUtility::deleteClause('pages')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userDefinedWhere = $this->configuration->getIfExists(
|
||||||
|
'indexing.' . $this->getTableName() . '.additionalWhereClause'
|
||||||
|
);
|
||||||
|
if (is_string($userDefinedWhere)) {
|
||||||
|
$whereClause .= ' AND ' . $userDefinedWhere;
|
||||||
|
}
|
||||||
|
if ($this->isBlacklistedRootLineConfigured()) {
|
||||||
|
$whereClause .= ' AND pages.uid NOT IN ('
|
||||||
|
. implode(',', $this->getBlacklistedRootLine())
|
||||||
|
. ')'
|
||||||
|
. ' AND pages.pid NOT IN ('
|
||||||
|
. implode(',', $this->getBlacklistedRootLine())
|
||||||
|
. ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->logger->debug('Generated where clause.', [$this->tableName, $whereClause]);
|
||||||
|
return $whereClause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFields() : string
|
||||||
|
{
|
||||||
|
$fields = array_merge(
|
||||||
|
['uid','pid'],
|
||||||
|
array_filter(
|
||||||
|
array_keys($this->tca['columns']),
|
||||||
|
function ($columnName) {
|
||||||
|
return !$this->isSystemField($columnName)
|
||||||
|
&& !$this->isUserField($columnName)
|
||||||
|
&& !$this->isPassthroughField($columnName)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($fields as $key => $field) {
|
||||||
|
$fields[$key] = $this->tableName . '.' . $field;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->logger->debug('Generated fields.', [$this->tableName, $fields]);
|
||||||
|
return implode(',', $fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate SQL for TYPO3 as a system, to make sure only available records
|
||||||
|
* are fetched.
|
||||||
|
*/
|
||||||
|
protected function getSystemWhereClause() : string
|
||||||
|
{
|
||||||
|
$whereClause = '1=1'
|
||||||
|
. BackendUtility::BEenableFields($this->tableName)
|
||||||
|
. BackendUtility::deleteClause($this->tableName)
|
||||||
|
. ' AND pages.no_search = 0'
|
||||||
|
;
|
||||||
|
|
||||||
|
if ($this->tableName !== 'pages') {
|
||||||
|
$whereClause .= BackendUtility::BEenableFields('pages')
|
||||||
|
. BackendUtility::deleteClause('pages')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $whereClause;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function isSystemField(string $columnName) : bool
|
||||||
|
{
|
||||||
|
$systemFields = [
|
||||||
|
// Versioning fields,
|
||||||
|
// https://docs.typo3.org/typo3cms/TCAReference/Reference/Ctrl/Index.html#versioningws
|
||||||
|
't3ver_oid', 't3ver_id', 't3ver_label', 't3ver_wsid',
|
||||||
|
't3ver_state', 't3ver_stage', 't3ver_count', 't3ver_tstamp',
|
||||||
|
't3ver_move_id', 't3ver_swapmode',
|
||||||
|
$this->tca['ctrl']['transOrigDiffSourceField'],
|
||||||
|
$this->tca['ctrl']['cruser_id'],
|
||||||
|
$this->tca['ctrl']['fe_cruser_id'],
|
||||||
|
$this->tca['ctrl']['fe_crgroup_id'],
|
||||||
|
$this->tca['ctrl']['origUid'],
|
||||||
|
];
|
||||||
|
|
||||||
|
return in_array($columnName, $systemFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function isUserField(string $columnName) : bool
|
||||||
|
{
|
||||||
|
$config = $this->getColumnConfig($columnName);
|
||||||
|
return isset($config['type']) && $config['type'] === 'user';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function isPassthroughField(string $columnName) : bool
|
||||||
|
{
|
||||||
|
$config = $this->getColumnConfig($columnName);
|
||||||
|
return isset($config['type']) && $config['type'] === 'passthrough';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function getColumnConfig(string $columnName) : array
|
||||||
|
{
|
||||||
|
if (!isset($this->tca['columns'][$columnName])) {
|
||||||
|
throw new InvalidArgumentException(
|
||||||
|
'Column does not exist.',
|
||||||
|
InvalidArgumentException::COLUMN_DOES_NOT_EXIST
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->tca['columns'][$columnName]['config'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given record was blacklisted by root line.
|
||||||
|
* This can be configured by typoscript as whole root lines can be black listed.
|
||||||
|
*
|
||||||
|
* Also further TYPO3 mechanics are taken into account. Does a valid root
|
||||||
|
* line exist, is page inside a recycler, is inherited start- endtime
|
||||||
|
* excluded, etc.
|
||||||
|
*/
|
||||||
|
protected function isRecordBlacklistedByRootline(array &$record) : bool
|
||||||
|
{
|
||||||
|
$pageUid = $record['pid'];
|
||||||
|
if ($this->tableName === 'pages') {
|
||||||
|
$pageUid = $record['uid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$rootline = $this->objectManager->get(RootlineUtility::class, $pageUid)->get();
|
||||||
|
} catch (\RuntimeException $e) {
|
||||||
|
$this->logger->notice(
|
||||||
|
sprintf('Could not fetch rootline for page %u, because: %s', $pageUid, $e->getMessage()),
|
||||||
|
[$record, $e]
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($rootline as $pageInRootLine) {
|
||||||
|
// Check configured black list if present.
|
||||||
|
if ($this->isBlackListedRootLineConfigured()
|
||||||
|
&& in_array($pageInRootLine['uid'], $this->getBlackListedRootLine())
|
||||||
|
) {
|
||||||
|
$this->logger->info(
|
||||||
|
sprintf(
|
||||||
|
'Record %u is black listed due to configured root line configuration of page %u.',
|
||||||
|
$record['uid'],
|
||||||
|
$pageInRootLine['uid']
|
||||||
|
),
|
||||||
|
[$record, $pageInRootLine]
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pageInRootLine['extendToSubpages'] && (
|
||||||
|
($pageInRootLine['endtime'] > 0 && $pageInRootLine['endtime'] <= time())
|
||||||
|
|| ($pageInRootLine['starttime'] > 0 && $pageInRootLine['starttime'] >= time())
|
||||||
|
)) {
|
||||||
|
$this->logger->info(
|
||||||
|
sprintf(
|
||||||
|
'Record %u is black listed due to configured timing of parent page %u.',
|
||||||
|
$record['uid'],
|
||||||
|
$pageInRootLine['uid']
|
||||||
|
),
|
||||||
|
[$record, $pageInRootLine]
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether any page uids are black listed.
|
||||||
|
*/
|
||||||
|
protected function isBlackListedRootLineConfigured() : bool
|
||||||
|
{
|
||||||
|
return (bool) $this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of black listed root line page uids.
|
||||||
|
*
|
||||||
|
* @return array<Int>
|
||||||
|
*/
|
||||||
|
protected function getBlackListedRootLine() : array
|
||||||
|
{
|
||||||
|
return GeneralUtility::intExplode(
|
||||||
|
',',
|
||||||
|
$this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getConnection() : \TYPO3\CMS\Core\Database\DatabaseConnection
|
||||||
|
{
|
||||||
|
return $GLOBALS['TYPO3_DB'];
|
||||||
|
}
|
||||||
|
}
|
44
Classes/Domain/Index/TcaIndexer/TcaTableServiceInterface.php
Normal file
44
Classes/Domain/Index/TcaIndexer/TcaTableServiceInterface.php
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
namespace Codappix\SearchCore\Domain\Index\TcaIndexer;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface TcaTableServiceInterface
|
||||||
|
{
|
||||||
|
public function getTableName() : string;
|
||||||
|
|
||||||
|
public function getTableClause() : string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the given records by root line blacklist settings.
|
||||||
|
*/
|
||||||
|
public function filterRecordsByRootLineBlacklist(array &$records);
|
||||||
|
|
||||||
|
public function prepareRecord(array &$record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function getColumnConfig(string $columnName) : array;
|
||||||
|
|
||||||
|
public function getRecords(int $offset, int $limit) : array;
|
||||||
|
|
||||||
|
public function getRecord(int $identifier) : array;
|
||||||
|
}
|
|
@ -87,6 +87,9 @@ class SearchRequest implements SearchRequestInterface
|
||||||
return $this->query;
|
return $this->query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $filter
|
||||||
|
*/
|
||||||
public function setFilter(array $filter)
|
public function setFilter(array $filter)
|
||||||
{
|
{
|
||||||
$filter = \TYPO3\CMS\Core\Utility\ArrayUtility::removeArrayEntryByValue($filter, '');
|
$filter = \TYPO3\CMS\Core\Utility\ArrayUtility::removeArrayEntryByValue($filter, '');
|
||||||
|
|
|
@ -136,6 +136,7 @@ class QueryFactory
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($boostQueryParts)) {
|
||||||
$query = ArrayUtility::arrayMergeRecursiveOverrule($query, [
|
$query = ArrayUtility::arrayMergeRecursiveOverrule($query, [
|
||||||
'query' => [
|
'query' => [
|
||||||
'bool' => [
|
'bool' => [
|
||||||
|
@ -144,6 +145,7 @@ class QueryFactory
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function addFactorBoost(array &$query)
|
protected function addFactorBoost(array &$query)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ Then setup your system::
|
||||||
|
|
||||||
git clone git@github.com:codappix/search_core.git \
|
git clone git@github.com:codappix/search_core.git \
|
||||||
&& cd search_core \
|
&& cd search_core \
|
||||||
&& export typo3DatabaseName="searchcoretest76" \
|
&& export typo3DatabaseName="searchcoretest87" \
|
||||||
&& export TYPO3_VERSION="~8.7" \
|
&& export TYPO3_VERSION="~8.7" \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& make unitTests \
|
&& make unitTests \
|
||||||
|
@ -41,8 +41,8 @@ If all tests are okay, start your work.
|
||||||
If you are working with multiple TYPO3 versions make sure to export `typo3DatabaseName` and
|
If you are working with multiple TYPO3 versions make sure to export `typo3DatabaseName` and
|
||||||
`TYPO3_VERSION` in your environment like::
|
`TYPO3_VERSION` in your environment like::
|
||||||
|
|
||||||
export typo3DatabaseName="searchcoretest62"
|
export typo3DatabaseName="searchcoretest76"
|
||||||
export TYPO3_VERSION="~6.2"
|
export TYPO3_VERSION="~7.6"
|
||||||
|
|
||||||
Also run the install command for each version before running any tests. Only this will make sure you
|
Also run the install command for each version before running any tests. Only this will make sure you
|
||||||
are testing against the actual TYPO3 Version and database scheme.
|
are testing against the actual TYPO3 Version and database scheme.
|
||||||
|
|
13
Makefile
13
Makefile
|
@ -5,14 +5,23 @@ TYPO3_WEB_DIR := $(current_dir).Build/web
|
||||||
TYPO3_PATH_ROOT := $(current_dir).Build/web
|
TYPO3_PATH_ROOT := $(current_dir).Build/web
|
||||||
# Allow different versions on travis
|
# Allow different versions on travis
|
||||||
TYPO3_VERSION ?= ~8.7
|
TYPO3_VERSION ?= ~8.7
|
||||||
typo3DatabaseName ?= "searchcore_test2"
|
typo3DatabaseName ?= "searchcore_test"
|
||||||
typo3DatabaseUsername ?= "dev"
|
typo3DatabaseUsername ?= "dev"
|
||||||
typo3DatabasePassword ?= "dev"
|
typo3DatabasePassword ?= "dev"
|
||||||
typo3DatabaseHost ?= "127.0.0.1"
|
typo3DatabaseHost ?= "127.0.0.1"
|
||||||
|
|
||||||
|
sourceOrDist=--prefer-dist
|
||||||
|
ifeq ($(TYPO3_VERSION),~7.6)
|
||||||
|
sourceOrDist=--prefer-source
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: clean
|
install: clean
|
||||||
COMPOSER_PROCESS_TIMEOUT=1000 composer require -vv --dev --prefer-dist typo3/cms="$(TYPO3_VERSION)"
|
if [ $(TYPO3_VERSION) = ~7.6 ]; then \
|
||||||
|
patch composer.json Tests/InstallPatches/composer.json.patch; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMPOSER_PROCESS_TIMEOUT=1000 composer require -vv --dev $(sourceOrDist) typo3/cms="$(TYPO3_VERSION)"
|
||||||
git checkout composer.json
|
git checkout composer.json
|
||||||
|
|
||||||
cgl:
|
cgl:
|
||||||
|
|
|
@ -66,4 +66,9 @@ abstract class AbstractFunctionalTestCase extends CoreTestCase
|
||||||
{
|
{
|
||||||
return ['EXT:search_core/Tests/Functional/Fixtures/BasicSetup.ts'];
|
return ['EXT:search_core/Tests/Functional/Fixtures/BasicSetup.ts'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function isLegacyVersion() : bool
|
||||||
|
{
|
||||||
|
return \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 8000000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
9
Tests/Functional/Bootstrap.php
Normal file
9
Tests/Functional/Bootstrap.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$filePath = '.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php';
|
||||||
|
|
||||||
|
if (getenv('TYPO3_VERSION') === '~7.6') {
|
||||||
|
$filePath = '.Build/vendor/typo3/cms/typo3/sysext/core/Build/FunctionalTestsBootstrap.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once dirname(dirname(__DIR__)) . '/' . $filePath;
|
|
@ -55,7 +55,7 @@ class FilterTest extends AbstractFunctionalTestCase
|
||||||
|
|
||||||
$searchRequest->setFilter(['CType' => 'HTML']);
|
$searchRequest->setFilter(['CType' => 'HTML']);
|
||||||
$result = $searchService->search($searchRequest);
|
$result = $searchService->search($searchRequest);
|
||||||
$this->assertSame(5, $result->getResults()[0]['uid'], 'Did not get the expected result entry.');
|
$this->assertSame(5, (int) $result->getResults()[0]['uid'], 'Did not get the expected result entry.');
|
||||||
$this->assertSame(1, count($result), 'Did not receive the single filtered element.');
|
$this->assertSame(1, count($result), 'Did not receive the single filtered element.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,12 +220,17 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
|
||||||
$response = $this->client->request('typo3content/_search?q=*:*');
|
$response = $this->client->request('typo3content/_search?q=*:*');
|
||||||
$this->assertSame($response->getData()['hits']['total'], 2, 'Not exactly 2 documents were indexed.');
|
$this->assertSame($response->getData()['hits']['total'], 2, 'Not exactly 2 documents were indexed.');
|
||||||
|
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
$this->getDatabaseConnection()
|
||||||
|
->exec_UPDATEquery('tt_content', 'uid = 10', ['hidden' => 1]);
|
||||||
|
} else {
|
||||||
$this->getConnectionPool()->getConnectionForTable('tt_content')
|
$this->getConnectionPool()->getConnectionForTable('tt_content')
|
||||||
->update(
|
->update(
|
||||||
'tt_content',
|
'tt_content',
|
||||||
['hidden' => true],
|
['hidden' => true],
|
||||||
['uid' => 10]
|
['uid' => 10]
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
|
||||||
->get(IndexerFactory::class)
|
->get(IndexerFactory::class)
|
||||||
|
|
|
@ -20,9 +20,10 @@ namespace Codappix\SearchCore\Tests\Functional\DataProcessing;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\SearchCore\Compatibility\TypoScriptService76;
|
||||||
|
use Codappix\SearchCore\Compatibility\TypoScriptService;
|
||||||
use Codappix\SearchCore\DataProcessing\ContentObjectDataProcessorAdapterProcessor;
|
use Codappix\SearchCore\DataProcessing\ContentObjectDataProcessorAdapterProcessor;
|
||||||
use Codappix\SearchCore\Tests\Functional\AbstractFunctionalTestCase;
|
use Codappix\SearchCore\Tests\Functional\AbstractFunctionalTestCase;
|
||||||
use TYPO3\CMS\Extbase\Service\TypoScriptService;
|
|
||||||
use TYPO3\CMS\Frontend\DataProcessing\SplitProcessor;
|
use TYPO3\CMS\Frontend\DataProcessing\SplitProcessor;
|
||||||
|
|
||||||
class ContentObjectDataProcessorAdapterProcessorTest extends AbstractFunctionalTestCase
|
class ContentObjectDataProcessorAdapterProcessorTest extends AbstractFunctionalTestCase
|
||||||
|
@ -44,7 +45,13 @@ class ContentObjectDataProcessorAdapterProcessorTest extends AbstractFunctionalT
|
||||||
'new_content' => ['value1', 'value2'],
|
'new_content' => ['value1', 'value2'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$subject = new ContentObjectDataProcessorAdapterProcessor(new TypoScriptService);
|
if ($this->isLegacyVersion()) {
|
||||||
|
$typoScriptService = new TypoScriptService76();
|
||||||
|
} else {
|
||||||
|
$typoScriptService = new TypoScriptService();
|
||||||
|
}
|
||||||
|
|
||||||
|
$subject = new ContentObjectDataProcessorAdapterProcessor($typoScriptService);
|
||||||
$processedData = $subject->processData($record, $configuration);
|
$processedData = $subject->processData($record, $configuration);
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
$expectedData,
|
$expectedData,
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<dataset>
|
||||||
|
<tt_content>
|
||||||
|
<uid>1</uid>
|
||||||
|
<pid>1</pid>
|
||||||
|
<tstamp>1480686370</tstamp>
|
||||||
|
<crdate>1480686370</crdate>
|
||||||
|
<hidden>0</hidden>
|
||||||
|
<sorting>72</sorting>
|
||||||
|
<sys_language_uid>2</sys_language_uid>
|
||||||
|
<CType>header</CType>
|
||||||
|
<header>indexed content element</header>
|
||||||
|
<bodytext>this is the content of header content element that should get indexed</bodytext>
|
||||||
|
<media>0</media>
|
||||||
|
<layout>0</layout>
|
||||||
|
<deleted>0</deleted>
|
||||||
|
<cols>0</cols>
|
||||||
|
<starttime>0</starttime>
|
||||||
|
<endtime>0</endtime>
|
||||||
|
<colPos>0</colPos>
|
||||||
|
<filelink_sorting>0</filelink_sorting>
|
||||||
|
</tt_content>
|
||||||
|
</dataset>
|
|
@ -1,8 +1,7 @@
|
||||||
<phpunit
|
<phpunit
|
||||||
backupGlobals="true"
|
backupGlobals="true"
|
||||||
backupStaticAttributes="false"
|
backupStaticAttributes="false"
|
||||||
bootstrap="../../.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
|
bootstrap="Bootstrap.php"
|
||||||
|
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="false"
|
convertErrorsToExceptions="false"
|
||||||
convertWarningsToExceptions="false"
|
convertWarningsToExceptions="false"
|
||||||
|
|
|
@ -50,7 +50,11 @@ class NonAllowedTablesTest extends AbstractDataHandlerTest
|
||||||
$this->subject->expects($this->exactly(1))
|
$this->subject->expects($this->exactly(1))
|
||||||
->method('update')
|
->method('update')
|
||||||
->with('pages', $this->callback(function (array $record) {
|
->with('pages', $this->callback(function (array $record) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($record['uid']) && $record['uid'] === '1';
|
||||||
|
} else {
|
||||||
return isset($record['uid']) && $record['uid'] === 1;
|
return isset($record['uid']) && $record['uid'] === 1;
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
|
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
|
||||||
|
@ -73,7 +77,11 @@ class NonAllowedTablesTest extends AbstractDataHandlerTest
|
||||||
$this->subject->expects($this->exactly(1))
|
$this->subject->expects($this->exactly(1))
|
||||||
->method('update')
|
->method('update')
|
||||||
->with('pages', $this->callback(function (array $record) {
|
->with('pages', $this->callback(function (array $record) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($record['uid']) && $record['uid'] === '1';
|
||||||
|
} else {
|
||||||
return isset($record['uid']) && $record['uid'] === 1;
|
return isset($record['uid']) && $record['uid'] === 1;
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
|
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
|
||||||
|
@ -96,7 +104,11 @@ class NonAllowedTablesTest extends AbstractDataHandlerTest
|
||||||
$this->subject->expects($this->exactly(1))
|
$this->subject->expects($this->exactly(1))
|
||||||
->method('update')
|
->method('update')
|
||||||
->with('pages', $this->callback(function (array $record) {
|
->with('pages', $this->callback(function (array $record) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($record['uid']) && $record['uid'] === '1';
|
||||||
|
} else {
|
||||||
return isset($record['uid']) && $record['uid'] === 1;
|
return isset($record['uid']) && $record['uid'] === 1;
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
|
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
|
||||||
|
|
|
@ -53,7 +53,11 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
|
||||||
$this->subject->expects($this->exactly(1))
|
$this->subject->expects($this->exactly(1))
|
||||||
->method('update')
|
->method('update')
|
||||||
->with('pages', $this->callback(function (array $record) {
|
->with('pages', $this->callback(function (array $record) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($record['uid']) && $record['uid'] === '1';
|
||||||
|
} else {
|
||||||
return isset($record['uid']) && $record['uid'] === 1;
|
return isset($record['uid']) && $record['uid'] === 1;
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
|
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
|
||||||
|
@ -78,6 +82,13 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
|
||||||
[
|
[
|
||||||
$this->equalTo('tt_content'),
|
$this->equalTo('tt_content'),
|
||||||
$this->callback(function ($record) {
|
$this->callback(function ($record) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($record['uid']) && $record['uid'] === '1'
|
||||||
|
&& isset($record['pid']) && $record['pid'] === '1'
|
||||||
|
&& isset($record['colPos']) && $record['colPos'] === '1'
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
return isset($record['uid']) && $record['uid'] === 1
|
return isset($record['uid']) && $record['uid'] === 1
|
||||||
&& isset($record['pid']) && $record['pid'] === 1
|
&& isset($record['pid']) && $record['pid'] === 1
|
||||||
&& isset($record['colPos']) && $record['colPos'] === 1
|
&& isset($record['colPos']) && $record['colPos'] === 1
|
||||||
|
@ -87,7 +98,11 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
|
||||||
[
|
[
|
||||||
$this->equalTo('pages'),
|
$this->equalTo('pages'),
|
||||||
$this->callback(function ($record) {
|
$this->callback(function ($record) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($record['uid']) && $record['uid'] === '1';
|
||||||
|
} else {
|
||||||
return isset($record['uid']) && $record['uid'] === 1;
|
return isset($record['uid']) && $record['uid'] === 1;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -114,6 +129,13 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
|
||||||
[
|
[
|
||||||
$this->equalTo('tt_content'),
|
$this->equalTo('tt_content'),
|
||||||
$this->callback(function ($record) {
|
$this->callback(function ($record) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($record['uid']) && $record['uid'] === '2'
|
||||||
|
&& isset($record['pid']) && $record['pid'] === '1'
|
||||||
|
&& isset($record['header']) && $record['header'] === 'a new record'
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
return isset($record['uid']) && $record['uid'] === 2
|
return isset($record['uid']) && $record['uid'] === 2
|
||||||
&& isset($record['pid']) && $record['pid'] === 1
|
&& isset($record['pid']) && $record['pid'] === 1
|
||||||
&& isset($record['header']) && $record['header'] === 'a new record'
|
&& isset($record['header']) && $record['header'] === 'a new record'
|
||||||
|
@ -123,7 +145,11 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
|
||||||
[
|
[
|
||||||
$this->equalTo('pages'),
|
$this->equalTo('pages'),
|
||||||
$this->callback(function ($record) {
|
$this->callback(function ($record) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($record['uid']) && $record['uid'] === '1';
|
||||||
|
} else {
|
||||||
return isset($record['uid']) && $record['uid'] === 1;
|
return isset($record['uid']) && $record['uid'] === 1;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,7 +24,7 @@ use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
||||||
use Codappix\SearchCore\Connection\Elasticsearch;
|
use Codappix\SearchCore\Connection\Elasticsearch;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer;
|
use Codappix\SearchCore\Domain\Index\TcaIndexer;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer\RelationResolver;
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\RelationResolver;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService;
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableServiceInterface;
|
||||||
use Codappix\SearchCore\Tests\Functional\AbstractFunctionalTestCase;
|
use Codappix\SearchCore\Tests\Functional\AbstractFunctionalTestCase;
|
||||||
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class TcaIndexerTest extends AbstractFunctionalTestCase
|
||||||
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class);
|
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class);
|
||||||
$tableName = 'tt_content';
|
$tableName = 'tt_content';
|
||||||
$tableService = $objectManager->get(
|
$tableService = $objectManager->get(
|
||||||
TcaTableService::class,
|
TcaTableServiceInterface::class,
|
||||||
$tableName,
|
$tableName,
|
||||||
$objectManager->get(RelationResolver::class),
|
$objectManager->get(RelationResolver::class),
|
||||||
$objectManager->get(ConfigurationContainerInterface::class)
|
$objectManager->get(ConfigurationContainerInterface::class)
|
||||||
|
@ -77,4 +77,40 @@ class TcaIndexerTest extends AbstractFunctionalTestCase
|
||||||
|
|
||||||
$objectManager->get(TcaIndexer::class, $tableService, $connection)->indexAllDocuments();
|
$objectManager->get(TcaIndexer::class, $tableService, $connection)->indexAllDocuments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function sysLanguageIsKept()
|
||||||
|
{
|
||||||
|
$this->importDataSet('Tests/Functional/Fixtures/Indexing/TcaIndexer/KeepSysLanguageUid.xml');
|
||||||
|
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class);
|
||||||
|
$tableName = 'tt_content';
|
||||||
|
$tableService = $objectManager->get(
|
||||||
|
TcaTableServiceInterface::class,
|
||||||
|
$tableName,
|
||||||
|
$objectManager->get(RelationResolver::class),
|
||||||
|
$objectManager->get(ConfigurationContainerInterface::class)
|
||||||
|
);
|
||||||
|
|
||||||
|
$connection = $this->getMockBuilder(Elasticsearch::class)
|
||||||
|
->setMethods(['addDocuments'])
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
|
||||||
|
$connection->expects($this->once())
|
||||||
|
->method('addDocuments')
|
||||||
|
->with(
|
||||||
|
$this->stringContains('tt_content'),
|
||||||
|
$this->callback(function ($documents) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($documents[0]['sys_language_uid']) && $documents[0]['sys_language_uid'] === '2';
|
||||||
|
} else {
|
||||||
|
return isset($documents[0]['sys_language_uid']) && $documents[0]['sys_language_uid'] === 2;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
$objectManager->get(TcaIndexer::class, $tableService, $connection)->indexAllDocuments();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
14
Tests/InstallPatches/composer.json.patch
Normal file
14
Tests/InstallPatches/composer.json.patch
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
diff --git a/composer.json b/composer.json
|
||||||
|
index 83e5f47..e9fa296 100644
|
||||||
|
--- a/composer.json
|
||||||
|
+++ b/composer.json
|
||||||
|
@@ -21,8 +21,7 @@
|
||||||
|
"ruflin/elastica": "~3.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
- "phpunit/phpunit": "~6.4.4",
|
||||||
|
- "typo3/testing-framework": "~1.1.5",
|
||||||
|
+ "phpunit/phpunit": "~5.7.0",
|
||||||
|
"squizlabs/php_codesniffer": "~3.1.1"
|
||||||
|
},
|
||||||
|
"config": {
|
|
@ -95,4 +95,9 @@ abstract class AbstractUnitTestCase extends CoreTestCase
|
||||||
->willReturn($translationService);
|
->willReturn($translationService);
|
||||||
GeneralUtility::setSingletonInstance(ObjectManager::class, $objectManager);
|
GeneralUtility::setSingletonInstance(ObjectManager::class, $objectManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function isLegacyVersion() : bool
|
||||||
|
{
|
||||||
|
return \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 8000000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
9
Tests/Unit/Bootstrap.php
Normal file
9
Tests/Unit/Bootstrap.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$filePath = '.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsBootstrap.php';
|
||||||
|
|
||||||
|
if (getenv('TYPO3_VERSION') === '~7.6') {
|
||||||
|
$filePath = '.Build/vendor/typo3/cms/typo3/sysext/core/Build/UnitTestsBootstrap.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once dirname(dirname(__DIR__)) . '/' . $filePath;
|
|
@ -38,6 +38,7 @@ class IndexFactoryTest extends AbstractUnitTestCase
|
||||||
|
|
||||||
$this->configuration = $this->getMockBuilder(ConfigurationContainerInterface::class)->getMock();
|
$this->configuration = $this->getMockBuilder(ConfigurationContainerInterface::class)->getMock();
|
||||||
$this->subject = new IndexFactory($this->configuration);
|
$this->subject = new IndexFactory($this->configuration);
|
||||||
|
$this->subject->injectLogger($this->getMockedLogger());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,8 +23,10 @@ namespace Codappix\SearchCore\Tests\Unit\Domain\Index\TcaIndexer;
|
||||||
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
||||||
use Codappix\SearchCore\DataProcessing\CopyToProcessor;
|
use Codappix\SearchCore\DataProcessing\CopyToProcessor;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer\RelationResolver;
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\RelationResolver;
|
||||||
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService76;
|
||||||
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService;
|
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService;
|
||||||
use Codappix\SearchCore\Tests\Unit\AbstractUnitTestCase;
|
use Codappix\SearchCore\Tests\Unit\AbstractUnitTestCase;
|
||||||
|
use TYPO3\CMS\Core\Database\DatabaseConnection;
|
||||||
|
|
||||||
class TcaTableServiceTest extends AbstractUnitTestCase
|
class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
{
|
{
|
||||||
|
@ -38,16 +40,30 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
*/
|
*/
|
||||||
protected $configuration;
|
protected $configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var DatabaseConnection
|
||||||
|
*/
|
||||||
|
protected $databaseConnection;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->configuration = $this->getMockBuilder(ConfigurationContainerInterface::class)->getMock();
|
$this->configuration = $this->getMockBuilder(ConfigurationContainerInterface::class)->getMock();
|
||||||
|
$this->databaseConnection = $this->getMockBuilder(DatabaseConnection::class)->getMock();
|
||||||
|
|
||||||
$this->subject = $this->getMockBuilder(TcaTableService::class)
|
$className = TcaTableService::class;
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
$className = TcaTableService76::class;
|
||||||
|
}
|
||||||
|
$this->subject = $this->getMockBuilder($className)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->setMethodsExcept(['getWhereClause', 'injectLogger', 'getTableName'])
|
->setMethods(['getConnection', 'getSystemWhereClause'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
$this->subject->expects($this->any())
|
||||||
|
->method('getConnection')
|
||||||
|
->willReturn($this->databaseConnection);
|
||||||
|
|
||||||
$this->inject($this->subject, 'configuration', $this->configuration);
|
$this->inject($this->subject, 'configuration', $this->configuration);
|
||||||
$this->inject($this->subject, 'logger', $this->getMockedLogger());
|
$this->inject($this->subject, 'logger', $this->getMockedLogger());
|
||||||
$this->inject($this->subject, 'tableName', 'table');
|
$this->inject($this->subject, 'tableName', 'table');
|
||||||
|
@ -58,6 +74,7 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
*/
|
*/
|
||||||
public function doUsePlainQueryIfNoAdditionalWhereClauseIsDefined()
|
public function doUsePlainQueryIfNoAdditionalWhereClauseIsDefined()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('We have to migrate this test for TYPO3 CMS 8.x');
|
||||||
$this->configuration->expects($this->exactly(2))
|
$this->configuration->expects($this->exactly(2))
|
||||||
->method('getIfExists')
|
->method('getIfExists')
|
||||||
->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist'])
|
->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist'])
|
||||||
|
@ -66,7 +83,6 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
->method('getSystemWhereClause')
|
->method('getSystemWhereClause')
|
||||||
->will($this->returnValue('1=1 AND pages.no_search = 0'));
|
->will($this->returnValue('1=1 AND pages.no_search = 0'));
|
||||||
|
|
||||||
$whereClause = $this->subject->getWhereClause();
|
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
'1=1 AND pages.no_search = 0',
|
'1=1 AND pages.no_search = 0',
|
||||||
$whereClause->getStatement()
|
$whereClause->getStatement()
|
||||||
|
@ -82,14 +98,18 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
*/
|
*/
|
||||||
public function configuredAdditionalWhereClauseIsAdded()
|
public function configuredAdditionalWhereClauseIsAdded()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('We have to migrate this test for TYPO3 CMS 8.x');
|
||||||
$this->configuration->expects($this->exactly(2))
|
$this->configuration->expects($this->exactly(2))
|
||||||
->method('getIfExists')
|
->method('getIfExists')
|
||||||
->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist'])
|
->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist'])
|
||||||
->will($this->onConsecutiveCalls('table.field = "someValue"', false));
|
->will($this->onConsecutiveCalls('table.field = "someValue"', false));
|
||||||
|
|
||||||
$this->subject->expects($this->once())
|
$this->subject->expects($this->once())
|
||||||
->method('getSystemWhereClause')
|
->method('getSystemWhereClause')
|
||||||
->will($this->returnValue('1=1 AND pages.no_search = 0'));
|
->will($this->returnValue('1=1 AND pages.no_search = 0'));
|
||||||
|
|
||||||
|
$this->subject->getRecord(10);
|
||||||
|
|
||||||
$whereClause = $this->subject->getWhereClause();
|
$whereClause = $this->subject->getWhereClause();
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
'1=1 AND pages.no_search = 0 AND table.field = "someValue"',
|
'1=1 AND pages.no_search = 0 AND table.field = "someValue"',
|
||||||
|
@ -106,6 +126,7 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
*/
|
*/
|
||||||
public function allConfiguredAndAllowedTcaColumnsAreReturnedAsFields()
|
public function allConfiguredAndAllowedTcaColumnsAreReturnedAsFields()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('We have to migrate this test');
|
||||||
$GLOBALS['TCA']['test_table'] = [
|
$GLOBALS['TCA']['test_table'] = [
|
||||||
'ctrl' => [
|
'ctrl' => [
|
||||||
'languageField' => 'sys_language_uid',
|
'languageField' => 'sys_language_uid',
|
||||||
|
|
|
@ -61,6 +61,7 @@ class DataHandlerFinisherTest extends AbstractUnitTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
* @requires function \TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher::setOptions
|
||||||
* @dataProvider possibleFinisherSetup
|
* @dataProvider possibleFinisherSetup
|
||||||
*/
|
*/
|
||||||
public function validConfiguration(string $action, array $nonCalledActions, $expectedSecondArgument)
|
public function validConfiguration(string $action, array $nonCalledActions, $expectedSecondArgument)
|
||||||
|
@ -98,6 +99,7 @@ class DataHandlerFinisherTest extends AbstractUnitTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
* @requires function \TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher::setOptions
|
||||||
* @dataProvider invalidFinisherSetup
|
* @dataProvider invalidFinisherSetup
|
||||||
*/
|
*/
|
||||||
public function nothingHappensIfUnknownActionIsConfigured(array $options)
|
public function nothingHappensIfUnknownActionIsConfigured(array $options)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<phpunit
|
<phpunit
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
backupStaticAttributes="false"
|
backupStaticAttributes="false"
|
||||||
bootstrap="../../.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsBootstrap.php"
|
bootstrap="Bootstrap.php"
|
||||||
|
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="false"
|
convertErrorsToExceptions="false"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.0.0",
|
"php": ">=7.0.0",
|
||||||
"typo3/cms": "~8.7",
|
"typo3/cms": ">= 7.6.0 < 9.0.0",
|
||||||
"ruflin/elastica": "~3.2"
|
"ruflin/elastica": "~3.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|
|
@ -7,8 +7,8 @@ $EM_CONF[$_EXTKEY] = [
|
||||||
'clearCacheOnLoad' => 1,
|
'clearCacheOnLoad' => 1,
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
'depends' => [
|
'depends' => [
|
||||||
'typo3' => '8.7.0-8.7.99',
|
'typo3' => '7.6.0-8.7.99',
|
||||||
'php' => '7.1.0-7.99.99'
|
'php' => '7.0.0-7.2.99'
|
||||||
],
|
],
|
||||||
'conflicts' => [],
|
'conflicts' => [],
|
||||||
],
|
],
|
||||||
|
@ -18,7 +18,7 @@ $EM_CONF[$_EXTKEY] = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'state' => 'beta',
|
'state' => 'beta',
|
||||||
'version' => '1.0.0',
|
'version' => '0.0.1',
|
||||||
'author' => 'Daniel Siepmann',
|
'author' => 'Daniel Siepmann',
|
||||||
'author_email' => 'coding@daniel-siepmann.de',
|
'author_email' => 'coding@daniel-siepmann.de',
|
||||||
];
|
];
|
||||||
|
|
|
@ -40,6 +40,8 @@ call_user_func(
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
\Codappix\SearchCore\Compatibility\ImplementationRegistrationService::registerImplementations();
|
||||||
|
|
||||||
// API does make use of object manager, therefore use GLOBALS
|
// API does make use of object manager, therefore use GLOBALS
|
||||||
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]);
|
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]);
|
||||||
if ($extensionConfiguration === false
|
if ($extensionConfiguration === false
|
||||||
|
|
Loading…
Reference in a new issue