[TASK] Deprecate BackendUserAuthentication->addTScomment() 33/56933/5
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 12 May 2018 12:13:38 +0000 (14:13 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 12 May 2018 12:43:31 +0000 (14:43 +0200)
addTScomment() adds comment strings to user TSconfig before
parse time. This is rather useless since the unparsed final
TSconfig is never shown in the backend. The patch removes
usages and deprecates the method to reduce complexity of
this huge class a tiny little bit.

Resolves: #84980
Releases: master
Change-Id: Ib37561895205fb6f983fa5bba2541fe9e4c61941
Reviewed-on: https://review.typo3.org/56933
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: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-84980-BackendUserAuthentication-addTScommentDeprecated.rst [new file with mode: 0644]
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php

index c153fc6..364baa8 100644 (file)
@@ -1323,13 +1323,10 @@ class BackendUserAuthentication extends AbstractUserAuthentication
             // Fileoperation permissions
             $this->dataLists['file_permissions'] = $this->user['file_permissions'];
             // Setting default User TSconfig:
-            $this->TSdataArray[] = $this->addTScomment('From $GLOBALS["TYPO3_CONF_VARS"]["BE"]["defaultUserTSconfig"]:')
-                . $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'];
+            $this->TSdataArray[] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'];
             // Default TSconfig for admin-users
             if ($this->isAdmin()) {
-                $this->TSdataArray[] = $this->addTScomment('"admin" user presets:') . '
-                                       admPanel.enable.all = 1
-                               ';
+                $this->TSdataArray[] = 'admPanel.enable.all = 1';
                 if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sys_note')) {
                     $this->TSdataArray[] = '
                                                        // Setting defaults for sys_note author / email...
@@ -1355,7 +1352,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
             $this->setCachedList($this->groupList);
 
             // Add the TSconfig for this specific user:
-            $this->TSdataArray[] = $this->addTScomment('USER TSconfig field') . $this->user['TSconfig'];
+            $this->TSdataArray[] = $this->user['TSconfig'];
             // Check include lines.
             $this->TSdataArray = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines_array($this->TSdataArray);
             // Imploding with "[global]" will make sure that non-ended confinements with braces are ignored.
@@ -1506,7 +1503,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
                 }
                 // Add the group uid, current list, TSconfig to the internal arrays.
                 $this->includeGroupArray[] = $uid;
-                $this->TSdataArray[] = $this->addTScomment('Group "' . $row['title'] . '" [' . $row['uid'] . '] TSconfig field:') . $row['TSconfig'];
+                $this->TSdataArray[] = $row['TSconfig'];
                 // Mount group database-mounts
                 if (($this->user['options'] & Permission::PAGE_SHOW) == 1) {
                     $this->dataLists['webmount_list'] .= ',' . $row['db_mountpoints'];
@@ -2020,9 +2017,11 @@ class BackendUserAuthentication extends AbstractUserAuthentication
      *
      * @param string $str The text to wrap in comment prefixes and delimiters.
      * @return string TypoScript comment with the string text inside.
+     * @deprecated since core v9, will be removed with core v10
      */
     public function addTScomment($str)
     {
+        trigger_error('This method will be removed in TYPO3 v10.', E_USER_DEPRECATED);
         $delimiter = '# ***********************************************';
         $out = $delimiter . LF;
         $lines = GeneralUtility::trimExplode(LF, $str);
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84980-BackendUserAuthentication-addTScommentDeprecated.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84980-BackendUserAuthentication-addTScommentDeprecated.rst
new file mode 100644 (file)
index 0000000..c03eaa0
--- /dev/null
@@ -0,0 +1,36 @@
+.. include:: ../../Includes.txt
+
+==========================================================================
+Deprecation: #84980 - BackendUserAuthentication->addTScomment() deprecated
+==========================================================================
+
+See :issue:`84980`
+
+Description
+===========
+
+Method :php:`TYPO3\CMS\Core\Authentication\BackendUserAuthentication->addTScomment()` has been deprecated.
+
+
+Impact
+======
+
+The method has been used to add comments to `TSconfig` at runtime, those
+comments however are never shown in the TYPO3 backend.
+
+
+Affected Installations
+======================
+
+Instances with extensions calling :php:`BackendUserAuthentication->addTScomment()`
+will throw a deprecation warning. It is however rather unlikely that extensions
+rely on this widely unknown API method and methods calls were mostly core internal.
+The extension scanner should find possible usages within extensions.
+
+
+Migration
+=========
+
+Drop the method call.
+
+.. index:: Backend, PHP-API, TSConfig, FullyScanned
\ No newline at end of file
index e94bd50..e45dd69 100644 (file)
@@ -2172,4 +2172,11 @@ return [
             'Deprecation-84965-VariousTypoScriptFrontendControllerMethods.rst',
         ],
     ],
+    'TYPO3\CMS\Core\Authentication\BackendUserAuthentication->addTScomment' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Deprecation-84980-BackendUserAuthentication-addTScommentDeprecated.rst',
+        ],
+    ],
 ];