Skip to content
Snippets Groups Projects
Commit 172d9084 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Working on automatic registration refactoring

parent 7d6ddcec
No related branches found
No related tags found
1 merge request!11Feature security update
......@@ -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;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment