[FEATURE] Allow PSR-7 dispatching for Backend modules 75/43375/9
authorBenjamin Mack <benni@typo3.org>
Wed, 16 Sep 2015 12:49:36 +0000 (14:49 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 18 Sep 2015 09:19:46 +0000 (11:19 +0200)
The newly introduced simple dispatcher handles the distribution
of all "traditional" modules through a new option called "routeTarget" when registering a module.

All existing core modules are moved to this new syntax, all left-over
index.php files within Modules/ directories are removed.

Resolves: #69918
Releases: master
Change-Id: I6200a5e0309454fd981c9f1fa277d948974a1fac
Reviewed-on: http://review.typo3.org/43375
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
35 files changed:
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php
typo3/sysext/backend/Classes/Module/ModuleLoader.php
typo3/sysext/backend/Modules/Layout/index.php [deleted file]
typo3/sysext/backend/ext_tables.php
typo3/sysext/core/Documentation/Changelog/master/Feature-69918-AddPSR-7-basedDispatchingForBackendModules.rst [new file with mode: 0644]
typo3/sysext/dbal/Classes/Controller/ModuleController.php
typo3/sysext/dbal/Modules/Dbal/index.php [deleted file]
typo3/sysext/dbal/ext_tables.php
typo3/sysext/func/Classes/Controller/PageFunctionsController.php
typo3/sysext/func/Modules/AdvancedFunctions/index.php [deleted file]
typo3/sysext/func/ext_tables.php
typo3/sysext/info/Classes/Controller/InfoModuleController.php
typo3/sysext/info/Modules/Info/index.php [deleted file]
typo3/sysext/info/ext_tables.php
typo3/sysext/lowlevel/Classes/View/ConfigurationView.php
typo3/sysext/lowlevel/Classes/View/DatabaseIntegrityView.php
typo3/sysext/lowlevel/Modules/Configuration/index.php [deleted file]
typo3/sysext/lowlevel/Modules/DatabaseIntegrity/index.php [deleted file]
typo3/sysext/lowlevel/ext_tables.php
typo3/sysext/recordlist/Classes/RecordList.php
typo3/sysext/recordlist/Modules/Recordlist/index.php [deleted file]
typo3/sysext/recordlist/ext_tables.php
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/scheduler/Modules/Scheduler/index.php [deleted file]
typo3/sysext/scheduler/ext_tables.php
typo3/sysext/setup/Classes/Controller/SetupModuleController.php
typo3/sysext/setup/Modules/Setup/index.php [deleted file]
typo3/sysext/setup/ext_tables.php
typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php
typo3/sysext/taskcenter/Modules/Taskcenter/index.php [deleted file]
typo3/sysext/taskcenter/ext_tables.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php
typo3/sysext/tstemplate/Modules/TsTemplate/index.php [deleted file]
typo3/sysext/tstemplate/ext_tables.php

index 78f6e7a..671d3e5 100755 (executable)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Backend\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Form\Exception\AccessDeniedException;
 use TYPO3\CMS\Backend\Form\FormDataCompiler;
 use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord;
@@ -490,6 +492,23 @@ class PageLayoutController {
        }
 
        /**
+        * Injects the request object for the current request or subrequest
+        * As this controller goes only through the main() method, it is rather simple for now
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+               $this->clearCache();
+               $this->main();
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
+       /**
         * Main function.
         * Creates some general objects and calls other functions for the main rendering of module content.
         *
@@ -1053,8 +1072,10 @@ class PageLayoutController {
         * Print accumulated content of module
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
index b4b3157..2ab213d 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Core\Core\Bootstrap;
 use TYPO3\CMS\Core\FormProtection\BackendFormProtection;
 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
 use TYPO3\CMS\Core\Exception;
+use TYPO3\CMS\Core\Http\Dispatcher;
 use TYPO3\CMS\Core\Http\RequestHandlerInterface;
 use TYPO3\CMS\Core\Http\Response;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -177,21 +178,31 @@ class BackendModuleRequestHandler implements RequestHandlerInterface {
                        }
                }
 
-               $configuration = array(
-                       'extensionName' => $moduleConfiguration['extensionName'],
-                       'pluginName' => $moduleName
-               );
-               if (isset($moduleConfiguration['vendorName'])) {
-                       $configuration['vendorName'] = $moduleConfiguration['vendorName'];
-               }
-
-               // Run Extbase
-               $bootstrap = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class);
-               $content = $bootstrap->run('', $configuration);
-
                /** @var Response $response */
                $response = GeneralUtility::makeInstance(Response::class);
-               $response->getBody()->write($content);
+
+               // Use Core Dispatching
+               if (isset($moduleConfiguration['routeTarget'])) {
+                       $dispatcher = GeneralUtility::makeInstance(Dispatcher::class);
+                       $this->request = $this->request->withAttribute('target', $moduleConfiguration['routeTarget']);
+                       $response = $dispatcher->dispatch($this->request, $response);
+               } else {
+                       // extbase module
+                       $configuration = array(
+                               'extensionName' => $moduleConfiguration['extensionName'],
+                               'pluginName' => $moduleName
+                       );
+                       if (isset($moduleConfiguration['vendorName'])) {
+                               $configuration['vendorName'] = $moduleConfiguration['vendorName'];
+                       }
+
+                       // Run Extbase
+                       $bootstrap = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class);
+                       $content = $bootstrap->run('', $configuration);
+
+                       $response->getBody()->write($content);
+               }
+
                return $response;
        }
 
