Skip to content
Snippets Groups Projects
Commit 7a5752ac authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Benni Mack
Browse files

[BUGFIX] Re-determine first start module if configuration is invalid

This patch fixes two flaws with the determination and loading of the
first available backend module:

* ModuleLoader::getModuleSetupInformation() only sets default options if
  the configuration array is not empty
* The availability of the module is checked. If the configured module
  doesn't exist, the first available module is determined again.

Resolves: #91210
Releases: master
Change-Id: Idae8de6e0bf253754c4d44e50b15e81038e1315f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64309


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Daniel Siepmann's avatarDaniel Siepmann <coding@daniel-siepmann.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: Daniel Siepmann's avatarDaniel Siepmann <coding@daniel-siepmann.de>
Reviewed-by: default avatarJosef Glatz <josefglatz@gmail.com>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent 07280a4f
Branches
Tags
No related merge requests found
...@@ -93,6 +93,11 @@ class BackendController ...@@ -93,6 +93,11 @@ class BackendController
*/ */
protected $moduleStorage; protected $moduleStorage;
/**
* @var ModuleLoader
*/
protected $moduleLoader;
/** /**
* Constructor * Constructor
*/ */
...@@ -104,6 +109,10 @@ class BackendController ...@@ -104,6 +109,10 @@ class BackendController
$this->uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $this->uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$this->typo3Version = GeneralUtility::makeInstance(Typo3Version::class); $this->typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
$this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$this->moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class);
$this->moduleLoader->observeWorkspaces = true;
$this->moduleLoader->load($GLOBALS['TBE_MODULES']);
// Add default BE javascript // Add default BE javascript
$this->pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/md5.js'); $this->pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/md5.js');
$this->pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/backend.js'); $this->pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/backend.js');
...@@ -451,7 +460,7 @@ class BackendController ...@@ -451,7 +460,7 @@ class BackendController
$startModule = $beUser->uc['startModuleOnFirstLogin']; $startModule = $beUser->uc['startModuleOnFirstLogin'];
unset($beUser->uc['startModuleOnFirstLogin']); unset($beUser->uc['startModuleOnFirstLogin']);
$beUser->writeUC(); $beUser->writeUC();
} elseif ($beUser->uc['startModule']) { } elseif ($this->moduleLoader->checkMod($beUser->uc['startModule']) !== 'notFound') {
$startModule = $beUser->uc['startModule']; $startModule = $beUser->uc['startModule'];
} else { } else {
$startModule = $this->determineFirstAvailableBackendModule(); $startModule = $this->determineFirstAvailableBackendModule();
...@@ -481,11 +490,7 @@ class BackendController ...@@ -481,11 +490,7 @@ class BackendController
protected function determineFirstAvailableBackendModule(): string protected function determineFirstAvailableBackendModule(): string
{ {
$loadModules = GeneralUtility::makeInstance(ModuleLoader::class); foreach ($this->moduleLoader->modules as $mainMod => $modData) {
$loadModules->observeWorkspaces = true;
$loadModules->load($GLOBALS['TBE_MODULES']);
foreach ($loadModules->modules as $mainMod => $modData) {
$hasSubmodules = !empty($modData['sub']) && is_array($modData['sub']); $hasSubmodules = !empty($modData['sub']) && is_array($modData['sub']);
$isStandalone = $modData['standalone'] ?? false; $isStandalone = $modData['standalone'] ?? false;
if ($isStandalone) { if ($isStandalone) {
......
...@@ -226,7 +226,7 @@ class ModuleLoader ...@@ -226,7 +226,7 @@ class ModuleLoader
} }
// Add some default configuration // Add some default configuration
if (!isset($moduleSetupInformation['configuration']['inheritNavigationComponentFromMainModule'])) { if ($moduleSetupInformation['configuration'] !== [] && !isset($moduleSetupInformation['configuration']['inheritNavigationComponentFromMainModule'])) {
$moduleSetupInformation['configuration']['inheritNavigationComponentFromMainModule'] = true; $moduleSetupInformation['configuration']['inheritNavigationComponentFromMainModule'] = true;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment