[!!!][TASK] Remove global variable WEBMOUNTS 97/35697/3
authorBenjamin Mack <benni@typo3.org>
Thu, 1 Jan 2015 11:11:42 +0000 (12:11 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 3 Jan 2015 18:56:41 +0000 (19:56 +0100)
The WEBMOUNTS variable is holding
the BackendUsers' DB mounts which are
always accessible via $BE_USER->returnWebmounts()

The bootstrap for the Backend is now
a tiny bit faster. The few left-over places
are changed.

The global variable FILEMOUNTS was
already removed with the introduction
of FAL.

Resolves: #64070
Releases: master
Change-Id: I1a681afacd7e0c0092a87ebff07008eb069872f2
Reviewed-on: http://review.typo3.org/35697
Reviewed-by: Frederic Gaus <gaus@flagbit.de>
Tested-by: Frederic Gaus <gaus@flagbit.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/cli_dispatch.phpsh
typo3/init.php
typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
typo3/sysext/backend/Classes/Tree/View/BrowseTreeView.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Utility/File/BasicFileUtility.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-64070-GlobalWebmountsRemoved.rst [new file with mode: 0644]
typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php
typo3/sysext/rtehtmlarea/Classes/Controller/BrowseLinksController.php
typo3/sysext/rtehtmlarea/Classes/Extension/Abbreviation.php

index 87e55c6..3eaf59e 100755 (executable)
@@ -43,7 +43,6 @@ require __DIR__ . '/sysext/core/Classes/Core/Bootstrap.php';
        ->loadExtensionTables(TRUE)
        ->initializeBackendUser()
        ->initializeBackendAuthentication()
-       ->initializeBackendUserMounts()
        ->initializeLanguageObject();
 
        // Make sure output is not buffered, so command-line output and interaction can take place
index 9d12d06..49d6ced 100644 (file)
@@ -57,7 +57,6 @@ require __DIR__ . '/sysext/core/Classes/Core/Bootstrap.php';
        ->initializeSpriteManager()
        ->initializeBackendUser()
        ->initializeBackendAuthentication()
-       ->initializeBackendUserMounts()
        ->initializeLanguageObject()
        ->initializeBackendTemplate()
        ->endOutputBufferingAndCleanPreviousOutput()
index e853a69..1481cbb 100644 (file)
@@ -95,7 +95,7 @@ abstract class AbstractTreeView {
        public $BE_USER = '';
 
        /**
-        * Needs to be initialized with e.g. $GLOBALS['WEBMOUNTS']
+        * Needs to be initialized with e.g. $GLOBALS['BE_USER']->returnWebmounts()
         * Default setting in init() is 0 => 0
         * The keys are mount-ids (can be anything basically) and the
         * values are the ID of the root element (COULD be zero or anything else.
index 7049de2..2423705 100644 (file)
@@ -47,7 +47,7 @@ class BrowseTreeView extends \TYPO3\CMS\Backend\Tree\View\AbstractTreeView {
                $this->domIdPrefix = 'pages';
                $this->iconName = '';
                $this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
-               $this->MOUNTS = $GLOBALS['WEBMOUNTS'];
+               $this->MOUNTS = $GLOBALS['BE_USER']->returnWebmounts();
                if ($pidList) {
                        // Remove mountpoint if explicitly set in options.hideRecords.pages (see above)
                        $hideList = explode(',', $pidList);
index 1d6c3be..7798251 100644 (file)
@@ -711,7 +711,6 @@ class Bootstrap {
                unset($GLOBALS['TBE_STYLES']);
                unset($GLOBALS['FILEICONS']);
                // Those set in init.php:
-               unset($GLOBALS['WEBMOUNTS']);
                unset($GLOBALS['BE_USER']);
                // Those set otherwise:
                unset($GLOBALS['TBE_MODULES_EXT']);
@@ -1004,18 +1003,6 @@ class Bootstrap {
        }
 
        /**
-        * Initialize backend user mount points
-        *
-        * @return Bootstrap
-        * @internal This is not a public API method, do not use in own extensions
-        */
-       public function initializeBackendUserMounts() {
-               // Includes deleted mount pages as well! @TODO: Figure out why ...
-               $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
-               return $this;
-       }
-
-       /**
         * Initialize language object
         *
         * @return Bootstrap
index 5176152..edf99e3 100644 (file)
@@ -119,7 +119,6 @@ class BasicFileUtility {
         * $this->mounts is traversed in the function checkPathAgainstMounts($thePath), and it is checked that $thePath is actually below one of the mount-paths
         * The mountpaths are with a trailing '/'. $thePath must be with a trailing '/' also!
         * As you can see, $this->mounts is very critical! This is the array that decides where the user will be allowed to copy files!!
-        * Typically the global var $WEBMOUNTS would be passed along as $mounts
         *
         * A typical example of the array $f_ext is this:
         * $f_ext['webspace']['allow']='';
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-64070-GlobalWebmountsRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-64070-GlobalWebmountsRemoved.rst
new file mode 100644 (file)
index 0000000..66b4efe
--- /dev/null
@@ -0,0 +1,25 @@
+====================================================
+Breaking: #64070 - Removed global variable WEBMOUNTS
+====================================================
+
+Description
+===========
+
+The global variable WEBMOUNTS was removed, as the same data from the WEBMOUNTS can always be fetched via
+``$GLOBALS['BE_USER']->returnWebmounts()``.
+
+Impact
+======
+
+The variable ``$GLOBALS['WEBMOUNTS']`` will no longer be filled.
+
+
+Affected installations
+======================
+
+Any installation using ``$GLOBALS['WEBMOUNTS']`` directly within an extension will produce a wrong result.
+
+Migration
+=========
+
+Replace all occurrences of ``$GLOBALS['WEBMOUNTS']`` with ``$GLOBALS['BE_USER']->returnWebmounts()``.
index 5b9c0ff..d159253 100644 (file)
@@ -99,7 +99,6 @@ class ElementBrowserController {
                }
                if ($altMountPoints) {
                        $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $altMountPoints)));
-                       $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
                }
                $this->content = '';
                // Look for alternative mountpoints
@@ -111,7 +110,6 @@ class ElementBrowserController {
                                $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
                                if ($altMountPoints) {
                                        $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $altMountPoints)));
-                                       $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
                                }
                }
                // Render type by user func
index 672b065..ba438d6 100644 (file)
@@ -54,7 +54,6 @@ class BrowseLinksController {
                }
                if ($altMountPoints) {
                        $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $altMountPoints)));
-                       $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
                }
                // Setting alternative file browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
                $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
index 703a45e..873151b 100644 (file)
@@ -192,7 +192,6 @@ class Abbreviation extends \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi {
                        if ($altMountPoints) {
                                $savedGroupDataWebmounts = $GLOBALS['BE_USER']->groupData['webmounts'];
                                $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $altMountPoints)));
-                               $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
                        }
                        $webMounts = $GLOBALS['BE_USER']->returnWebmounts();
                        $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
@@ -210,7 +209,6 @@ class Abbreviation extends \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi {
                        // Restoring webmounts
                        if ($altMountPoints) {
                                $GLOBALS['BE_USER']->groupData['webmounts'] = $savedGroupDataWebmounts;
-                               $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
                        }
                        $queryGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\QueryGenerator::class);
                        foreach ($pids as $key => $val) {