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

[TASK] Fixing error with the caching and missing return values

parent afa78360
No related branches found
No related tags found
1 merge request!11Feature security update
......@@ -33,8 +33,6 @@ use SGalinski\SgMail\Domain\Repository\MailRepository;
use SGalinski\SgMail\Domain\Repository\TemplateRepository;
use Swift_Attachment;
use Swift_OutputByteStream;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Mail\MailMessage;
use TYPO3\CMS\Core\Resource\FileInterface;
use TYPO3\CMS\Core\Resource\ResourceFactory;
......
......@@ -63,7 +63,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
*/
public function register($pathToRegisterFile) {
if (file_exists($pathToRegisterFile)) {
$this->registerArray[] = [
$this->registrationFiles[] = [
'path' => $pathToRegisterFile
];
}
......@@ -99,14 +99,15 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
/**
* Read every registered file and create a registration entry in the registerArray if possible
* @return array
*/
public function registerExtensions() {
public function registerExtensions(): array {
// clear registerArray
$this->registerArray = [];
foreach ($this->registrationFiles as $registerFile) {
if (\is_file($registerFile)) {
$configArray = (include $registerFile);
if (\is_file($registerFile['path'])) {
$configArray = (include $registerFile['path']);
$extensionKey = $configArray['extension_key'];
$templateKey = $configArray['template_key'];
......@@ -120,6 +121,8 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
);
}
}
return $this->registerArray;
}
/**
......
......@@ -205,7 +205,7 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
$cacheManager = $objectManager->get(CacheManager::class);
/** @var FrontendInterface $cache */
$cache = $cacheManager->getCache(MailTemplateService::CACHE_NAME);
$cache = $cacheManager->getCache(RegisterService::CACHE_NAME);
/** @var FrontendInterface $cache */
$cache->flush();
}
......
......@@ -53,7 +53,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Form\Controller\FormEdi
];
// Cache registration
$cacheName = \SGalinski\SgMail\Service\MailTemplateService::CACHE_NAME;
$cacheName = \SGalinski\SgMail\Service\RegisterService::CACHE_NAME;
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$cacheName])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$cacheName] = [];
}
......
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