From 861e6c02c9afb60cb4f4fa50a93c0843cdb7834f Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Mon, 5 Mar 2018 20:57:20 +0100
Subject: [PATCH] [TASK] Remove unused folder tree view option

Option ext_noTempRecyclerDirs is circularily used
and always false. It can be removed without harm
and ext_isLinkable() deprecated along the way.

Resolves: #84145
Releases: master
Change-Id: Ibeb949ddb81c919087f894c2839e9bf88c6eb290
Reviewed-on: https://review.typo3.org/56016
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
---
 .../FileSystemNavigationFrameController.php   |  1 -
 .../View/ElementBrowserFolderTreeView.php     | 17 ++++-----
 .../Classes/Tree/View/FolderTreeView.php      |  7 ----
 ...recation-84145-DeprecateExt_isLinkable.rst | 35 +++++++++++++++++++
 .../Php/MethodCallMatcher.php                 |  7 ++++
 5 files changed, 49 insertions(+), 18 deletions(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-84145-DeprecateExt_isLinkable.rst

diff --git a/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php b/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php
index 905dad7781d4..7a476436ca9b 100644
--- a/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php
+++ b/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php
@@ -109,7 +109,6 @@ class FileSystemNavigationFrameController
         if (!empty($this->scopeData)) {
             $this->foldertree = GeneralUtility::makeInstance($this->scopeData['class']);
             $this->foldertree->thisScript = $this->scopeData['script'];
-            $this->foldertree->ext_noTempRecyclerDirs = $this->scopeData['ext_noTempRecyclerDirs'];
             if ($this->foldertree instanceof ElementBrowserFolderTreeView) {
                 // create a fake provider to pass link data along properly
                 $linkParamProvider = GeneralUtility::makeInstance(
diff --git a/typo3/sysext/backend/Classes/Tree/View/ElementBrowserFolderTreeView.php b/typo3/sysext/backend/Classes/Tree/View/ElementBrowserFolderTreeView.php
index 3912258caf1c..74fc5e086fc7 100644
--- a/typo3/sysext/backend/Classes/Tree/View/ElementBrowserFolderTreeView.php
+++ b/typo3/sysext/backend/Classes/Tree/View/ElementBrowserFolderTreeView.php
@@ -62,7 +62,7 @@ class ElementBrowserFolderTreeView extends FolderTreeView
         $theFolderIcon = '';
 
         // Wrap icon in link (in ElementBrowser only the "titlelink" is used).
-        if ($this->ext_IconMode === 'titlelink' && $this->ext_isLinkable($folderObject)) {
+        if ($this->ext_IconMode === 'titlelink') {
             $parameters = GeneralUtility::implodeArrayForUrl('', $this->linkParameterProvider->getUrlParameters(['identifier' => $folderObject->getCombinedIdentifier()]));
             $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . ltrim($parameters, '&')) . ');';
             $theFolderIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
@@ -81,23 +81,21 @@ class ElementBrowserFolderTreeView extends FolderTreeView
      */
     public function wrapTitle($title, $folderObject, $bank = 0)
     {
-        if ($this->ext_isLinkable($folderObject)) {
-            $parameters = GeneralUtility::implodeArrayForUrl('', $this->linkParameterProvider->getUrlParameters(['identifier' => $folderObject->getCombinedIdentifier()]));
-            return '<a href="#" onclick="return jumpToUrl(' . htmlspecialchars(GeneralUtility::quoteJSvalue($this->getThisScript() . ltrim($parameters, '&'))) . ');">' . $title . '</a>';
-        }
-        return '<span class="text-muted">' . $title . '</span>';
+        $parameters = GeneralUtility::implodeArrayForUrl('', $this->linkParameterProvider->getUrlParameters(['identifier' => $folderObject->getCombinedIdentifier()]));
+        return '<a href="#" onclick="return jumpToUrl(' . htmlspecialchars(GeneralUtility::quoteJSvalue($this->getThisScript() . ltrim($parameters, '&'))) . ');">' . $title . '</a>';
     }
 
     /**
      * Returns TRUE if the input "record" contains a folder which can be linked.
      *
      * @param Folder $folderObject Object with information about the folder element. Contains keys like title, uid, path, _title
-     * @return bool TRUE is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
+     * @return bool TRUE
+     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10
      */
     public function ext_isLinkable(Folder $folderObject)
     {
-        $identifier = $folderObject->getIdentifier();
-        return !$this->ext_noTempRecyclerDirs || substr($identifier, -7) !== '_temp_/' && substr($identifier, -11) !== '_recycler_/';
+        trigger_error('This method is obsolete and will be removed in TYPO3 v10.', E_USER_DEPRECATED);
+        return true;
     }
 
     /**
@@ -148,7 +146,6 @@ class ElementBrowserFolderTreeView extends FolderTreeView
             $this->scope = [
                 'class' => static::class,
                 'script' => $this->thisScript,
-                'ext_noTempRecyclerDirs' => $this->ext_noTempRecyclerDirs,
                 'browser' => $this->linkParameterProvider->getUrlParameters([]),
             ];
         }
diff --git a/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php b/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php
index 9bc3a3f7b9c9..162d72f787b0 100644
--- a/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php
+++ b/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php
@@ -62,12 +62,6 @@ class FolderTreeView extends AbstractTreeView
      */
     protected $iconFactory;
 
-    /**
-     * If file-drag mode is set, temp and recycler folders are filtered out.
-     * @var bool
-     */
-    public $ext_noTempRecyclerDirs = false;
-
     /**
      * override to not use a title attribute
      * @var string
@@ -136,7 +130,6 @@ class FolderTreeView extends AbstractTreeView
             $this->scope = [
                 'class' => static::class,
                 'script' => $this->thisScript,
-                'ext_noTempRecyclerDirs' => $this->ext_noTempRecyclerDirs
             ];
         }
 
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84145-DeprecateExt_isLinkable.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84145-DeprecateExt_isLinkable.rst
new file mode 100644
index 000000000000..76c3ca8ff906
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84145-DeprecateExt_isLinkable.rst
@@ -0,0 +1,35 @@
+.. include:: ../../Includes.txt
+
+==============================================
+Deprecation: #84145 - Deprecate ext_isLinkable
+==============================================
+
+See :issue:`84145`
+
+Description
+===========
+
+Method :php:`TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView->ext_isLinkable()`
+has been deprecated. It always returned true and still does it until removed.
+
+
+Impact
+======
+
+Little to no impact in extensions, the method behavior usually does not change.
+
+
+Affected Installations
+======================
+
+Extensions extending the folder tree of the element browser may be affected but
+still should not change their behavior. Extension scanner may find usages and
+marks them as weak match since the methods appears in other classes as well.
+
+
+Migration
+=========
+
+Don't call :php:`ext_isLinkable()` anymore and assume :php:`true` as return value.
+
+.. index:: Backend, PHP-API, FullyScanned
\ No newline at end of file
diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
index fdd91a7cb625..0cbc55ac4c49 100644
--- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
+++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
@@ -1780,4 +1780,11 @@ return [
             'Deprecation-84118-VariousPublicMethodsOfAdminPanelViewDeprecated.rst',
         ],
     ],
+    'TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView->ext_isLinkable' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Deprecation-84145-DeprecateExt_isLinkable.rst'
+        ],
+    ]
 ];
-- 
GitLab