Navigation Menu

Skip to content

Commit

Permalink
[!!!][TASK] Remove deprecated code from various controllers
Browse files Browse the repository at this point in the history
Drop deprecated properties and methods from various
backend controllers.

Resolves: #87253
Releases: master
Change-Id: I7a4bf179bffbdce4843cabf0efaa08a7a813808b
Reviewed-on: https://review.typo3.org/59252
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
  • Loading branch information
lolli42 authored and georgringer committed Dec 21, 2018
1 parent 0de44b2 commit 33ed62b
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 295 deletions.
10 changes: 0 additions & 10 deletions typo3/sysext/backend/Classes/Controller/BackendController.php
Expand Up @@ -20,7 +20,6 @@
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Compatibility\PublicMethodDeprecationTrait;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
Expand All @@ -41,15 +40,6 @@
*/
class BackendController
{
use PublicMethodDeprecationTrait;

/**
* @var array
*/
private $deprecatedPublicMethods = [
'render' => 'Using BackendController::render() is deprecated and will not be possible anymore in TYPO3 v10.0.',
];

/**
* @var string
*/
Expand Down
Expand Up @@ -22,7 +22,6 @@
use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Compatibility\PublicPropertyDeprecationTrait;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Http\JsonResponse;
use TYPO3\CMS\Core\Imaging\Icon;
Expand All @@ -38,20 +37,6 @@
*/
class FileSystemNavigationFrameController
{
use PublicPropertyDeprecationTrait;

/**
* Properties which have been moved to protected status from public
*
* @var array
*/
protected $deprecatedPublicProperties = [
'content' => 'Using $content of class FileSystemNavigationFrameController from the outside is discouraged, as this variable is only used for internal storage.',
'foldertree' => 'Using $foldertree of class FileSystemNavigationFrameController from the outside is discouraged, as this variable is only used for internal storage.',
'currentSubScript' => 'Using $currentSubScript of class FileSystemNavigationFrameController from the outside is discouraged, as this variable is only used for internal storage.',
'cMR' => 'Using $cMR of class FileSystemNavigationFrameController from the outside is discouraged, as this variable is only used for internal storage.',
];

/**
* Content accumulates in this variable.
*
Expand Down Expand Up @@ -86,24 +71,13 @@ class FileSystemNavigationFrameController
*/
protected $moduleTemplate;

/**
* Constructor
*/
public function __construct()
{
// @deprecated since TYPO3 v9, will be obsolete in TYPO3 v10.0 with removal of init()
$request = $GLOBALS['TYPO3_REQUEST'];
$GLOBALS['SOBE'] = $this;
// @deprecated since TYPO3 v9, will be moved out of __construct() in TYPO3 v10.0
$this->init($request);
}

/**
* @param ServerRequestInterface $request the current request
* @return ResponseInterface the response with the content
*/
public function mainAction(ServerRequestInterface $request): ResponseInterface
{
$this->init($request);
$this->initializePageTemplate();
$this->renderFolderTree($request);
return new HtmlResponse($this->content);
Expand All @@ -118,6 +92,7 @@ public function mainAction(ServerRequestInterface $request): ResponseInterface
*/
public function ajaxExpandCollapse(ServerRequestInterface $request): ResponseInterface
{
$this->init($request);
$tree = $this->foldertree->getBrowsableTree();
if ($this->foldertree->getAjaxStatus() === false) {
return new JsonResponse(null, 500);
Expand All @@ -130,14 +105,8 @@ public function ajaxExpandCollapse(ServerRequestInterface $request): ResponseInt
*
* @param ServerRequestInterface $request the current request
*/
protected function init(ServerRequestInterface $request = null)
protected function init(ServerRequestInterface $request)
{
if ($request === null) {
// Method signature in TYPO3 v10.0: protected function init(ServerRequestInterface $request)
trigger_error('FileSystemNavigationFrameController->init() will be set to protected in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
$request = $GLOBALS['TYPO3_REQUEST'];
}

$this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);

$parsedBody = $request->getParsedBody();
Expand Down Expand Up @@ -172,18 +141,6 @@ protected function init(ServerRequestInterface $request = null)
}
}

/**
* initialization for the visual parts of the class
* Use template rendering only if this is a non-AJAX call
*
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function initPage()
{
trigger_error('FileSystemNavigationFrameController->initPage() will be replaced by protected method initializePageTemplate() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
$this->initializePageTemplate();
}

/**
* Initialization for the visual parts of the class
* Use template rendering only if this is a non-AJAX call
Expand Down Expand Up @@ -233,17 +190,6 @@ function jumpTo(id, linkObj, highlightID, bank) {
);
}

/**
* Main function, rendering the folder tree
*
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function main()
{
trigger_error('FileSystemNavigationFrameController->main() will be replaced by protected method renderFolderTree() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
$this->renderFolderTree($GLOBALS['TYPO3_REQUEST']);
}

/**
* Main function, rendering the folder tree
*
Expand Down
25 changes: 0 additions & 25 deletions typo3/sysext/backend/Classes/Controller/LoginController.php
Expand Up @@ -171,19 +171,6 @@ public function refreshAction(ServerRequestInterface $request): ResponseInterfac
return new HtmlResponse($this->createLoginLogoutForm($request));
}

/**
* Main function - creating the login/logout form
*
* @throws Exception
* @return string The content to output
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function main(): string
{
trigger_error('LoginController->main() will be replaced by protected method createLoginLogoutForm() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
return $this->createLoginLogoutForm($GLOBALS['TYPO3_REQUEST']);
}

/**
* Main function - creating the login/logout form
*
Expand All @@ -193,7 +180,6 @@ public function main(): string
*/
protected function createLoginLogoutForm(ServerRequestInterface $request): string
{
/** @var PageRenderer $pageRenderer */
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Login');

Expand Down Expand Up @@ -375,17 +361,6 @@ protected function checkRedirect(ServerRequestInterface $request): void
}
}

/**
* Making interface selector
*
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function makeInterfaceSelectorBox(): void
{
trigger_error('LoginController->makeInterfaceSelectorBox() will be replaced by protected method makeInterfaceSelector() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
$this->makeInterfaceSelector($GLOBALS['TYPO3_REQUEST']);
}

/**
* Making interface selector
* @param ServerRequestInterface $request
Expand Down
11 changes: 0 additions & 11 deletions typo3/sysext/backend/Classes/Controller/LogoutController.php
Expand Up @@ -50,17 +50,6 @@ public function logoutAction(ServerRequestInterface $request): ResponseInterface
return new RedirectResponse(GeneralUtility::locationHeaderUrl($redirectUrl), 303);
}

/**
* Performs the logout processing
*
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function logout()
{
trigger_error('LogoutController->logout() will be replaced by protected method processLogout() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
$this->processLogout();
}

/**
* Performs the logout processing
*/
Expand Down
135 changes: 1 addition & 134 deletions typo3/sysext/backend/Classes/Controller/NewRecordController.php
Expand Up @@ -24,7 +24,6 @@
use TYPO3\CMS\Backend\Tree\View\PagePositionMap;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Compatibility\PublicPropertyDeprecationTrait;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Http\HtmlResponse;
Expand All @@ -34,7 +33,6 @@
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\HttpUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Frontend\Page\PageRepository;

Expand All @@ -44,32 +42,6 @@
*/
class NewRecordController
{
use PublicPropertyDeprecationTrait;

/**
* @var array
*/
protected $deprecatedPublicProperties = [
'pageinfo' => 'Using $pageinfo of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'pidInfo' => 'Using $pidInfo of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'newPagesInto' => 'Using $newPagesInto of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'newContentInto' => 'Using $newContentInto of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'newPagesAfter' => 'Using $newPagesAfter of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'web_list_modTSconfig' => 'Using $web_list_modTSconfig of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'allowedNewTables' => 'Using $allowedNewTables of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'deniedNewTables' => 'Using $deniedNewTables of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'web_list_modTSconfig_pid' => 'Using $web_list_modTSconfig_pid of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'allowedNewTables_pid' => 'Using $allowedNewTables_pid of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'deniedNewTables_pid' => 'Using $deniedNewTables_pid of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'code' => 'Using $code of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'R_URI' => 'Using $R_URI of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'returnUrl' => 'Using $returnUrl of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'pagesOnly' => 'Using $pagesOnly of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'perms_clause' => 'Using $perms_clause of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'content' => 'Using $content of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
'tRows' => 'Using $tRows of class NewRecordController from outside is discouraged as this variable is only used for internal storage.',
];

/**
* @var array
*/
Expand Down Expand Up @@ -201,9 +173,6 @@ public function __construct()

// @see \TYPO3\CMS\Backend\Tree\View\NewRecordPageTreeView::expandNext()
$GLOBALS['SOBE'] = $this;

// @deprecated since TYPO3 v9, will be moved out of __construct() in TYPO3 v10.0
$this->init($GLOBALS['TYPO3_REQUEST']);
}

/**
Expand All @@ -215,6 +184,7 @@ public function __construct()
*/
public function mainAction(ServerRequestInterface $request): ResponseInterface
{
$this->init($request);
$response = $this->renderContent($request);

if (empty($response)) {
Expand All @@ -224,109 +194,6 @@ public function mainAction(ServerRequestInterface $request): ResponseInterface
return $response;
}

/**
* Main processing, creating the list of new record tables to select from
*
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function main()
{
trigger_error('NewRecordController->main() will be replaced by protected method renderContent() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);

$response = $this->renderContent($GLOBALS['TYPO3_REQUEST']);

if ($response instanceof RedirectResponse) {
HttpUtility::redirect($response->getHeaders()['location'][0]);
}
}

/**
* Creates the position map for pages wizard
*
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function pagesOnly()
{
trigger_error('NewRecordController->pagesOnly() will be replaced by protected method renderPositionTree() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
$this->renderPositionTree();
}

/**
* Create a regular new element (pages and records)
*
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function regularNew()
{
trigger_error('NewRecordController->regularNew() will be replaced by protected method renderNewRecordControls() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
$this->renderNewRecordControls($GLOBALS['TYPO3_REQUEST']);
}

/**
* User array sort function used by renderNewRecordControls
*
* @param string $a First array element for compare
* @param string $b First array element for compare
* @return int -1 for lower, 0 for equal, 1 for greater
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function sortNewRecordsByConfig($a, $b)
{
trigger_error('NewRecordController->sortNewRecordsByConfig() will be replaced by protected method sortTableRows() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
return $this->sortTableRows($a, $b);
}

/**
* Links the string $code to a create-new form for a record in $table created on page $pid
*
* @param string $linkText Link text
* @param string $table Table name (in which to create new record)
* @param int $pid PID value for the "&edit['.$table.']['.$pid.']=new" command (positive/negative)
* @param bool $addContentTable If $addContentTable is set, then a new tt_content record is created together with pages
* @return string The link.
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function linkWrap($linkText, $table, $pid, $addContentTable = false)
{
trigger_error('NewRecordController->linkWrap() will be replaced by protected method renderLink() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
return $this->renderLink($linkText, $table, $pid, $addContentTable);
}

/**
* Returns TRUE if the tablename $checkTable is allowed to be created on the page with record $pid_row
*
* @param array $pid_row Record for parent page.
* @param string $checkTable Table name to check
* @return bool Returns TRUE if the tablename $checkTable is allowed to be created on the page with record $pid_row
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function isTableAllowedForThisPage($pid_row, $checkTable)
{
trigger_error('NewRecordController->isTableAllowedForThisPage() will be replaced by protected method isTableAllowedOnPage() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
return $this->isTableAllowedOnPage($checkTable, $pid_row);
}

/**
* Returns TRUE if:
* - $allowedNewTables and $deniedNewTables are empty
* - the table is not found in $deniedNewTables and $allowedNewTables is not set or the $table tablename is found in
* $allowedNewTables
*
* If $table tablename is found in $allowedNewTables and $deniedNewTables, $deniedNewTables
* has priority over $allowedNewTables.
*
* @param string $table Table name to test if in allowedTables
* @param array $allowedNewTables Array of new tables that are allowed.
* @param array $deniedNewTables Array of new tables that are not allowed.
* @return bool Returns TRUE if a link for creating new records should be displayed for $table
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
public function showNewRecLink($table, array $allowedNewTables = [], array $deniedNewTables = [])
{
trigger_error('NewRecordController->showNewRecLink() will be replaced by protected method isRecordCreationAllowedForTable() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
return $this->isRecordCreationAllowedForTable($table, $allowedNewTables, $deniedNewTables);
}

/**
* Constructor function for the class
*
Expand Down

0 comments on commit 33ed62b

Please sign in to comment.