[CLEANUP] Remove deprecated filemount functions in BE_USER 65/28265/4
authorBenjamin Mack <benni@typo3.org>
Tue, 11 Mar 2014 16:20:39 +0000 (17:20 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 12 Apr 2014 12:41:55 +0000 (14:41 +0200)
With the introduction of the file abstraction layer,
the filemount functionality was deprecated in 6.0
but wasn't removed.

However, the usage of addFileMount() in  rtehtmlarea and
EXT:recordlist is now removed, since the added filemounts
are never read anywhere, so this is only dead code.

The functionality needs to be re-implemented.

Releases: 6.2
Resolves: #56772
Change-Id: I20ec66f46f15a785f5014cb625dabef711fae0a1
Reviewed-on: https://review.typo3.org/28265
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Oliver Klee
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
typo3/sysext/core/Classes/Utility/File/BasicFileUtility.php
typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php
typo3/sysext/rtehtmlarea/Classes/Controller/BrowseLinksController.php
typo3/sysext/rtehtmlarea/Classes/Controller/SelectImageController.php

index 784cd94..6ed2056 100644 (file)
@@ -1860,95 +1860,6 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
        }
 
        /**
        }
 
        /**
-        * Adds a filemount to the users array of filemounts,
-        * $this->groupData['filemounts'][hash_key] = Array('name'=>$name, 'path'=>$path, 'type'=>$type);
-        * Is a part of the authentication proces of the user.
-        * A final requirement for a path being mounted is that
-        *  a) it MUST return TRUE on is_dir()
-        *  b) must contain either PATH_site+'fileadminDir' OR 'lockRootPath' - if lockRootPath is set - as first part of string!
-        * Paths in the mounted information will always be absolute and have a trailing slash.
-        *
-        * @param string $title Will be the (root)name of the filemount in the folder tree
-        * @param string $altTitle Will be the (root)name of the filemount IF $title is not TRUE (blank or zero)
-        * @param string $path Is the path which should be mounted. Will accept backslash in paths on windows servers (will substituted with forward slash). The path should be 1) relative to TYPO3_CONF_VARS[BE][fileadminDir] if $webspace is set, otherwise absolute.
-        * @param boolean $webspace If $webspace is set, the $path is relative to 'fileadminDir' in TYPO3_CONF_VARS, otherwise $path is absolute. 'fileadminDir' must be set to allow mounting of relative paths.
-        * @param string $type Type of filemount; Can be blank (regular) or "user" / "group" (for user and group filemounts presumably). Probably sets the icon first and foremost.
-        * @return boolean Returns "1" if the requested filemount was mounted, otherwise FALSE is returned
-        * @deprecated since TYPO3 6.0, will be removed in TYPO3 6.1, all data is stored in $this->fileStorages now, see initializeFileStorages()
-        * @access private
-        * @todo Define visibility
-        */
-       public function addFileMount($title, $altTitle, $path, $webspace, $type) {
-               GeneralUtility::logDeprecatedFunction();
-               // Return FALSE if fileadminDir is not set and we try to mount a relative path
-               if ($webspace && !$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) {
-                       return FALSE;
-               }
-               // Trimming and pre-processing
-               $path = trim($path);
-               // with WINDOWS convert backslash to slash!!
-               if ($this->OS == 'WIN') {
-                       $path = str_replace('\\', '/', $path);
-               }
-               // If the path is TRUE and validates as a valid path string:
-               if ($path && GeneralUtility::validPathStr($path)) {
-                       // normalize path: remove leading '/' and './', and trailing '/' and '/.'
-                       $path = trim($path);
-                       $path = preg_replace('#^\\.?/|/\\.?$#', '', $path);
-                       // There must be some chars in the path
-                       if ($path) {
-                               // Fileadmin dir, absolute
-                               $fdir = PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'];
-                               if ($webspace) {
-                                       $path = $fdir . $path;
-                               } else {
-                                       // With WINDOWS no prepending!!
-                                       if ($this->OS != 'WIN') {
-                                               // With WINDOWS no prepending!!
-                                               $path = '/' . $path;
-                                       }
-                               }
-                               $path .= '/';
-                               // We now have a path with slash after and slash before (if unix)
-                               $lockRootPath = $GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'];
-                               if (
-                                       @is_dir($path) && (GeneralUtility::isFirstPartOfStr($path, $fdir)
-                                       || $lockRootPath && GeneralUtility::isFirstPartOfStr($path, $lockRootPath))
-                               ) {
-                                       // Alternative title?
-                                       $name = $title ?: $altTitle;
-                                       // Adds the filemount. The same filemount with same name, type and path cannot
-                                       // be set up twice because of the hash string used as key.
-                                       $this->groupData['filemounts'][md5($name . '|' . $path . '|' . $type)] = array(
-                                               'name' => $name,
-                                               'path' => $path,
-                                               'type' => $type
-                                       );
-                                       // Return TRUE - went well, success!
-                                       return 1;
-                               }
-                       }
-               }
-               return FALSE;
-       }
-
-       /**
-        * Returns an array with the filemounts for the user.
-        * Each filemount is represented with an array of a "name", "path" and "type".
-        * If no filemounts an empty array is returned.
-        *
-        * @return array
-        * @deprecated since TYPO3 6.0, will be removed in TYPO3 6.1 as getFileStorages() should be the one to be used
-        * @todo Define visibility
-        */
-       public function returnFilemounts() {
-               GeneralUtility::logDeprecatedFunction();
-               // initialize the file storages in order to set some default settings in any time
-               $this->getFileStorages();
-               return $this->groupData['filemounts'];
-       }
-
-       /**
         * Creates a TypoScript comment with the string text inside.
         *
         * @param string $str The text to wrap in comment prefixes and delimiters.
         * Creates a TypoScript comment with the string text inside.
         *
         * @param string $str The text to wrap in comment prefixes and delimiters.
index 652acc9..77b7c30 100644 (file)
@@ -144,7 +144,7 @@ class BasicFileUtility {
         * @param       array           Not in use anymore
         * @param       array           Array with information about allowed and denied file extensions. Typically passed: $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']
         * @return      void
         * @param       array           Not in use anymore
         * @param       array           Array with information about allowed and denied file extensions. Typically passed: $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']
         * @return      void
-        * @see typo3/init.php, \TYPO3\CMS\Core\Authentication\BackendUserAuthentication::returnFilemounts()
+        * @see typo3/init.php
         */
        public function init($mounts, $f_ext) {
                $this->f_ext['webspace']['allow'] = GeneralUtility::uniqueList(strtolower($f_ext['webspace']['allow']));
         */
        public function init($mounts, $f_ext) {
                $this->f_ext['webspace']['allow'] = GeneralUtility::uniqueList(strtolower($f_ext['webspace']['allow']));
index 9863234..783d2fb 100644 (file)
@@ -132,12 +132,11 @@ class ElementBrowserController {
                        case 'filedrag':
                        case 'folder':
                                // Setting additional read-only browsing file mounts
                        case 'filedrag':
                        case 'folder':
                                // Setting additional read-only browsing file mounts
-                               // @todo: add this feature for FAL and TYPO3 6.0
                                $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
                                if ($altMountPoints) {
                                        $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
                                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
                                $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
                                if ($altMountPoints) {
                                        $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
                                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
-                                               $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
+                                               // @todo: add this feature for FAL and TYPO3 6.2
                                        }
                                }
                                break;
                                        }
                                }
                                break;
index cdf9df6..97ad20e 100644 (file)
@@ -76,7 +76,7 @@ class BrowseLinksController {
                if ($altMountPoints) {
                        $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
                if ($altMountPoints) {
                        $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
-                               $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
+                               // @todo: add this feature for FAL and TYPO3 6.2
                        }
                }
                // Render type by user function
                        }
                }
                // Render type by user function
index cfd8b6b..1e779ab 100644 (file)
@@ -62,7 +62,7 @@ class SelectImageController {
                if ($altMountPoints) {
                        $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
                if ($altMountPoints) {
                        $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
-                               $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
+                               // @todo: add this feature for FAL and TYPO3 6.2
                        }
                }
                // Rendering type by user function
                        }
                }
                // Rendering type by user function