[TASK] Deprecate $disable Option in PageRepository->getExtURL 73/39473/4
authorBenjamin Mack <benni@typo3.org>
Tue, 12 May 2015 04:13:46 +0000 (12:13 +0800)
committerAndreas Fernandez <typo3@scripting-base.de>
Tue, 16 Jun 2015 11:51:52 +0000 (13:51 +0200)
The disable option to check whether redirects are allowed
should be handled outside of the call to simplify code readability
and maintainability.

Resolves: #66904
Releases: master
Change-Id: Ica85c0703641ff4764233b626d0c08a64bb65d28
Reviewed-on: http://review.typo3.org/39473
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/core/Documentation/Changelog/master/Deprecation-66904-DisablegetExtURL.rst [new file with mode: 0644]
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Page/PageRepository.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-66904-DisablegetExtURL.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-66904-DisablegetExtURL.rst
new file mode 100644 (file)
index 0000000..1518515
--- /dev/null
@@ -0,0 +1,21 @@
+====================================================================
+Deprecation: #66904 - $disable Option in PageRepository->getExtURL()
+====================================================================
+
+Description
+===========
+
+The second parameter ``$disable`` within ``PageRepository->getExtURL()`` has been marked for deprecation.
+
+
+Affected Installations
+======================
+
+Any installation using the method in a third-party extension above with using the second parameter set to
+``true`` will throw a deprecation warning.
+
+
+Migration
+=========
+
+Check if redirects are enabled before the actual call to ``PageRepository->getExtURL()`` in a third-party extension.
index b67f383..274d92b 100644 (file)
@@ -2803,7 +2803,7 @@ class TypoScriptFrontendController {
         * @return void
         */
        public function setExternalJumpUrl() {
-               if ($extUrl = $this->sys_page->getExtURL($this->page, $this->config['config']['disablePageExternalUrl'])) {
+               if ((bool)$this->config['config']['disablePageExternalUrl'] === FALSE && $extUrl = $this->sys_page->getExtURL($this->page)) {
                        $this->jumpurl = $extUrl;
                        GeneralUtility::_GETset(GeneralUtility::hmac($this->jumpurl, 'jumpurl'), 'juHash');
                }
index 556fcaf..ed7e039 100644 (file)
@@ -717,12 +717,16 @@ class PageRepository {
         * disabled.
         *
         * @param array $pagerow The page row to return URL type for
-        * @param bool $disable A flag to simply disable any output from here.
+        * @param bool $disable A flag to simply disable any output from here. - deprecated - don't use anymore.
         * @return string The URL type from $this->urltypes array. False if not found or disabled.
         * @see \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::setExternalJumpUrl()
         */
-       public function getExtURL($pagerow, $disable = 0) {
-               if ((int)$pagerow['doktype'] === self::DOKTYPE_LINK && !$disable) {
+       public function getExtURL($pagerow, $disable = FALSE) {
+               if ($disable !== FALSE) {
+                       GeneralUtility::deprecationLog('The disable option of PageRepository::getExtUrl() is deprecated since TYPO3 CMS 7, will be removed with TYPO3 CMS 8.');
+                       return FALSE;
+               }
+               if ((int)$pagerow['doktype'] === self::DOKTYPE_LINK) {
                        $redirectTo = $this->urltypes[$pagerow['urltype']] . $pagerow['url'];
                        // If relative path, prefix Site URL:
                        $uI = parse_url($redirectTo);