From 57a4e34eb9e12c3a17e754745959c7ea4f8431f3 Mon Sep 17 00:00:00 2001 From: Philipp Dieter Date: Wed, 22 Sep 2021 13:15:20 +0200 Subject: [PATCH] [TASK] Cleanup configuration handling --- Classes/Controller/ActionController.php | 8 +++-- Classes/Traits/DependencyInjectionTrait.php | 39 ++------------------- 2 files changed, 8 insertions(+), 39 deletions(-) diff --git a/Classes/Controller/ActionController.php b/Classes/Controller/ActionController.php index 3ecafa6..ed5070d 100644 --- a/Classes/Controller/ActionController.php +++ b/Classes/Controller/ActionController.php @@ -204,9 +204,11 @@ class ActionController extends BaseController */ public function initializeAction() { - $this->config = GeneralUtility::removeDotsFromTS( - $GLOBALS['TSFE']->config['config'] - ); + if ($GLOBALS['TSFE']->config['config']) { + $this->config = GeneralUtility::removeDotsFromTS( + $GLOBALS['TSFE']->config['config'] + ); + } $this->pageType = GeneralUtility::_GP('type'); if (!is_numeric($this->pageType)) { $this->pageType = 0; diff --git a/Classes/Traits/DependencyInjectionTrait.php b/Classes/Traits/DependencyInjectionTrait.php index a9ad822..27dbbc8 100644 --- a/Classes/Traits/DependencyInjectionTrait.php +++ b/Classes/Traits/DependencyInjectionTrait.php @@ -19,18 +19,12 @@ use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Reflection\ClassSchema; use TYPO3\CMS\Extbase\Reflection\ReflectionService; -use TYPO3\CMS\Frontend\Utility\EidUtility; /** * ValidationTrait */ trait DependencyInjectionTrait { - /* - * extension Key - */ - protected $extensionKey = null; - /* * storagePids */ @@ -86,13 +80,9 @@ trait DependencyInjectionTrait $this->objectManager = GeneralUtility::makeInstance( ObjectManager::class ); - $this->initFrontendController(); $this->configurationManager = $this->objectManager->get( ConfigurationManagerInterface::class ); - $this->configurationManager->setConfiguration( - array() - ); $this->apiUtility = $this->objectManager->get( ApiUtility::class ); @@ -100,7 +90,9 @@ trait DependencyInjectionTrait ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, $this->getExtensionKey() ); - $this->configurationManager->setConfiguration($frameworkConfiguration); + $this->configurationManager->setConfiguration( + $frameworkConfiguration + ); $this->settings = $frameworkConfiguration; $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(); - } - }