index 27ec58e..a3b7947 100644 (file)
@@ -306,10 +306,11 @@ class ModuleLoader {
                }
 
                // Default script setup
-               if ($setupInformation['configuration']['script'] === '_DISPATCH') {
+               if ($setupInformation['configuration']['script'] === '_DISPATCH' || isset($setupInformation['configuration']['routeTarget'])) {
                        if ($setupInformation['configuration']['extbase']) {
                                $finalModuleConfiguration['script'] = BackendUtility::getModuleUrl('Tx_' . $name);
                        } else {
+                               // just go through BackendModuleRequestHandler where the routeTarget is resolved
                                $finalModuleConfiguration['script'] = BackendUtility::getModuleUrl($name);
                        }
                } elseif ($setupInformation['configuration']['script'] && file_exists($setupInformation['path'] . '/' . $setupInformation['configuration']['script'])) {
diff --git a/typo3/sysext/backend/Modules/Layout/index.php b/typo3/sysext/backend/Modules/Layout/index.php
deleted file mode 100644 (file)
index 0984af0..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\PageLayoutController::class);
-$GLOBALS['SOBE']->init();
-$GLOBALS['SOBE']->clearCache();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index 575872e..0925ecd 100644 (file)
@@ -7,9 +7,9 @@ if (TYPO3_MODE === 'BE') {
                'web',
                'layout',
                'top',
-               'EXT:backend/Modules/Layout/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Backend\Controller\PageLayoutController::class . '::mainAction',
                        'access' => 'user,group',
                        'name' => 'web_layout',
                        'labels' => array(
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-69918-AddPSR-7-basedDispatchingForBackendModules.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-69918-AddPSR-7-basedDispatchingForBackendModules.rst
new file mode 100644 (file)
index 0000000..3fd3a11
--- /dev/null
@@ -0,0 +1,34 @@
+=================================================================
+Feature: #69918 - Add PSR-7-based dispatching for Backend Modules
+=================================================================
+
+Description
+===========
+
+Built on the PSR-7 principle and the routing concepts, it is now possible to register backend modules which are dispatched to a callable string
+instead of pointing to an index.php file in EXT:myextension/Modules/MyModule/index.php.
+
+The method which is called, receives a PSR-compatible request and response object and must return a response object which is outputted to the
+browser.
+
+An example registration uses the option "routeTarget" to resolve the method to be called when rendering the module:
+
+.. code-block:: typoscript
+
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
+               'web',
+               'layout',
+               'top',
+               '',
+               array(
+                       'routeTarget' => \TYPO3\CMS\Backend\Controller\PageLayoutController::class . '::mainAction',
+                       'access' => 'user,group',
+                       'name' => 'web_layout',
+                       'labels' => array(
+                               'tabs_images' => array(
+                                       'tab' => 'EXT:backend/Resources/Public/Icons/module-page.svg',
+                               ),
+                               'll_ref' => 'LLL:EXT:backend/Resources/Private/Language/locallang_mod.xlf',
+                       ),
+               )
+       );
\ No newline at end of file
index 7c035d5..bd41307 100644 (file)
@@ -14,7 +14,10 @@ namespace TYPO3\CMS\Dbal\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Script class; Backend module for DBAL extension
@@ -72,9 +75,9 @@ class ModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                $languageService = $this->getLanguageService();
                $this->thisScript = BackendUtility::getModuleUrl($this->MCONF['name']);
                // Clean up settings:
-               $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SET'), $this->MCONF['name']);
+               $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name']);
                // Draw the header
-               $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
+               $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
                $this->doc->form = '<form action="" method="post">';
                // DBAL page title:
                $this->content .= $this->doc->startPage($languageService->getLL('title'));
@@ -104,19 +107,38 @@ class ModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
         * Prints out the module HTML
         *
         * @return string HTML output
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                $this->content .= $this->doc->endPage();
                echo $this->content;
        }
 
+
+       /**
+        * Injects the request object for the current request or subrequest
+        * As this controller goes only through the main() method, it is rather simple for now
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+               $this->main();
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
        /**
         * Displays a form to check DBAL SQL methods and parse raw SQL.
         *
         * @return string HTML output
         */
        protected function printSqlCheck() {
-               $input = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tx_dbal');
+               $input = GeneralUtility::_GP('tx_dbal');
                $out = '
                        <form name="sql_check" action="' . $this->thisScript . '" method="post" enctype="multipart/form-data">
                        <script type="text/javascript">
@@ -287,7 +309,7 @@ updateQryForm(\'' . $input['QUERY'] . '\');
         */
        protected function printCachedInfo() {
                // Get cmd:
-               if ((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cmd') === 'clear') {
+               if ((string)GeneralUtility::_GP('cmd') === 'clear') {
                        $GLOBALS['TYPO3_DB']->clearCachedFieldInfo();
                        $GLOBALS['TYPO3_DB']->cacheFieldInfo();
                }
@@ -367,7 +389,7 @@ updateQryForm(\'' . $input['QUERY'] . '\');
                // Disable debugging in any case...
                $GLOBALS['TYPO3_DB']->debug = FALSE;
                // Get cmd:
-               $cmd = (string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cmd');
+               $cmd = (string)GeneralUtility::_GP('cmd');
                switch ($cmd) {
                        case 'flush':
                                $res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog');
@@ -489,7 +511,7 @@ updateQryForm(\'' . $input['QUERY'] . '\');
                                break;
                        default:
                                // Look for request to view specific script exec:
-                               $specTime = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('specTime');
+                               $specTime = GeneralUtility::_GP('specTime');
                                if ($specTime) {
                                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('exec_time,errorFlag,table_join,serdata,query', 'tx_dbal_debuglog', 'tstamp=' . (int)$specTime);
                                        $tRows = array();
@@ -545,7 +567,7 @@ updateQryForm(\'' . $input['QUERY'] . '\');
                                        <a href="' . $this->thisScript . '">LOG</a> -
                                        <a href="' . $this->thisScript . '&amp;cmd=where">WHERE</a> -
 
-                                       <a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript()) . '" target="tx_debuglog">[New window]</a>
+                                       <a href="' . htmlspecialchars(GeneralUtility::linkThisScript()) . '" target="tx_debuglog">[New window]</a>
                                        <hr />
                ';
                return $menu . $outStr;
diff --git a/typo3/sysext/dbal/Modules/Dbal/index.php b/typo3/sysext/dbal/Modules/Dbal/index.php
deleted file mode 100644 (file)
index cb0b405..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Module 'DBAL Debug' for the 'dbal' extension.
- */
-
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Dbal\Controller\ModuleController::class);
-$GLOBALS['SOBE']->init();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index 0144f9c..0594bcd 100644 (file)
@@ -6,9 +6,9 @@ if (TYPO3_MODE === 'BE') {
                'tools',
                'txdbalM1',
                '',
-               'EXT:dbal/Modules/Dbal/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Dbal\Controller\ModuleController::class . '::mainAction',
                        'access' => 'admin',
                        'name' => 'tools_txdbalM1',
                        'labels' => array(
index 0b80d0b..8da3a45 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Func\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
@@ -65,6 +67,29 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
        }
 
        /**
+        * Injects the request object for the current request or subrequest
+        * Then checks for module functions that have hooked in, and renders menu etc.
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+
+               // Checking for first level external objects
+               $this->checkExtObj();
+
+               // Checking second level external objects
+               $this->checkSubExtObj();
+               $this->main();
+
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
+       /**
         * Initialize module header etc and call extObjContent function
         *
         * @return void
@@ -132,8 +157,10 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
         * Print module content (from $this->content)
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
diff --git a/typo3/sysext/func/Modules/AdvancedFunctions/index.php b/typo3/sysext/func/Modules/AdvancedFunctions/index.php
deleted file mode 100644 (file)
index 93c11d6..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Module: Advanced functions
- * Advanced Functions related to pages
- */
-
-/** @var $SOBE \TYPO3\CMS\Func\Controller\PageFunctionsController */
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Func\Controller\PageFunctionsController::class);
-$GLOBALS['SOBE']->init();
-
-// Checking for first level external objects
-$GLOBALS['SOBE']->checkExtObj();
-
-// Checking second level external objects
-$GLOBALS['SOBE']->checkSubExtObj();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index 339733b..0471a7b 100644 (file)
@@ -6,9 +6,9 @@ if (TYPO3_MODE === 'BE') {
                'web',
                'func',
                '',
-               'EXT:func/Modules/AdvancedFunctions/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Func\Controller\PageFunctionsController::class . '::mainAction',
                        'access' => 'user,group',
                        'name' => 'web_func',
                        'labels' => array(
index 1fa2bcc..f4d6774 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Info\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Module\BaseScriptClass;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
@@ -131,13 +133,39 @@ class InfoModuleController extends BaseScriptClass {
         * Print module content (from $this->content)
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                $this->content = $this->doc->insertStylesAndJS($this->content);
                echo $this->content;
        }
 
        /**
+        * Injects the request object for the current request or subrequest
+        * Then checks for module functions that have hooked in, and renders menu etc.
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+
+               // Checking for first level external objects
+               $this->checkExtObj();
+
+               // Checking second level external objects
+               $this->checkSubExtObj();
+               $this->main();
+
+               $this->content = $this->doc->insertStylesAndJS($this->content);
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
+       /**
         * Create the panel of buttons for submitting the form or otherwise perform operations.
         *
         * @return array All available buttons as an assoc. array
diff --git a/typo3/sysext/info/Modules/Info/index.php b/typo3/sysext/info/Modules/Info/index.php
deleted file mode 100644 (file)
index 8bd9544..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Module: Web>Info
- * Presents various page related information from extensions
- */
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Info\Controller\InfoModuleController::class);
-$GLOBALS['SOBE']->init();
-
-// Checking for first level external objects
-$GLOBALS['SOBE']->checkExtObj();
-
-// Checking second level external objects
-$GLOBALS['SOBE']->checkSubExtObj();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index fc55b5d..c34a778 100644 (file)
@@ -6,9 +6,9 @@ if (TYPO3_MODE === 'BE') {
                'web',
                'info',
                '',
-               'EXT:info/Modules/Info/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Info\Controller\InfoModuleController::class . '::mainAction',
                        'access' => 'user,group',
                        'name' => 'web_info',
                        'labels' => array(
index 1b2a52b..1ae76ba 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Lowlevel\View;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Module\BaseScriptClass;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
@@ -59,6 +61,7 @@ class ConfigurationView extends BaseScriptClass {
                $this->doc->setModuleTemplate('EXT:lowlevel/Resources/Private/Templates/config.html');
                $this->doc->form = '<form action="" method="post">';
                $this->doc->addStyleSheet('module', 'sysext/lowlevel/Resources/Public/Css/styles.css');
+               $this->doc->bodyTagId = 'ext-lowlevel-Modules-Configuration-index-php';
        }
 
        /**
@@ -203,12 +206,32 @@ class ConfigurationView extends BaseScriptClass {
                $this->content = $this->doc->render('Configuration', $this->content);
        }
 
+
+       /**
+        * Injects the request object for the current request or subrequest
+        * Simply calls main() and init() and outputs the content
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+               $this->main();
+
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
        /**
         * Print output to browser
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
index 53d5b88..df3aa75 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Lowlevel\View;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Module\BaseScriptClass;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\IconUtility;
@@ -211,12 +213,31 @@ class DatabaseIntegrityView extends BaseScriptClass {
         * Print content
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
        /**
+        * Injects the request object for the current request or subrequest
+        * Simply calls main() and init() and outputs the content
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+               $this->main();
+
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
+       /**
         * Create the panel of buttons for submitting the form or otherwise perform operations.
         *
         * @return array All available buttons as an assoc. array
diff --git a/typo3/sysext/lowlevel/Modules/Configuration/index.php b/typo3/sysext/lowlevel/Modules/Configuration/index.php
deleted file mode 100644 (file)
index 85f1268..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Module: Config
- *
- * This module lets you view the config variables around TYPO3.
- */
-
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Lowlevel\View\ConfigurationView::class);
-$GLOBALS['SOBE']->init();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
diff --git a/typo3/sysext/lowlevel/Modules/DatabaseIntegrity/index.php b/typo3/sysext/lowlevel/Modules/DatabaseIntegrity/index.php
deleted file mode 100644 (file)
index e197ad0..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Module: Database integrity check
- *
- * This module lets you check if all pages and the records relate properly to each other
- */
-
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Lowlevel\View\DatabaseIntegrityView::class);
-$GLOBALS['SOBE']->init();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index a425168..b6e53bc 100644 (file)
@@ -6,9 +6,9 @@ if (TYPO3_MODE === 'BE') {
                'system',
                'dbint',
                '',
-               'EXT:lowlevel/Modules/DatabaseIntegrity/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Lowlevel\View\DatabaseIntegrityView::class . '::mainAction',
                        'access' => 'admin',
                        'name' => 'system_dbint',
                        'workspaces' => 'online',
@@ -24,9 +24,9 @@ if (TYPO3_MODE === 'BE') {
                'system',
                'config',
                '',
-               'EXT:lowlevel/Modules/Configuration/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Lowlevel\View\ConfigurationView::class . '::mainAction',
                        'access' => 'admin',
                        'name' => 'system_config',
                        'workspaces' => 'online',
index baaa678..e0ae469 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Recordlist;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Clipboard\Clipboard;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
@@ -558,11 +560,32 @@ class RecordList {
        }
 
        /**
+        * Injects the request object for the current request or subrequest
+        * Simply calls main() and init() and outputs the content
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               BackendUtility::lockRecords();
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+               $this->clearCache();
+               $this->main();
+
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
+       /**
         * Outputting the accumulated content to screen
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
diff --git a/typo3/sysext/recordlist/Modules/Recordlist/index.php b/typo3/sysext/recordlist/Modules/Recordlist/index.php
deleted file mode 100644 (file)
index 189bd04..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Module: Web>List
- *
- * Listing database records from the tables configured in $GLOBALS['TCA'] as they are related to the current page or root.
- *
- * Notice: This module and Web>Page module has a special status since they
- * are NOT located in their actual module directories (fx. mod/web/list/) but in the
- * backend root directory. This has some historical and practical causes.
- */
-\TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();
-
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\RecordList::class);
-$GLOBALS['SOBE']->init();
-$GLOBALS['SOBE']->clearCache();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index 91e29be..24c0309 100644 (file)
@@ -6,9 +6,9 @@ if (TYPO3_MODE === 'BE') {
                'web',
                'list',
                '',
-               'EXT:recordlist/Modules/Recordlist/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Recordlist\RecordList::class . '::mainAction',
                        'access' => 'user,group',
                        'name' => 'web_list',
                        'labels' => array(
index 531df92..65104f0 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Scheduler\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Imaging\Icon;
@@ -264,11 +266,30 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
        }
 
        /**
+        * Injects the request object for the current request or subrequest
+        * Simply calls main() and init() and outputs the content
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+               $this->main();
+
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
+       /**
         * This method actually prints out the module's HTML content
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function render() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
diff --git a/typo3/sysext/scheduler/Modules/Scheduler/index.php b/typo3/sysext/scheduler/Modules/Scheduler/index.php
deleted file mode 100644 (file)
index e6e39eb..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Scheduler\Controller\SchedulerModuleController::class);
-$GLOBALS['SOBE']->init();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->render();
index bf6b399..c9fe780 100644 (file)
@@ -7,9 +7,9 @@ if (TYPO3_MODE === 'BE') {
                'system',
                'txschedulerM1',
                '',
-               'EXT:scheduler/Modules/Scheduler/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController::class . '::mainAction',
                        'access' => 'admin',
                        'name' => 'system_txschedulerM1',
                        'labels' => array(
index 4c68d1c..0c4ed47 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Setup\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Backend\Avatar\DefaultAvatarProvider;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
@@ -439,12 +441,34 @@ class SetupModuleController {
                $this->content = $this->doc->render($this->getLanguageService()->getLL('UserSettings'), $this->content);
        }
 
+
+       /**
+        * Injects the request object for the current request or subrequest
+        * Simply calls main() and init() and writes the content to the response
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->simulateUser();
+               $this->storeIncomingData();
+               $this->init();
+               $this->main();
+
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
        /**
         * Prints the content / ends page
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
diff --git a/typo3/sysext/setup/Modules/Setup/index.php b/typo3/sysext/setup/Modules/Setup/index.php
deleted file mode 100644 (file)
index e279a23..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Setup\Controller\SetupModuleController::class);
-$GLOBALS['SOBE']->simulateUser();
-$GLOBALS['SOBE']->storeIncomingData();
-$GLOBALS['SOBE']->init();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index 4498041..14c696f 100644 (file)
@@ -6,9 +6,9 @@ if (TYPO3_MODE === 'BE') {
                'user',
                'setup',
                'after:task',
-               'EXT:setup/Modules/Setup/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Setup\Controller\SetupModuleController::class . '::mainAction',
                        'access' => 'group,user',
                        'name' => 'user_setup',
                        'labels' => array(
index 9229e38..baa2a5b 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Taskcenter\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
@@ -76,6 +78,23 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                parent::menuConfig();
        }
 
+
+       /**
+        * Injects the request object for the current request or subrequest
+        * Simply calls main() and writes the content to the response
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->main();
+
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
        /**
         * Creates the module's content. In this case it rather acts as a kind of #
         * dispatcher redirecting requests to specific tasks.
diff --git a/typo3/sysext/taskcenter/Modules/Taskcenter/index.php b/typo3/sysext/taskcenter/Modules/Taskcenter/index.php
deleted file mode 100644 (file)
index a641733..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Taskcenter\Controller\TaskModuleController::class);
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index 165fa41..2448748 100644 (file)
@@ -6,9 +6,9 @@ if (TYPO3_MODE === 'BE') {
                'user',
                'task',
                'top',
-               'EXT:taskcenter/Modules/Taskcenter/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Taskcenter\Controller\TaskModuleController::class . '::mainAction',
                        'access' => 'group,user',
                        'name' => 'user_task',
                        'labels' => array(
index d5e26c7..446ae92 100755 (executable)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Tstemplate\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Module\BaseScriptClass;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Core\DataHandling\DataHandler;
@@ -251,12 +253,38 @@ class TypoScriptTemplateModuleController extends BaseScriptClass {
                $this->content = $this->doc->render('Template Tools', $this->content);
        }
 
+
+       /**
+        * Injects the request object for the current request or subrequest
+        * Then checks for module functions that have hooked in, and renders menu etc.
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+
+               // Checking for first level external objects
+               $this->checkExtObj();
+
+               $this->clearCache();
+               $this->main();
+
+               $this->content = $this->doc->insertStylesAndJS($this->content);
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
        /**
         * Print content
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
diff --git a/typo3/sysext/tstemplate/Modules/TsTemplate/index.php b/typo3/sysext/tstemplate/Modules/TsTemplate/index.php
deleted file mode 100644 (file)
index 4215698..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Tstemplate\Controller\TypoScriptTemplateModuleController::class);
-$GLOBALS['SOBE']->init();
-
-// Checking for first level external objects
-$GLOBALS['SOBE']->checkExtObj();
-$GLOBALS['SOBE']->clearCache();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index cc5dcc9..9562f6b 100644 (file)
@@ -6,9 +6,9 @@ if (TYPO3_MODE === 'BE') {
                'web',
                'ts',
                '',
-               'EXT:tstemplate/Modules/TsTemplate/',
+               '',
                array(
-                       'script' => '_DISPATCH',
+                       'routeTarget' => \TYPO3\CMS\Tstemplate\Controller\TypoScriptTemplateModuleController::class . '::mainAction',
                        'access' => 'admin',
                        'name' => 'web_ts',
                        'labels' => array(