[TASK] Cleanup configuration handling

This commit is contained in:
Philipp Dieter 2021-09-22 13:15:20 +02:00
parent 7c1dae9b5d
commit 57a4e34eb9
2 changed files with 8 additions and 39 deletions

View File

@ -204,9 +204,11 @@ class ActionController extends BaseController
*/ */
public function initializeAction() public function initializeAction()
{ {
$this->config = GeneralUtility::removeDotsFromTS( if ($GLOBALS['TSFE']->config['config']) {
$GLOBALS['TSFE']->config['config'] $this->config = GeneralUtility::removeDotsFromTS(
); $GLOBALS['TSFE']->config['config']
);
}
$this->pageType = GeneralUtility::_GP('type'); $this->pageType = GeneralUtility::_GP('type');
if (!is_numeric($this->pageType)) { if (!is_numeric($this->pageType)) {
$this->pageType = 0; $this->pageType = 0;

View File

@ -19,18 +19,12 @@ use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Reflection\ClassSchema; use TYPO3\CMS\Extbase\Reflection\ClassSchema;
use TYPO3\CMS\Extbase\Reflection\ReflectionService; use TYPO3\CMS\Extbase\Reflection\ReflectionService;
use TYPO3\CMS\Frontend\Utility\EidUtility;
/** /**
* ValidationTrait * ValidationTrait
*/ */
trait DependencyInjectionTrait trait DependencyInjectionTrait
{ {
/*
* extension Key
*/
protected $extensionKey = null;
/* /*
* storagePids * storagePids
*/ */
@ -86,13 +80,9 @@ trait DependencyInjectionTrait
$this->objectManager = GeneralUtility::makeInstance( $this->objectManager = GeneralUtility::makeInstance(
ObjectManager::class ObjectManager::class
); );
$this->initFrontendController();
$this->configurationManager = $this->objectManager->get( $this->configurationManager = $this->objectManager->get(
ConfigurationManagerInterface::class ConfigurationManagerInterface::class
); );
$this->configurationManager->setConfiguration(
array()
);
$this->apiUtility = $this->objectManager->get( $this->apiUtility = $this->objectManager->get(
ApiUtility::class ApiUtility::class
); );
@ -100,7 +90,9 @@ trait DependencyInjectionTrait
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK,
$this->getExtensionKey() $this->getExtensionKey()
); );
$this->configurationManager->setConfiguration($frameworkConfiguration); $this->configurationManager->setConfiguration(
$frameworkConfiguration
);
$this->settings = $frameworkConfiguration; $this->settings = $frameworkConfiguration;
$this->storagePids = explode( $this->storagePids = explode(
',', ',',
@ -126,29 +118,4 @@ trait DependencyInjectionTrait
} }
} }
/**
* Initialize frontentController
*
* @return void
*/
private function initFrontendController()
{
$currentDomain = strtok(GeneralUtility::getIndpEnv('HTTP_HOST'), ':');
$frontendController = GeneralUtility::makeInstance(
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class,
$GLOBALS['TYPO3_CONF_VARS'],
null,
0,
true
);
$GLOBALS['TSFE'] = $frontendController;
$frontendController->connectToDB();
$frontendController->fe_user = EidUtility::initFeUser();
$frontendController->id = $result[0]['pid'];
$frontendController->determineId();
$frontendController->initTemplate();
$frontendController->getConfigArray();
EidUtility::initTCA();
}
} }