From 14e4e0148c1a09da407632e16603d9020493c219 Mon Sep 17 00:00:00 2001
From: Jan Helke <typo3@helke.de>
Date: Wed, 28 Oct 2015 12:56:44 +0100
Subject: [PATCH] [BUGFIX] Move issueCommand to BackendUtility

To mitigate the dependencies to DocumentTemplate, the method
issueCommand() was moved to BackendUtility and given the
speaking name getLinkToDataHandlerAction().

Resolves: #65728
Releases: master
Change-Id: Ie38108bbf97c4d44329f68b3a262af7e97166a86
Reviewed-on: https://review.typo3.org/44329
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Gernot Schulmeister <gernotschulmeister@gmx.at>
Tested-by: Gernot Schulmeister <gernotschulmeister@gmx.at>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
---
 .../Controller/EditDocumentController.php     |  2 +-
 .../Classes/Template/DocumentTemplate.php     | 17 ++---------
 .../Classes/Template/ModuleTemplate.php       | 30 -------------------
 .../Classes/Utility/BackendUtility.php        | 24 ++++++++++++++-
 .../backend/Classes/View/PageLayoutView.php   | 12 ++++----
 .../ViewHelpers/IssueCommandViewHelper.php    |  4 +--
 ...on-65728-DocumentTemplate-issueCommand.rst | 20 +++++++++++++
 typo3/sysext/filelist/Classes/FileList.php    |  2 +-
 .../Classes/RecordList/DatabaseRecordList.php | 10 +++----
 .../Controller/VersionModuleController.php    |  4 +--
 .../version/Classes/View/VersionView.php      |  2 +-
 11 files changed, 64 insertions(+), 63 deletions(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-65728-DocumentTemplate-issueCommand.rst

diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
index f6498f8d4634..d309f1c633f8 100644
--- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
+++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php
@@ -1556,7 +1556,7 @@ class EditDocumentController extends AbstractModule
                                     'justLocalized' => $table . ':' . $rowsByLang[0]['uid'] . ':' . $lang['uid'],
                                     'returnUrl' => $this->retUrl
                                 ));
