Skip to content

Commit

Permalink
Merge pull request #14 from xima-media/avoid-ext-registration
Browse files Browse the repository at this point in the history
feat: do not load module in production
  • Loading branch information
maikschneider authored Sep 3, 2023
2 parents 2e09199 + 8a06844 commit 56f31b7
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions ext_tables.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<?php

$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$iconRegistry->registerIcon(
'module-mailcatcher',
\TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
['source' => 'EXT:xima_typo3_mailcatcher/Resources/Public/Icons/Extension.svg']
);
if (isset($GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport']) && $GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] === 'mbox') {
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$iconRegistry->registerIcon(
'module-mailcatcher',
\TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
['source' => 'EXT:xima_typo3_mailcatcher/Resources/Public/Icons/Extension.svg']
);

$versionNumberUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\VersionNumberUtility::class);
$version = $versionNumberUtility->convertVersionStringToArray($versionNumberUtility->getNumericTypo3Version());
$versionNumberUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\VersionNumberUtility::class);
$version = $versionNumberUtility->convertVersionStringToArray($versionNumberUtility->getNumericTypo3Version());

$controllerName = \Xima\XimaTypo3Mailcatcher\Controller\LegacyBackendController::class;
if ($version['version_main'] >= 11) {
$controllerName = \Xima\XimaTypo3Mailcatcher\Controller\BackendController::class;
}
$controllerName = \Xima\XimaTypo3Mailcatcher\Controller\LegacyBackendController::class;
if ($version['version_main'] >= 11) {
$controllerName = \Xima\XimaTypo3Mailcatcher\Controller\BackendController::class;
}

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'XimaTypo3Mailcatcher',
'system',
'mails',
'',
[
$controllerName => 'index',
],
[
'access' => 'admin',
'iconIdentifier' => 'module-mailcatcher',
'labels' => 'LLL:EXT:xima_typo3_mailcatcher/Resources/Private/Language/locallang_mod.xlf',
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'XimaTypo3Mailcatcher',
'system',
'mails',
'',
[
$controllerName => 'index',
],
[
'access' => 'admin',
'iconIdentifier' => 'module-mailcatcher',
'labels' => 'LLL:EXT:xima_typo3_mailcatcher/Resources/Private/Language/locallang_mod.xlf',
]
);
}

0 comments on commit 56f31b7

Please sign in to comment.