Commit 1cd9ea6e authored by Benni Mack's avatar Benni Mack Committed by Wouter Wolters
Browse files

[TASK] Move file-related entrypoints to Backend Routing

Resolves: #69018
Releases: master
Change-Id: I8d5ab1243d342b2153b30e4f0e9bba17ed8035a0
Reviewed-on: http://review.typo3.org/42554


Reviewed-by: Manuel Selbach's avatarManuel Selbach <manuel_selbach@yahoo.de>
Tested-by: Manuel Selbach's avatarManuel Selbach <manuel_selbach@yahoo.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent 9c431cd6
......@@ -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
......@@ -249,12 +252,28 @@ class CreateFolderController {
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
* 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;
}
......
......@@ -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.
......@@ -208,12 +211,28 @@ class EditFileController {
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
* 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;
}
......
......@@ -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
......@@ -176,12 +179,28 @@ class FileUploadController {
return $content;
}
/**
* 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;
}
......
......@@ -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:
/**
......@@ -170,12 +173,28 @@ class RenameFileController {
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
* 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;
}
......
......@@ -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
......@@ -201,12 +204,28 @@ class ReplaceFileController {
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
* 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;
}
......
......@@ -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;
......
......@@ -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
<?php
$MCONF['name'] = 'file_edit';
$MCONF['script'] = '_DISPATCH';
$MCONF['access'] = '';
\ No newline at end of file
<?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
<?php
$MCONF['name'] = 'file_newfolder';
$MCONF['script'] = '_DISPATCH';
$MCONF['access'] = '';
\ No newline at end of file
<?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
<?php
// Required for mod.php
$MCONF['name'] = 'file_rename';
$MCONF['script'] = '_DISPATCH';
$MCONF['access'] = '';
<?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
<?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
<?php
//required for mod.php
$MCONF['name'] = 'file_upload';
$MCONF['script'] = '_DISPATCH';
$MCONF['access'] = '';
\ No newline at end of file
<?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
......@@ -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',
......
Supports Markdown
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