Skip to content
Snippets Groups Projects
Commit 08fb1712 authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn
Browse files

[BUGFIX] Add fake TS setup in admin panel for fluid

With #100759, f:translate has been changed to use the
extbase LocalizationUtility in all scopes. This
triggers the ConfigurationManager, which fetches
TypoScript setup from the Request attribute.

But TS setup is never set in fully cached page content
scenarios and there is usually no Fluid view triggered
in this scope.

The admin panel however renders in "fully cached" as
well, which then fails when trying to fetch TS setup.

We *do* want extbase to fail in this scenario, since
TS is important for extbase configuration and it needs
to rely on TS setup being set in Frontend.

The patch thus works around the issue in admin panel
directly. The situation should resolve later again,
when work on LocalizationUtility finished.

Resolves: #102638
Related: #100759
Releases: main, 12.4
Change-Id: I5cf8af6593f37299e71b8555b79bf05c0e5e9c09
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82396


Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82788
parent 7852f1ad
Branches
Tags
No related merge requests found
......@@ -82,6 +82,27 @@ class MainController
{
$resources = ResourceUtility::getResources(['nonce' => $this->requestId->nonce]);
$backupRequest = null;
$frontendTypoScript = $request->getAttribute('frontend.typoscript');
if (!$frontendTypoScript->hasSetup()) {
// @todo: This is a hack: The admin panel is the only extension that starts
// a Fluid view in 'fully cached' scenarios. f:translate() now triggers
// the extbase configuration manager in FE, which fetches TS setup from
// the Request attribute, which is *usally* always available, *except*
// in fully cached scenarios.
// See https://review.typo3.org/c/Packages/TYPO3.CMS/+/80732
// We still want extbase to crash if it tries to fetch TS setup when it
// is not set, so we work around this in the admin panel here.
// This should later be resolved by avoiding the dependency to extbase
// LocalizationUtility again, when core localization services can do
// similar things in FE as well.
$frontendTypoScript = clone $frontendTypoScript;
$frontendTypoScript->setSetupArray([]);
$request = $request->withAttribute('frontend.typoscript', $frontendTypoScript);
$backupRequest = $GLOBALS['TYPO3_REQUEST'];
$GLOBALS['TYPO3_REQUEST'] = $request;
}
$view = GeneralUtility::makeInstance(StandaloneView::class);
$templateNameAndPath = 'EXT:adminpanel/Resources/Private/Templates/Main.html';
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateNameAndPath));
......@@ -148,7 +169,11 @@ class MainController
]
);
}
return $view->render();
$result = $view->render();
if ($backupRequest) {
$GLOBALS['TYPO3_REQUEST'] = $backupRequest;
}
return $result;
}
/**
......
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