[TASK] Streamline BE User Initialization with TYPO3_OS 33/37233/2
authorBenjamin Mack <benni@typo3.org>
Wed, 25 Feb 2015 16:40:29 +0000 (17:40 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Wed, 25 Feb 2015 17:14:05 +0000 (18:14 +0100)
The BE User initialization in the core uses the TYPO3_OS
constant in various places. The initialization can be
done in the constructor directly. Also, the property
itself ($BE_USER->OS) is not in use directly by the core
and it is encouraged to use the constant directly. The
property is therefore marked for deprecation.

Releases: master
Resolves: #65343
Change-Id: I527f871bab419274c5a712a6a146d978be13d5cf
Reviewed-on: http://review.typo3.org/37233
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-65343-BackendUserOsProperty.rst [new file with mode: 0644]
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/setup/Classes/Controller/SetupModuleController.php
typo3/sysext/version/Classes/Hook/PreviewHook.php

index 56379b2..70439dc 100644 (file)
@@ -121,6 +121,7 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
        /**
         * Set to 'WIN', if windows
         * @var string
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the constant TYPO3_OS directly
         */
        public $OS = '';
 
@@ -325,6 +326,7 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
                parent::__construct();
                $this->name = self::getCookieName();
                $this->loginType = 'BE';
+               $this->OS = TYPO3_OS;
        }
 
        /**
index 87e5704..4ef6ff0 100644 (file)
@@ -1027,7 +1027,6 @@ class Bootstrap {
                $backendUser->warningEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'];
                $backendUser->lockIP = $GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'];
                $backendUser->auth_timeout_field = (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'];
-               $backendUser->OS = TYPO3_OS;
                if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
                        $backendUser->dontSetCookie = TRUE;
                }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65343-BackendUserOsProperty.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65343-BackendUserOsProperty.rst
new file mode 100644 (file)
index 0000000..cd59c4c
--- /dev/null
@@ -0,0 +1,20 @@
+============================================
+Deprecation: #64134 - Deprecate $BE_USER->OS
+============================================
+
+Description
+===========
+
+The public property in the global object ``$BE_USER->OS`` has been marked as deprecated.
+
+
+Affected installations
+======================
+
+Instances with extensions that make use of the public property directly.
+
+
+Migration
+=========
+
+Use the constant TYPO3_OS directly.
index a0b67da..0ae349d 100644 (file)
@@ -1158,7 +1158,6 @@ class TypoScriptFrontendController {
                        // disable login-attempts to the backend account through this script
                        // New backend user object
                        $BE_USER = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\FrontendBackendUserAuthentication::class);
-                       $BE_USER->OS = TYPO3_OS;
                        $BE_USER->lockIP = $this->TYPO3_CONF_VARS['BE']['lockIP'];
                        // Object is initialized
                        $BE_USER->start();
@@ -1171,7 +1170,6 @@ class TypoScriptFrontendController {
                        if (!$BE_USER->checkLockToIP() || !$BE_USER->checkBackendAccessSettingsFromInitPhp() || empty($BE_USER->user['uid'])) {
                                $BE_USER = NULL;
                                $this->beUserLogin = FALSE;
-                               $_SESSION['TYPO3-TT-start'] = FALSE;
                        }
                        $GLOBALS['TT']->pull();
                        $GLOBALS['TYPO3_MISC']['microtime_BE_USER_end'] = microtime(TRUE);
index 4fd772c..16501f9 100644 (file)
@@ -692,7 +692,6 @@ class SetupModuleController {
                        // Unset current
                        // New backend user object
                        $BE_USER = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
-                       $BE_USER->OS = TYPO3_OS;
                        $BE_USER->setBeUserByUid($this->simUser);
                        $BE_USER->fetchGroupData();
                        $BE_USER->backendSetUC();
index f4020bd..d8ddd2d 100644 (file)
@@ -96,7 +96,6 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface {
                        // New backend user object
                        $BE_USER = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\FrontendBackendUserAuthentication::class);
                        $BE_USER->userTS_dontGetCached = 1;
-                       $BE_USER->OS = TYPO3_OS;
                        $BE_USER->setBeUserByUid($this->previewConfiguration['BEUSER_uid']);
                        $BE_USER->unpack_uc('');
                        if ($BE_USER->user['uid']) {
@@ -105,7 +104,6 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface {
                        } else {
                                $BE_USER = NULL;
                                $pObj->beUserLogin = FALSE;
-                               $_SESSION['TYPO3-TT-start'] = FALSE;
                        }
                        $params['BE_USER'] = $BE_USER;
                }