[TASK] Move file-related entrypoints to Backend Routing 54/42554/3
authorBenjamin Mack <benni@typo3.org>
Thu, 13 Aug 2015 06:36:57 +0000 (08:36 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 13 Aug 2015 13:09:49 +0000 (15:09 +0200)
Resolves: #69018
Releases: master
Change-Id: I8d5ab1243d342b2153b30e4f0e9bba17ed8035a0
Reviewed-on: http://review.typo3.org/42554
Reviewed-by: Manuel Selbach <manuel_selbach@yahoo.de>
Tested-by: Manuel Selbach <manuel_selbach@yahoo.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
17 files changed:
typo3/sysext/backend/Classes/Controller/File/CreateFolderController.php
typo3/sysext/backend/Classes/Controller/File/EditFileController.php
typo3/sysext/backend/Classes/Controller/File/FileUploadController.php
typo3/sysext/backend/Classes/Controller/File/RenameFileController.php
typo3/sysext/backend/Classes/Controller/File/ReplaceFileController.php
typo3/sysext/backend/Classes/Controller/LogoutController.php
typo3/sysext/backend/Configuration/Backend/Routes.php
typo3/sysext/backend/Modules/File/Edit/conf.php [deleted file]
typo3/sysext/backend/Modules/File/Edit/index.php [deleted file]
typo3/sysext/backend/Modules/File/Newfolder/conf.php [deleted file]
typo3/sysext/backend/Modules/File/Newfolder/index.php [deleted file]
typo3/sysext/backend/Modules/File/Rename/conf.php [deleted file]
typo3/sysext/backend/Modules/File/Rename/index.php [deleted file]
typo3/sysext/backend/Modules/File/Replace/index.php [deleted file]
typo3/sysext/backend/Modules/File/Upload/conf.php [deleted file]
typo3/sysext/backend/Modules/File/Upload/index.php [deleted file]
typo3/sysext/backend/ext_tables.php

index 456ce55..74cfe92 100644 (file)
@@ -16,11 +16,14 @@ namespace TYPO3\CMS\Backend\Controller\File;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Core\Http\Response;
 
 /**
  * Script Class for the create-new script; Displays a form for creating up to 10 folders or one new text file
  */
-class CreateFolderController {
+class CreateFolderController implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        /**
         * @var int
@@ -250,11 +253,27 @@ class CreateFolderController {
        }
 
        /**
+        * Processes the request, currently everything is handled and put together via "main()"
+        *
+        * @param ServerRequestInterface $request The request object
+        * @return ResponseInterface $response The response, created by the controller
+        */
+       public function processRequest(ServerRequestInterface $request) {
+               $this->main();
+               /** @var Response $response */
+               $response = GeneralUtility::makeInstance(Response::class);
+               $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, use the processRequest() method instead
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
index c25701b..53d7e8e 100644 (file)
@@ -19,11 +19,14 @@ use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Core\Http\Response;
 
 /**
  * Script Class for rendering the file editing screen
  */
-class EditFileController {
+class EditFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        /**
         * Module content accumulated.
@@ -209,11 +212,27 @@ class EditFileController {
        }
 
        /**
+        * Processes the request, currently everything is handled and put together via "main()"
+        *
+        * @param ServerRequestInterface $request The request object
+        * @return ResponseInterface $response The response, created by the controller
+        */
+       public function processRequest(ServerRequestInterface $request) {
+               $this->main();
+               /** @var Response $response */
+               $response = GeneralUtility::makeInstance(Response::class);
+               $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, use the processRequest() method instead
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
index 9af113d..61ad2c5 100644 (file)
@@ -16,11 +16,14 @@ namespace TYPO3\CMS\Backend\Controller\File;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Core\Http\Response;
 
 /**
  * Script Class for display up to 10 upload fields
  */
-class FileUploadController {
+class FileUploadController implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        /**
         * Document template object
@@ -177,11 +180,27 @@ class FileUploadController {
        }
 
        /**
+        * Processes the request, currently everything is handled and put together via "main()"
+        *
+        * @param ServerRequestInterface $request The request object
+        * @return ResponseInterface $response The response, created by the controller
+        */
+       public function processRequest(ServerRequestInterface $request) {
+               $this->main();
+               /** @var Response $response */
+               $response = GeneralUtility::makeInstance(Response::class);
+               $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, use the processRequest() method instead
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
index a913f25..145eb02 100644 (file)
@@ -16,11 +16,14 @@ namespace TYPO3\CMS\Backend\Controller\File;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Core\Http\Response;
 
 /**
  * Script Class for the rename-file form.
  */
-class RenameFileController {
+class RenameFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        // Internal, static:
        /**
@@ -171,11 +174,27 @@ class RenameFileController {
        }
 
        /**
+        * Processes the request, currently everything is handled and put together via "main()"
+        *
+        * @param ServerRequestInterface $request The request object
+        * @return ResponseInterface $response The response, created by the controller
+        */
+       public function processRequest(ServerRequestInterface $request) {
+               $this->main();
+               /** @var Response $response */
+               $response = GeneralUtility::makeInstance(Response::class);
+               $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, use the processRequest() method instead
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
index ad40508..96f82cc 100644 (file)
@@ -22,11 +22,14 @@ use TYPO3\CMS\Core\Resource\Folder;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Core\Http\Response;
 
 /**
  * Script Class for the rename-file form
  */
-class ReplaceFileController {
+class ReplaceFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        /**
         * Document template object
@@ -202,11 +205,27 @@ class ReplaceFileController {
        }
 
        /**
+        * Processes the request, currently everything is handled and put together via "main()"
+        *
+        * @param ServerRequestInterface $request The request object
+        * @return ResponseInterface $response The response, created by the controller
+        */
+       public function processRequest(ServerRequestInterface $request) {
+               $this->main();
+               /** @var Response $response */
+               $response = GeneralUtility::makeInstance(Response::class);
+               $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, use the processRequest() method instead
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
index 3e1fa10..de86d3c 100644 (file)
@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Controller;
 
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
-use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Http\Response;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
index be5a19e..6aa6607 100644 (file)
@@ -35,7 +35,7 @@ return [
 
        // Register backend_layout wizard
        'wizard_backend_layout' => [
-               'path' => '/wizard/backendlayout',
+               'path' => '/wizard/backend_layout',
                'controller' => \TYPO3\CMS\Backend\Controller\BackendLayoutWizardController::class
        ],
 
@@ -74,4 +74,35 @@ return [
                'path' => '/wizard/edit',
                'controller' => \TYPO3\CMS\Backend\Controller\Wizard\EditController::class
        ],
-];
+
+       /** File- and folder-related routes */
+       // Editing the contents of a file
+       'file_edit' => [
+               'path' => '/file/editcontent',
+               'controller' => \TYPO3\CMS\Backend\Controller\File\EditFileController::class
+       ],
+
+       // Create a new folder
+       'file_newfolder' => [
+               'path' => '/file/new',
+               'controller' => \TYPO3\CMS\Backend\Controller\File\CreateFolderController::class
+       ],
+
+       // Rename a file
+       'file_rename' => [
+               'path' => '/file/rename',
+               'controller' => \TYPO3\CMS\Backend\Controller\File\RenameFileController::class
+       ],
+
+       // Replace a file with a different one
+       'file_replace' => [
+               'path' => '/file/replace',
+               'controller' => \TYPO3\CMS\Backend\Controller\File\ReplaceFileController::class
+       ],
+
+       // Upload new files
+       'file_upload' => [
+               'path' => '/file/upload',
+               'controller' => \TYPO3\CMS\Backend\Controller\File\FileUploadController::class
+       ],
+];
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Edit/conf.php b/typo3/sysext/backend/Modules/File/Edit/conf.php
deleted file mode 100644 (file)
index ecf1390..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-$MCONF['name'] = 'file_edit';
-$MCONF['script'] = '_DISPATCH';
-$MCONF['access'] = '';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Edit/index.php b/typo3/sysext/backend/Modules/File/Edit/index.php
deleted file mode 100644 (file)
index 9af6dbd..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!
- */
-
-$editFileController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\File\EditFileController::class);
-$editFileController->main();
-$editFileController->printContent();
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Newfolder/conf.php b/typo3/sysext/backend/Modules/File/Newfolder/conf.php
deleted file mode 100644 (file)
index 1ce8517..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-$MCONF['name'] = 'file_newfolder';
-$MCONF['script'] = '_DISPATCH';
-$MCONF['access'] = '';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Newfolder/index.php b/typo3/sysext/backend/Modules/File/Newfolder/index.php
deleted file mode 100644 (file)
index 5889b12..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!
- */
-
-$createFolderController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\File\CreateFolderController::class);
-$createFolderController->main();
-$createFolderController->printContent();
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Rename/conf.php b/typo3/sysext/backend/Modules/File/Rename/conf.php
deleted file mode 100644 (file)
index d9940af..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-// Required for mod.php
-$MCONF['name'] = 'file_rename';
-$MCONF['script'] = '_DISPATCH';
-$MCONF['access'] = '';
diff --git a/typo3/sysext/backend/Modules/File/Rename/index.php b/typo3/sysext/backend/Modules/File/Rename/index.php
deleted file mode 100644 (file)
index cc15b1e..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!
- */
-
-$renameFileController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\File\RenameFileController::class);
-$renameFileController->main();
-$renameFileController->printContent();
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Replace/index.php b/typo3/sysext/backend/Modules/File/Replace/index.php
deleted file mode 100644 (file)
index fcaeb76..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!
- */
-
-$renameFileController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Backend\Controller\File\ReplaceFileController::class);
-$renameFileController->main();
-$renameFileController->printContent();
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Upload/conf.php b/typo3/sysext/backend/Modules/File/Upload/conf.php
deleted file mode 100644 (file)
index 5be50e9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-//required for mod.php
-$MCONF['name'] = 'file_upload';
-$MCONF['script'] = '_DISPATCH';
-$MCONF['access'] = '';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Upload/index.php b/typo3/sysext/backend/Modules/File/Upload/index.php
deleted file mode 100644 (file)
index 02fd7d8..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!
- */
-
-$fileUploadController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\File\FileUploadController::class);
-$fileUploadController->main();
-$fileUploadController->printContent();
\ No newline at end of file
index a23dd61..4ad12b9 100644 (file)
@@ -28,35 +28,6 @@ if (TYPO3_MODE === 'BE') {
                'EXT:backend/Modules/FileSystemNavigationFrame/'
        );
 
-       // Register file_edit
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'file_edit',
-               'EXT:backend/Modules/File/Edit/'
-       );
-
-       // Register file_newfolder
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'file_newfolder',
-               'EXT:backend/Modules/File/Newfolder/'
-       );
-
-       // Register file_rename
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'file_rename',
-               'EXT:backend/Modules/File/Rename/'
-       );
-
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'file_replace',
-               'EXT:backend/Modules/File/Replace/'
-       );
-
-       // Register file_rename
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'file_upload',
-               'EXT:backend/Modules/File/Upload/'
-       );
-
        // Register tce_db
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
                'tce_db',