-                                $href = $this->moduleTemplate->issueCommand(
+                                $href = BackendUtility::getLinkToDataHandlerAction(
                                     '&cmd[' . $table . '][' . $rowsByLang[0]['uid'] . '][localize]=' . $lang['uid'],
                                     $redirectUrl
                                 );
diff --git a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
index 2da2649e3627..91c551a2f0db 100644
--- a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
+++ b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
@@ -556,23 +556,12 @@ function jumpToUrl(URL) {
      * @param string|int $redirectUrl Redirect URL, default is to use GeneralUtility::getIndpEnv('REQUEST_URI'), -1 means to generate an URL for JavaScript using T3_THIS_LOCATION
      * @return string URL to BackendUtility::getModuleUrl('tce_db') + parameters
      * @see \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick()
+     * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use BackendUtility::getLinkToDataHandlerAction() instead
      */
     public function issueCommand($params, $redirectUrl = '')
     {
-        /** @var BackendUserAuthentication $beUser */
-        $beUser = $GLOBALS['BE_USER'];
-        $urlParameters = [
-            'prErr' => 1,
-            'uPT' => 1,
-            'vC' => $beUser->veriCode()
-        ];
-        $url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . $params . '&redirect=';
-        if ((int)$redirectUrl === -1) {
-            $url = GeneralUtility::quoteJSvalue($url) . '+T3_THIS_LOCATION';
-        } else {
-            $url .= rawurlencode($redirectUrl ?: GeneralUtility::getIndpEnv('REQUEST_URI'));
-        }
-        return $url;
+        GeneralUtility::logDeprecatedFunction();
+        return BackendUtility::getLinkToDataHandlerAction($params, $redirectUrl);
     }
 
     /**
diff --git a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php
index a0140a75fa10..7ff335fafc84 100644
--- a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php
+++ b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php
@@ -564,36 +564,6 @@ class ModuleTemplate
         return GeneralUtility::implodeArrayForUrl('', $storeArray);
     }
 
-    /**
-     * Returns a URL with a command to TYPO3 Core Engine (tce_db.php)
-     * See description of the API elsewhere.
-     *
-     * @param string $params Is a set of GET params to send to tce_db.php.
-     * Example: "&cmd[tt_content][123][move]=456" or
-     * "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World
-     * @param string|int $redirectUrl Redirect URL, default is to use
-     * GeneralUtility::getIndpEnv('REQUEST_URI'), -1 means to generate
-     * an URL for JavaScript using T3_THIS_LOCATION
-     *
-     * @return string URL to BackendUtility::getModuleUrl('tce_db') + parameters
-     * @internal
-     */
-    public function issueCommand($params, $redirectUrl = '')
-    {
-        $urlParameters = [
-            'prErr' => 1,
-            'uPT' => 1,
-            'vC' => $this->getBackendUserAuthentication()->veriCode()
-        ];
-        $url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . $params . '&redirect=';
-        if ((int)$redirectUrl === -1) {
-            $url = GeneralUtility::quoteJSvalue($url) . '+T3_THIS_LOCATION';
-        } else {
-            $url .= rawurlencode($redirectUrl ?: GeneralUtility::getIndpEnv('REQUEST_URI'));
-        }
-        return $url;
-    }
-
     /**
      * Creates the version selector for the page id inputted.
      * Requires the core version management extension, "version" to be loaded.
diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
index 1fc6e497513d..1eba835d7290 100755
--- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php
+++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
@@ -2890,7 +2890,6 @@ class BackendUtility
      * @param string $requestUri An optional returnUrl you can set - automatically set to REQUEST_URI.
      *
      * @return string
-     * @see \TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand()
      */
     public static function editOnClick($params, $_ = '', $requestUri = '')
     {
@@ -2995,6 +2994,29 @@ class BackendUtility
         return '<a href="#" ' . GeneralUtility::implodeAttributes($tagParameters, true) . '>' . $content . '</a>';
     }
 
+    /**
+     * Returns a URL with a command to TYPO3 Datahandler
+     *
+     * @param string $parameters Set of GET params to send. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World
+     * @param string|int $redirectUrl Redirect URL, default is to use GeneralUtility::getIndpEnv('REQUEST_URI'), -1 means to generate an URL for JavaScript using T3_THIS_LOCATION
+     * @return string URL to BackendUtility::getModuleUrl('tce_db') + parameters
+     */
+    public static function getLinkToDataHandlerAction($parameters, $redirectUrl = '')
+    {
+        $urlParameters = [
+            'prErr' => 1,
+            'uPT' => 1,
+            'vC' => static::getBackendUserAuthentication()->veriCode()
+        ];
+        $url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . $parameters . '&redirect=';
+        if ((int)$redirectUrl === -1) {
+            $url = GeneralUtility::quoteJSvalue($url) . '+T3_THIS_LOCATION';
+        } else {
+            $url .= rawurlencode($redirectUrl ?: GeneralUtility::getIndpEnv('REQUEST_URI'));
+        }
+        return $url;
+    }
+
     /**
      * Creates the view-on-click preview URL without any alternative URL.
      *
diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php
index 58e5bc76b07a..50bf150a1eb6 100644
--- a/typo3/sysext/backend/Classes/View/PageLayoutView.php
+++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php
@@ -1273,7 +1273,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                     }
                     $params = '&data[tt_content][' . ($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid'])
                         . '][' . $hiddenField . ']=' . $value;
-                    $out .= '<a class="btn btn-default" href="' . htmlspecialchars($this->getPageLayoutController()->getModuleTemplate()->issueCommand($params))
+                    $out .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params))
                         . '" title="' . $this->getLanguageService()->getLL($label, true) . '">'
                         . $this->iconFactory->getIcon('actions-edit-' . strtolower($label), Icon::SIZE_SMALL)->render() . '</a>';
                 }
@@ -1282,7 +1282,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                 $confirm = $this->getLanguageService()->getLL('deleteWarning')
                     . BackendUtility::translationCount('tt_content', $row['uid'], (' '
                     . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord')));
-                $out .= '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars($this->getPageLayoutController()->getModuleTemplate()->issueCommand($params)) . '"'
+                $out .= '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params)) . '"'
                     . ' data-severity="warning"'
                     . ' data-title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_alt_doc.xlf:label.confirm.delete_record.title')) . '"'
                     . ' data-content="' . htmlspecialchars($confirm) . '" '
@@ -1301,7 +1301,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                     if ($this->tt_contentData['prev'][$row['uid']]) {
                         $params = '&cmd[tt_content][' . $row['uid'] . '][move]=' . $this->tt_contentData['prev'][$row['uid']];
                         $moveButtonContent .= '<a class="btn btn-default" href="'
-                            . htmlspecialchars($this->getPageLayoutController()->getModuleTemplate()->issueCommand($params))
+                            . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params))
                             . '" title="' . $this->getLanguageService()->getLL('moveUp', true) . '">'
                             . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render() . '</a>';
                         if (!$dragDropEnabled) {
@@ -1314,7 +1314,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                     if ($this->tt_contentData['next'][$row['uid']]) {
                         $params = '&cmd[tt_content][' . $row['uid'] . '][move]= ' . $this->tt_contentData['next'][$row['uid']];
                         $moveButtonContent .= '<a class="btn btn-default" href="'
-                            . htmlspecialchars($this->getPageLayoutController()->getModuleTemplate()->issueCommand($params))
+                            . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params))
                             . '" title="' . $this->getLanguageService()->getLL('moveDown', true) . '">'
                             . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render() . '</a>';
                         if (!$dragDropEnabled) {
@@ -1656,7 +1656,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
         foreach ($this->getLanguagesToCopyFrom(GeneralUtility::_GP('id'), $lP, $colPos) as $languageId => $label) {
             $elementsInColumn = $languageId === 0 ? $defLanguageCount : $this->getElementsFromColumnAndLanguage(GeneralUtility::_GP('id'), $colPos, $languageId);
             if (!empty($elementsInColumn)) {
-                $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue($this->getPageLayoutController()->getModuleTemplate()->issueCommand('&cmd[tt_content][' . implode(',', $elementsInColumn) . '][copyFromLanguage]=' . GeneralUtility::_GP('id') . ',' . $lP)) . '; return false;';
+                $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getLinkToDataHandlerAction('&cmd[tt_content][' . implode(',', $elementsInColumn) . '][copyFromLanguage]=' . GeneralUtility::_GP('id') . ',' . $lP)) . '; return false;';
                 $copyFromLanguageMenu .= '<li><a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $this->languageFlag($languageId, false) . ' ' . htmlspecialchars($label) . '</a></li>' . LF;
             }
         }
@@ -1674,7 +1674,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
             }
 
             // We have content in the default language, create a split button
-            $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue($this->getPageLayoutController()->getModuleTemplate()->issueCommand($params)) . '; return false;';
+            $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getLinkToDataHandlerAction($params)) . '; return false;';
             $theNewButton =
                 '<div class="btn-group">
                     <input
diff --git a/typo3/sysext/beuser/Classes/ViewHelpers/IssueCommandViewHelper.php b/typo3/sysext/beuser/Classes/ViewHelpers/IssueCommandViewHelper.php
index bf836b09c802..18a738a79ab6 100644
--- a/typo3/sysext/beuser/Classes/ViewHelpers/IssueCommandViewHelper.php
+++ b/typo3/sysext/beuser/Classes/ViewHelpers/IssueCommandViewHelper.php
@@ -22,7 +22,7 @@ use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
 use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
 
 /**
- * Issue command ViewHelper, see TYPO3 Core Engine method issueCommand
+ * Render a link to DataHandler command
  * @internal
  */
 class IssueCommandViewHelper extends AbstractViewHelper implements CompilableInterface
@@ -34,7 +34,7 @@ class IssueCommandViewHelper extends AbstractViewHelper implements CompilableInt
      * @param string $redirectUrl Redirect URL if any other that \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') is wished
      *
      * @return string URL to tce_db.php + parameters
-     * @see \TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand()
+     * @see \TYPO3\CMS\Backend\Utility\BackendUtility::getLinkToDataHandlerAction()
      */
     public function render($parameters, $redirectUrl = '')
     {
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65728-DocumentTemplate-issueCommand.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65728-DocumentTemplate-issueCommand.rst
new file mode 100644
index 000000000000..da326c119197
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65728-DocumentTemplate-issueCommand.rst
@@ -0,0 +1,20 @@
+======================================================
+Deprecation: #65728 - DocumentTemplate->issueCommand()
+======================================================
+
+Description
+===========
+
+Method ``TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand()`` has been deprecated.
+
+
+Affected Installations
+======================
+
+Instances with custom backend modules that use this method.
+
+
+Migration
+=========
+
+Use ``TYPO3\CMS\Backend\Utility\BackendUtility::getLinkToDataHandlerAction()`` instead.
\ No newline at end of file
diff --git a/typo3/sysext/filelist/Classes/FileList.php b/typo3/sysext/filelist/Classes/FileList.php
index 44e6b77927ef..c36320020327 100644
--- a/typo3/sysext/filelist/Classes/FileList.php
+++ b/typo3/sysext/filelist/Classes/FileList.php
@@ -738,7 +738,7 @@ class FileList extends AbstractRecordList
                                         'returnUrl' => $this->listURL()
                                     ];
                                     $returnUrl = BackendUtility::getModuleUrl('record_edit', $parameters);
-                                    $href = $this->fileListController->doc->issueCommand(
+                                    $href = BackendUtility::getLinkToDataHandlerAction(
                                         '&cmd[sys_file_metadata][' . $metaDataRecord['uid'] . '][localize]=' . $languageId,
                                         $returnUrl
                                     );
diff --git a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
index bc5cc571445d..eff18a976bb4 100644
--- a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
+++ b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
@@ -1477,7 +1477,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                     // Up
                     $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prev'][$row['uid']];
                     $moveUpAction = '<a class="btn btn-default" href="#" onclick="'
-                        . htmlspecialchars('return jumpToUrl(' . $module->getModuleTemplate()->issueCommand($params, -1) . ');')
+                        . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');')
                         . '" title="' . $this->getLanguageService()->getLL('moveUp', true) . '">'
                         . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render() . '</a>';
                 } else {
@@ -1489,7 +1489,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                     // Down
                     $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']];
                     $moveDownAction = '<a class="btn btn-default" href="#" onclick="'
-                        . htmlspecialchars('return jumpToUrl(' . $module->getModuleTemplate()->issueCommand($params, -1) . ');')
+                        . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');')
                         . '" title="' . $this->getLanguageService()->getLL('moveDown', true) . '">'
                         . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render() . '</a>';
                 } else {
@@ -1571,7 +1571,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                 if ($this->calcPerms & Permission::PAGE_NEW) {
                     $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id;
                     $moveLeftAction = '<a class="btn btn-default" href="#" onclick="'
-                        . htmlspecialchars('return jumpToUrl(' . $module->getModuleTemplate()->issueCommand($params, -1) . ');')
+                        . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');')
                         . '" title="' . $this->getLanguageService()->getLL('prevLevel', true) . '">'
                         . $this->iconFactory->getIcon('actions-move-left', Icon::SIZE_SMALL)->render() . '</a>';
                     $this->addActionToCellGroup($cells, $moveLeftAction, 'moveLeft');
@@ -1582,7 +1582,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                     if ($localCalcPerms & Permission::PAGE_NEW) {
                         $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']];
                         $moveRightAction = '<a class="btn btn-default" href="#" onclick="'
-                            . htmlspecialchars('return jumpToUrl(' . $module->getModuleTemplate()->issueCommand($params, -1) . ');')
+                            . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');')
                             . '" title="' . $this->getLanguageService()->getLL('nextLevel', true) . '">'
                             . $this->iconFactory->getIcon('actions-move-right', Icon::SIZE_SMALL)->render() . '</a>';
                     } else {
@@ -1814,7 +1814,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
             foreach ($this->pageOverlays as $lUid_OnPage => $lsysRec) {
                 if ($this->isEditable($table) && !isset($translations['translations'][$lUid_OnPage]) && $this->getBackendUserAuthentication()->checkLanguageAccess($lUid_OnPage)) {
                     $url = $this->listURL();
-                    $href = $this->getModule()->getModuleTemplate()->issueCommand(
+                    $href = BackendUtility::getLinkToDataHandlerAction(
                         '&cmd[' . $table . '][' . $row['uid'] . '][localize]=' . $lUid_OnPage,
                         $url . '&justLocalized=' . rawurlencode($table . ':' . $row['uid'] . ':' . $lUid_OnPage)
                     );
diff --git a/typo3/sysext/version/Classes/Controller/VersionModuleController.php b/typo3/sysext/version/Classes/Controller/VersionModuleController.php
index b5cb12d59ba2..328b8971c57f 100644
--- a/typo3/sysext/version/Classes/Controller/VersionModuleController.php
+++ b/typo3/sysext/version/Classes/Controller/VersionModuleController.php
@@ -377,7 +377,7 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
 				<tr' . ($row['uid'] != $this->uid ? '' : ' class="active"') . '>
 					<td class="col-icon">' .
                         ($row['uid'] != $this->uid ?
-                            '<a href="' . $this->doc->issueCommand('&cmd[' . $this->table . '][' . $this->uid . '][version][swapWith]=' . $row['uid'] . '&cmd[' . $this->table . '][' . $this->uid . '][version][action]=swap') . '" title="' . $GLOBALS['LANG']->getLL('swapWithCurrent', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-version-swap-version', Icon::SIZE_SMALL)->render() . '</a>' :
+                            '<a href="' . BackendUtility::getLinkToDataHandlerAction('&cmd[' . $this->table . '][' . $this->uid . '][version][swapWith]=' . $row['uid'] . '&cmd[' . $this->table . '][' . $this->uid . '][version][action]=swap') . '" title="' . $GLOBALS['LANG']->getLL('swapWithCurrent', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-version-swap-version', Icon::SIZE_SMALL)->render() . '</a>' :
                             '<span title="' . $GLOBALS['LANG']->getLL('currentOnlineVersion', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('status-status-current', Icon::SIZE_SMALL)->render() . '</span>'
                         ) . '
 					</td>
@@ -533,7 +533,7 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
         ]);
         $adminLink = '<a class="btn btn-default" href="' . htmlspecialchars($editUrl) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
         // Delete link:
-        $adminLink .= '<a class="btn btn-default" href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
+        $adminLink .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
         if ($table === 'pages') {
             // If another page module was specified, replace the default Page module with the new one
             $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
diff --git a/typo3/sysext/version/Classes/View/VersionView.php b/typo3/sysext/version/Classes/View/VersionView.php
index b97c7102788d..1881acee630d 100644
--- a/typo3/sysext/version/Classes/View/VersionView.php
+++ b/typo3/sysext/version/Classes/View/VersionView.php
@@ -73,7 +73,7 @@ class VersionView
                 if ($id == $onlineId) {
                     $controls = '<strong class="text-success">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.online', true) . '</strong>';
                 } elseif (!$noAction) {
-                    $href = $GLOBALS['TBE_TEMPLATE']->issueCommand(
+                    $href = BackendUtility::getLinkToDataHandlerAction(
                         '&cmd[pages][' . $onlineId . '][version][swapWith]=' . $id . '&cmd[pages][' . $onlineId . '][version][action]=swap',
                         GeneralUtility::linkThisScript(array('id' => $onlineId))
                     );
-- 
GitLab