[BUGFIX] Fix log module bootstrap 16/58516/5
authorSusanne Moog <susanne.moog@typo3.org>
Mon, 1 Oct 2018 09:31:34 +0000 (11:31 +0200)
committerBenni Mack <benni@typo3.org>
Mon, 1 Oct 2018 13:47:25 +0000 (15:47 +0200)
Resolves: #86498
Releases: master
Change-Id: I8605215706406a0a7826a1fe401ccd11d46ead73
Reviewed-on: https://review.typo3.org/58516
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/belog/Classes/Module/BackendLogModuleBootstrap.php
typo3/sysext/info/Classes/Controller/InfoModuleController.php

index 8a5d2af..174b743 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Belog\Module;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Core\Bootstrap;
 
@@ -35,19 +36,21 @@ class BackendLogModuleBootstrap
      */
     public function main()
     {
-        $configuration = [
+        $_GET['tx_belog_system_beloglog']['pageId'] = GeneralUtility::_GP('id');
+        $_GET['tx_belog_system_beloglog']['layout'] = 'Plain';
+        $serverRequest = $GLOBALS['TYPO3_REQUEST'] ?? null;
+        if ($serverRequest instanceof ServerRequestInterface) {
+            $GLOBALS['TYPO3_REQUEST'] = $serverRequest->withQueryParams($_GET);
+        }
+        $options['moduleConfiguration'] = [
             'extensionName' => 'Belog',
-            'pluginName' => 'system_BelogLog',
             'vendorName' => 'TYPO3\\CMS',
         ];
-        // Yeah, this is ugly. But currently, there is no other direct way
-        // in extbase to force a specific controller in backend mode.
-        // Overwriting $_GET was the most simple solution here until extbase
-        // provides a clean way to solve this.
-        $_GET['tx_belog_system_beloglog']['controller'] = 'BackendLog';
-        $_GET['tx_belog_system_beloglog']['pageId'] = GeneralUtility::_GP('id');
-        $_GET['tx_belog_system_beloglog']['layout'] = 'Plain';
+        $options['moduleName'] = 'system_BelogLog';
+
+        $route = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\Route::class, '/system/BelogLog/', $options);
+        $serverRequest = $serverRequest->withAttribute('route', $route);
         $extbaseBootstrap = GeneralUtility::makeInstance(Bootstrap::class);
-        return $extbaseBootstrap->run('', $configuration);
+        return $extbaseBootstrap->handleBackendRequest($serverRequest);
     }
 }
index 6f44a25..b6321ef 100644 (file)
@@ -549,7 +549,13 @@ class InfoModuleController
             $defaultFlashMessageQueue->enqueue($flashMessage);
         } else {
             if (is_callable([$this->extObj, 'main'])) {
-                $this->content .= $this->extObj->main();
+                $main = $this->extObj->main();
+                if ($main instanceof ResponseInterface) {
+                    $stream = $main->getBody();
+                    $stream->rewind();
+                    $main = $stream->getContents();
+                }
+                $this->content .= $main;
             }
         }
     }