From 172d90841cfed3248d05978c99985f64390d985c Mon Sep 17 00:00:00 2001 From: Torsten Oppermann <torsten@sgalinski.de> Date: Mon, 17 Sep 2018 12:53:21 +0200 Subject: [PATCH] [TASK] Working on automatic registration refactoring --- Classes/XClass/Form/FormEditorController.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Classes/XClass/Form/FormEditorController.php b/Classes/XClass/Form/FormEditorController.php index 25e95417..5331d901 100644 --- a/Classes/XClass/Form/FormEditorController.php +++ b/Classes/XClass/Form/FormEditorController.php @@ -135,11 +135,11 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll } } - // write the new Register.php file - $this->writeRegisterFile($renderables, $extensionKey, $templateKey); - // call register function in register service class $registrationService = GeneralUtility::makeInstance(RegisterService::class); + // write the new Register.php file and add it to the registrationFiles array in the RegisterService + $registerFilePath = $this->writeRegisterFile($renderables, $extensionKey, $templateKey); + $registrationService->register($registerFilePath); $registrationService->registerExtensions(); // clear caches @@ -152,8 +152,9 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll * @param array $renderables * @param string $extensionKey * @param string $templateKey + * @return string */ - private function writeRegisterFile(array $renderables, $extensionKey, $templateKey) { + private function writeRegisterFile(array $renderables, $extensionKey, $templateKey): string { // get the location where automatic registrations should be stored $configurationLocation = $this->getRegistrationPath(); @@ -163,8 +164,9 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll // create folder GeneralUtility::mkdir($registerFolder); + $hashPrefix = md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateKey . '.php'); $registerFile = GeneralUtility::getFileAbsFileName( - $registerFolder . '/' . $templateKey . '.php' + $registerFolder . '/' . $hashPrefix . '_' . $templateKey . '.php' ); // build the register array @@ -193,6 +195,8 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll } file_put_contents($registerFile, '<?php return ' . var_export($newRegisterArray, TRUE) . ';'); + + return $registerFile; } /** -- GitLab