[CLEANUP] Remove references to $GLOBALS['FILEMOUNTS'] 27/27227/6
authorBenjamin Mack <benni@typo3.org>
Sat, 1 Feb 2014 11:19:38 +0000 (12:19 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 7 Mar 2014 20:00:53 +0000 (21:00 +0100)
Global filemounts are not supported with FAL anymore
as the implementation is done via file storages directly.
All references to the global FILEMOUNTS is removed as
it was an empty array since 6.0.

Next step (but not part of this patch) is to clean up the
functions in BasicFileUtility that make use of the filemounts.

Releases: 6.2
Resolves: #55547
Change-Id: I07e08afe54c174d1c3a67c41645819e5831fd1e3
Reviewed-on: https://review.typo3.org/27227
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
13 files changed:
typo3/sysext/backend/Classes/Controller/File/FileController.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Utility/File/BasicFileUtility.php
typo3/sysext/core/Tests/Functional/Utility/File/ExtendedFileUtilityTest.php
typo3/sysext/filelist/Classes/Controller/FileListController.php
typo3/sysext/impexp/Classes/Controller/ImportExportController.php
typo3/sysext/impexp/Classes/ImportExport.php
typo3/sysext/impexp/Classes/Task/ImportExportTask.php
typo3/sysext/lowlevel/Classes/RteImagesCommand.php
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php
typo3/sysext/rtehtmlarea/Classes/Controller/BrowseLinksController.php
typo3/sysext/rtehtmlarea/Classes/Controller/SelectImageController.php

index 5aa84b2..9e4a050 100644 (file)
@@ -122,7 +122,7 @@ class FileController {
         */
        public function main() {
                // Initializing:
-               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               $this->fileProcessor->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                $this->fileProcessor->setActionPermissions();
                $this->fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0;
                // Checking referrer / executing:
index 85395c9..bdf2fe5 100644 (file)
@@ -729,7 +729,6 @@ class Bootstrap {
                unset($GLOBALS['FILEICONS']);
                // Those set in init.php:
                unset($GLOBALS['WEBMOUNTS']);
-               unset($GLOBALS['FILEMOUNTS']);
                unset($GLOBALS['BE_USER']);
                // Those set otherwise:
                unset($GLOBALS['TBE_MODULES_EXT']);
@@ -1033,8 +1032,6 @@ class Bootstrap {
        public function initializeBackendUserMounts() {
                // Includes deleted mount pages as well! @TODO: Figure out why ...
                $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
-               $GLOBALS['BE_USER']->getFileStorages();
-               $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->groupData['filemounts'];
                return $this;
        }
 
index beb8bb4..5c93d1d 100644 (file)
@@ -134,9 +134,9 @@ class BasicFileUtility {
         * Typically TYPO3_CONF_VARS['BE']['fileExtensions'] would be passed along as $f_ext.
         *
         * Example:
-        * $basicff->init($GLOBALS['FILEMOUNTS'],$GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+        * $basicff->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
         *
-        * @param       array           Contains the paths of the file mounts for the current BE user. Normally $GLOBALS['FILEMOUNTS'] is passed. This variable is set during backend user initialization; $FILEMOUNTS = $GLOBALS['BE_USER']->returnFilemounts(); (see typo3/init.php)
+        * @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()
@@ -150,7 +150,7 @@ class BasicFileUtility {
                $this->f_ext['ftpspace']['allow'] = GeneralUtility::uniqueList(strtolower($f_ext['ftpspace']['allow']));
                $this->f_ext['ftpspace']['deny'] = GeneralUtility::uniqueList(strtolower($f_ext['ftpspace']['deny']));
 
-               $this->mounts = $mounts;
+               $this->mounts = (!empty($mounts) ? $mounts : array());
                $this->webPath = GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT');
                $this->isInit = 1;
                $this->maxInputNameLen = $GLOBALS['TYPO3_CONF_VARS']['SYS']['maxFileNameLength'] ?: $this->maxInputNameLen;
index a27962e..661cdfc 100644 (file)
@@ -92,10 +92,9 @@ class ExtendedFileUtilityTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
                // Initializing file processor
                $GLOBALS['BE_USER'] = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication', array('getSessionData', 'setAndSaveSessionData'));
                $GLOBALS['BE_USER']->user['uid'] = 1;
-               $GLOBALS['FILEMOUNTS'] = array();
                // Initializing:
                $this->fileProcessor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility');
-               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               $this->fileProcessor->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                $this->fileProcessor->init_actionPerms($GLOBALS['BE_USER']->getFileoperationPermissions());
                $this->fileProcessor->dontCheckForUnique = 1;
        }
index 0cf7bc0..a355b1b 100644 (file)
@@ -292,7 +292,7 @@ class FileListController {
                                        }
                                        // Init file processing object for deleting and pass the cmd array.
                                        $fileProcessor = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility');
-                                       $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+                                       $fileProcessor->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                                        $fileProcessor->setActionPermissions();
                                        $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0;
                                        $fileProcessor->start($FILE);
index 6ef7428..a0bc870 100644 (file)
@@ -1098,43 +1098,36 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
         ****************************/
 
        /**
-        * Returns first temporary folder of the user account (from $FILEMOUNTS)
+        * Returns first temporary folder of the user account
         *
         * @return string Absolute path to first "_temp_" folder of the current user, otherwise blank.
         * @todo Define visibility
         */
        public function userTempFolder() {
-               global $FILEMOUNTS;
-               foreach ($FILEMOUNTS as $filePathInfo) {
-                       $tempFolder = $filePathInfo['path'] . '_temp_/';
-                       if (@is_dir($tempFolder)) {
-                               return $tempFolder;
-                       }
+               /** @var $folder \TYPO3\CMS\Core\Resource\Folder */
+               $folder = $GLOBALS['BE_USER']->getDefaultUploadFolder();
+               if ($folder !== FALSE) {
+                       return PATH_site . $folder->getPublicUrl();
                }
+               return '';
        }
 
        /**
         * Returns folder where user can save export files.
         *
         * @return string Absolute path to folder where export files can be saved.
-        * @todo Define visibility
+        * @todo Define visib
         */
        public function userSaveFolder() {
-               global $FILEMOUNTS;
-               reset($FILEMOUNTS);
-               $filePathInfo = current($FILEMOUNTS);
-               if (is_array($filePathInfo)) {
-                       $tempFolder = $filePathInfo['path'] . '_temp_/';
-                       if (!@is_dir($tempFolder)) {
-                               $tempFolder = $filePathInfo['path'];
-                               if (!@is_dir($tempFolder)) {
-                                       return FALSE;
-                               }
-                       }
-                       return $tempFolder;
+               /** @var $folder \TYPO3\CMS\Core\Resource\Folder */
+               $folder = $GLOBALS['BE_USER']->getDefaultUploadFolder();
+               if ($folder !== FALSE) {
+                       return PATH_site . $folder->getPublicUrl();
                }
+               return '';
        }
 
+
        /**
         * Check if a file has been uploaded
         *
@@ -1145,7 +1138,7 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                $file = GeneralUtility::_GP('file');
                // Initializing:
                $this->fileProcessor = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility');
-               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               $this->fileProcessor->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                $this->fileProcessor->setActionPermissions();
                $this->fileProcessor->dontCheckForUnique = GeneralUtility::_GP('overwriteExistingFiles') ? 1 : 0;
                // Checking referer / executing:
index a54ca7e..e5a44b9 100644 (file)
@@ -3259,7 +3259,7 @@ class ImportExport {
        public function getFileProcObj() {
                if (!is_object($this->fileProcObj)) {
                        $this->fileProcObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility');
-                       $this->fileProcObj->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+                       $this->fileProcObj->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                        $this->fileProcObj->setActionPermissions();
                }
                return $this->fileProcObj;
index 3ec8b54..bbd38a9 100644 (file)
@@ -171,17 +171,12 @@ class ImportExportTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
        }
 
        /**
-        * Returns first temporary folder of the user account (from $FILEMOUNTS)
+        * Returns first temporary folder of the user account
         *
         * @return string Absolute path to first "_temp_" folder of the current user, otherwise blank.
         */
        protected function userTempFolder() {
-               foreach ($GLOBALS['FILEMOUNTS'] as $filePathInfo) {
-                       $tempFolder = $filePathInfo['path'] . '_temp_/';
-                       if (@is_dir($tempFolder)) {
-                               return $tempFolder;
-                       }
-               }
+               // @TODO: This is broken since move to FAL
                return '';
        }
 
index 321812d..d401efd 100644 (file)
@@ -254,7 +254,7 @@ Reports problems with RTE images';
        public function getFileProcObj() {
                if (!is_object($this->fileProcObj)) {
                        $this->fileProcObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility');
-                       $this->fileProcObj->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+                       $this->fileProcObj->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                        $this->fileProcObj->setActionPermissions();
                }
                return $this->fileProcObj;
index 4947a86..d80dd68 100644 (file)
@@ -336,7 +336,7 @@ class ElementBrowser {
 
                // Init fileProcessor
                $this->fileProcessor = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\BasicFileUtility');
-               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               $this->fileProcessor->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
        }
 
        /**
index 27f154a..9863234 100644 (file)
@@ -139,8 +139,6 @@ class ElementBrowserController {
                                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
                                                $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
                                        }
-                                       $GLOBALS['BE_USER']->getFileStorages();
-                                       $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->groupData['filemounts'];
                                }
                                break;
                }
index b221873..cdf9df6 100644 (file)
@@ -78,8 +78,6 @@ class BrowseLinksController {
                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
                                $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
                        }
-                       $GLOBALS['BE_USER']->getFileStorages();
-                       $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->groupData['filemounts'];
                }
                // Render type by user function
                $browserRendered = FALSE;
index 9308ba2..180b69a 100644 (file)
@@ -55,8 +55,6 @@ class SelectImageController {
                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
                                $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
                        }
-                       $GLOBALS['BE_USER']->getFileStorages();
-                       $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->groupData['filemounts'];
                }
                // Rendering type by user function
                $browserRendered = FALSE;