[!!!][TASK] Remove old typoscript constants "TSConstantEditor" 48/54048/6
authorMarkus Hoelzle <typo3@markus-hoelzle.de>
Fri, 8 Sep 2017 22:38:12 +0000 (00:38 +0200)
committerBenni Mack <benni@typo3.org>
Sat, 9 Sep 2017 14:00:02 +0000 (16:00 +0200)
Remove support for the special constant "TSConstantEditor".
This constant was used to show additional helping information
in the constants editor and is dropped as ancient and widely
unknown and rarely used feature.

Releases: master
Resolves: #82398
Change-Id: I9825ca5a321c6c92159a5cd94ca5ed6c9ea1d0ff
Reviewed-on: https://review.typo3.org/54048
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Markus Hölzle <typo3@markus-hoelzle.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
15 files changed:
typo3/sysext/core/Classes/TypoScript/ConfigurationForm.php
typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
typo3/sysext/core/Classes/TypoScript/TemplateService.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst [new file with mode: 0644]
typo3/sysext/extensionmanager/Classes/Domain/Model/ConfigurationCategory.php
typo3/sysext/extensionmanager/Classes/Domain/Model/ConfigurationItem.php
typo3/sysext/extensionmanager/Classes/Domain/Repository/ConfigurationItemRepository.php
typo3/sysext/extensionmanager/Classes/Utility/ConfigurationUtility.php
typo3/sysext/extensionmanager/Resources/Private/Templates/Configuration/ShowConfigurationForm.html
typo3/sysext/extensionmanager/Tests/Unit/Domain/Repository/ConfigurationItemRepositoryTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ConfigurationUtilityTest.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php
typo3/sysext/tstemplate/Resources/Private/Templates/ConstantEditor.html

index 4ef239f..cb75f2f 100644 (file)
@@ -100,14 +100,6 @@ class ConfigurationForm extends ExtendedTemplateService
         return $this->ext_getCategoryLabelArray();
     }
 
-    /**
-     * @param string $cat
-     */
-    public function ext_makeHelpInformationForCategory($cat)
-    {
-        $this->ext_getTSCE_config($cat);
-    }
-
     /**
      * Get the form for extension configuration
      *
@@ -121,7 +113,6 @@ class ConfigurationForm extends ExtendedTemplateService
      */
     public function ext_getForm($cat, $theConstants, $script = '', $addFields = '', $extKey = '', $addFormTag = true)
     {
-        $this->ext_makeHelpInformationForCategory($cat);
         $printFields = trim($this->ext_printFields($theConstants, $cat));
         $content = '';
         $content .= GeneralUtility::wrapJS('
@@ -135,26 +126,9 @@ class ConfigurationForm extends ExtendedTemplateService
         $content .= $addFields;
         $content .= $printFields;
         $content .= '<input class="btn btn-default" type="submit" name="submit" value="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_tsfe.xlf:update')) . '" id="configuration-submit-' . htmlspecialchars($extKey) . '" />';
-        $example = $this->ext_displayExample();
-        $content .= $example ? '<hr/>' . $example : '';
         return $content;
     }
 
-    /**
-     * Display example
-     *
-     * @return string
-     */
-    public function ext_displayExample()
-    {
-        $out = '';
-        if ($this->helpConfig['description'] || $this->helpConfig['header']) {
-            $out = ($this->helpConfig['description'] ? implode(explode('//', $this->helpConfig['description']), '<br />') . '<br />' : '')
-                . ($this->helpConfig['bulletlist'] ? '<ul><li>' . implode(explode('//', $this->helpConfig['bulletlist']), '<li>') . '</ul>' : '<BR>');
-        }
-        return $out;
-    }
-
     /**
      * Merge incoming with existing
      *
index 97e1f64..ee920bf 100644 (file)
@@ -219,11 +219,6 @@ class ExtendedTemplateService extends TemplateService
      */
     public $linkObjects = false;
 
-    /**
-     * @var array
-     */
-    public $helpConfig = [];
-
     /**
      * @var bool
      */
@@ -1081,37 +1076,6 @@ class ExtendedTemplateService extends TemplateService
         return $retArr;
     }
 
-    /**
-     * @param string $category
-     */
-    public function ext_getTSCE_config($category)
-    {
-        $catConf = $this->setup['constants']['TSConstantEditor.'][$category . '.'];
-        $out = [];
-        if (is_array($catConf)) {
-            foreach ($catConf as $key => $val) {
-                switch ($key) {
-                    case 'description':
-                    case 'bulletlist':
-                    case 'header':
-                        $out[$key] = $val;
-                        break;
-                    default:
-                        if (MathUtility::canBeInterpretedAsInteger($key)) {
-                            $constRefs = explode(',', $val);
-                            foreach ($constRefs as $const) {
-                                $const = trim($const);
-                                if ($const) {
-                                    $out['constants'][$const] .= '<span class="label label-danger">' . $key . '</span>';
-                                }
-                            }
-                        }
-                }
-            }
-        }
-        $this->helpConfig = $out;
-    }
-
     /**
      * @param array $params
      * @return array
@@ -1142,7 +1106,6 @@ class ExtendedTemplateService extends TemplateService
         $output = '';
         $subcat = '';
         if (is_array($this->categories[$category])) {
-            $help = $this->helpConfig;
             if (!$this->doNotSortCategoriesBeforeMakingForm) {
                 asort($this->categories[$category]);
             }
@@ -1351,7 +1314,7 @@ class ExtendedTemplateService extends TemplateService
 
                     $output .=
                         '<fieldset class="form-section">'
-                            . '<a name="' . $raname . '"></a>' . $help['constants'][$params['name']]
+                            . '<a name="' . $raname . '"></a>'
                             . '<div class="form-group">'
                                 . $constantLabel . $constantName . $constantDescription . $constantData
                             . '</div>'
index f2a7930..c1943df 100644 (file)
@@ -1266,13 +1266,10 @@ class TemplateService
     {
         if (is_array($setupArray)) {
             foreach ($setupArray as $key => $val) {
-                if ($prefix || strpos($key, 'TSConstantEditor') !== 0) {
-                    // We don't want 'TSConstantEditor' in the flattened setup on the first level (190201)
-                    if (is_array($val)) {
-                        $this->flattenSetup($val, $prefix . $key);
-                    } else {
-                        $this->flatSetup[$prefix . $key] = $val;
-                    }
+                if (is_array($val)) {
+                    $this->flattenSetup($val, $prefix . $key);
+                } else {
+                    $this->flatSetup[$prefix . $key] = $val;
                 }
             }
         }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst
new file mode 100644 (file)
index 0000000..c192f9e
--- /dev/null
@@ -0,0 +1,41 @@
+.. include:: ../../Includes.txt
+
+=============================================================
+Breaking: #82398 - Remove special constant "TSConstantEditor"
+=============================================================
+
+See :issue:`82398`
+
+Description
+===========
+
+The special functionality on the top level constant name `TSConstantEditor`
+has been dropped. This rarely used feature makes this constant name a casual
+constant without further added features.
+
+A series of PHP class methods and properties has been dropped together with that removal:
+
+* Method :php:`TYPO3\CMS\Core\TypoScript\ConfigurationForm->ext_makeHelpInformationForCategory()`
+* Method :php:`TYPO3\CMS\Core\TypoScript\ConfigurationForm->ext_displayExample()`
+* Method :php:`TYPO3\CMS\Core\TypoScript\ExtendedTemplateService->ext_getTSCE_config()`
+* Property :php:`TYPO3\CMS\Core\TypoScript\ExtendedTemplateService->helpConfig`
+* Method :php:`TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationCategory->setHighlightText()`
+* Method :php:`TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationCategory->getHighlightText()`
+* Method :php:`TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem->setHighlight()`
+* Method :php:`TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem->getHighlight()`
+
+Impact
+======
+
+The constants editor does not show any extending information (like bulletpoints) for a constant
+anymore configured via the `TSConstantEditor` object.
+
+
+Affected Installations
+======================
+
+All installations which have configured the special constant "TSConstantEditor". Since this has
+been a widely unknown feature, most instances should not be affected. On PHP side, the extension
+scanner will find consuming extensions of the dropped API, but that is highly unlikely, too.
+
+.. index:: Backend, TypoScript, FullyScanned
index ca20533..97457e6 100644 (file)
@@ -29,11 +29,6 @@ class ConfigurationCategory extends \TYPO3\CMS\Extbase\DomainObject\AbstractEnti
      */
     protected $subcategories;
 
-    /**
-     * @var string
-     */
-    protected $highlightText = '';
-
     /**
      * Constructs this Category
      */
@@ -83,20 +78,4 @@ class ConfigurationCategory extends \TYPO3\CMS\Extbase\DomainObject\AbstractEnti
     {
         return $this->name;
     }
-
-    /**
-     * @param string $highlightText
-     */
-    public function setHighlightText($highlightText)
-    {
-        $this->highlightText = $highlightText;
-    }
-
-    /**
-     * @return string
-     */
-    public function getHighlightText()
-    {
-        return $this->highlightText;
-    }
 }
index 5c168f9..7af7ed0 100644 (file)
@@ -59,11 +59,6 @@ class ConfigurationItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
      */
     protected $value = '';
 
-    /**
-     * @var int
-     */
-    protected $highlight = 0;
-
     /**
      * @param string $category
      */
@@ -191,20 +186,4 @@ class ConfigurationItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
     {
         return $this->value;
     }
-
-    /**
-     * @param int $highlight
-     */
-    public function setHighlight($highlight)
-    {
-        $this->highlight = $highlight;
-    }
-
-    /**
-     * @return int
-     */
-    public function getHighlight()
-    {
-        return $this->highlight;
-    }
 }
index 0c35733..c983d84 100644 (file)
@@ -61,7 +61,6 @@ class ConfigurationItemRepository
 
         $resultArray = [];
         if (!empty($configuration)) {
-            $metaInformation = $this->addMetaInformation($configuration);
             $hierarchicConfiguration = [];
             foreach ($configuration as $configurationOption) {
                 $originalConfiguration = $this->buildConfigurationArray($configurationOption, $extensionKey);
@@ -82,8 +81,6 @@ class ConfigurationItemRepository
                 unset($subcatConfigurationArray);
             }
             unset($tempConfiguration);
-
-            ArrayUtility::mergeRecursiveWithOverrule($hierarchicConfiguration, $metaInformation);
             $resultArray = $hierarchicConfiguration;
         }
 
@@ -152,20 +149,6 @@ class ConfigurationItemRepository
         return $configurationOption;
     }
 
-    /**
-     * Gets meta information from configuration array and
-     * returns only the meta information
-     *
-     * @param array $configuration
-     * @return array
-     */
-    protected function addMetaInformation(&$configuration)
-    {
-        $metaInformation = $configuration['__meta__'] ?: [];
-        unset($configuration['__meta__']);
-        return $metaInformation;
-    }
-
     /**
      * Converts a hierarchic configuration array to an
      * hierarchic object storage structure
@@ -180,10 +163,6 @@ class ConfigurationItemRepository
             /** @var $configurationCategoryObject \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationCategory */
             $configurationCategoryObject = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationCategory::class);
             $configurationCategoryObject->setName($category);
-            if ($subcategory['highlightText']) {
-                $configurationCategoryObject->setHighlightText($subcategory['highlightText']);
-                unset($subcategory['highlightText']);
-            }
             foreach ($subcategory as $subcatName => $configurationItems) {
                 /** @var $configurationSubcategoryObject \TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationSubcategory */
                 $configurationSubcategoryObject = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationSubcategory::class);
@@ -223,9 +202,6 @@ class ConfigurationItemRepository
                     if (isset($configurationItem['value'])) {
                         $configurationObject->setValue($configurationItem['value']);
                     }
-                    if (isset($configurationItem['highlight'])) {
-                        $configurationObject->setHighlight($configurationItem['highlight']);
-                    }
                     $configurationSubcategoryObject->addItem($configurationObject);
                 }
                 $configurationCategoryObject->addSubcategory($configurationSubcategoryObject);
index 1f3600c..63bedda 100644 (file)
@@ -98,9 +98,6 @@ class ConfigurationUtility implements \TYPO3\CMS\Core\SingletonInterface
      * Create a flat array of configuration options from
      * ext_conf_template.txt of an extension using core's typoscript parser.
      *
-     * Generates an array from the typoscript style constants and
-     * adds meta data like TSConstantEditor comments
-     *
      * Result is an array, with configuration item as array keys,
      * and item properties as key-value sub-array:
      *
@@ -145,18 +142,6 @@ class ConfigurationUtility implements \TYPO3\CMS\Core\SingletonInterface
                     $theConstants[$configurationOptionName]['subcat_label'] = $tsStyleConfig->subCategories[$configurationOption['subcat_name']][0];
                 }
             }
-
-            // Set up the additional descriptions
-            if (isset($tsStyleConfig->setup['constants']['TSConstantEditor.'])) {
-                foreach ($tsStyleConfig->setup['constants']['TSConstantEditor.'] as $category => $highlights) {
-                    $theConstants['__meta__'][rtrim($category, '.')]['highlightText'] = $highlights['description'];
-                    foreach ($highlights as $highlightNumber => $value) {
-                        if (rtrim($category, '.') == $theConstants[$value]['cat']) {
-                            $theConstants[$value]['highlight'] = $highlightNumber;
-                        }
-                    }
-                }
-            }
         }
 
         return $theConstants;
index 9f60501..cfcfe6f 100644 (file)
@@ -56,9 +56,6 @@
                                                                                                        </f:if>
                                                                                                </span>
                                                                                        </label>
-                                                                                       <f:if condition="{item.highlight}">
-                                                                                               <p class="text-danger">{item.highlight}</p>
-                                                                                       </f:if>
                                                                                        <div class="form-control-wrap">
                                                                                                <em:form.typoScriptConstants configuration="{item}" />
                                                                                        </div>
@@ -69,9 +66,6 @@
                                                                        </f:for>
                                                                </div>
                                                        </f:for>
-                                                       <f:if condition="{category.highlightText}">
-                                                               {category.highlightText->f:format.raw()}
-                                                       </f:if>
                                                </div>
                                        </f:if>
                                </f:for>
index f373847..e22dada 100644 (file)
@@ -171,32 +171,6 @@ class ConfigurationItemRepositoryTest extends \TYPO3\TestingFramework\Core\Unit\
         );
     }
 
-    /**
-     * @test
-     */
-    public function addMetaInformationUnsetsOriginalConfigurationMetaKey()
-    {
-        $configuration = [
-            '__meta__' => 'metaInformation',
-            'test123' => 'test123'
-        ];
-        $this->configurationItemRepository->_callRef('addMetaInformation', $configuration);
-        $this->assertEquals(['test123' => 'test123'], $configuration);
-    }
-
-    /**
-     * @test
-     */
-    public function addMetaInformationReturnsMetaInformation()
-    {
-        $configuration = [
-            '__meta__' => 'metaInformation',
-            'test123' => 'test123'
-        ];
-        $meta = $this->configurationItemRepository->_callRef('addMetaInformation', $configuration);
-        $this->assertEquals('metaInformation', $meta);
-    }
-
     /**
      * @return array
      */
index 54c5f40..e9949c7 100644 (file)
@@ -161,14 +161,6 @@ class ConfigurationUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
             ->method('ext_initTSstyleConfig')
             ->will($this->returnValue($constants));
 
-        $setupTsConstantEditor = [
-            'advancedbackend.' => [
-                'description' => '<span style="background:red; padding:1px 2px; color:#fff; font-weight:bold;">1</span> Install tool has hardcoded md5 hashing, enabling this setting will prevent use of a install-tool-created BE user.<br />Currently same is for changin password with user setup module unless you use pending patch!',
-                1 => 'BE.forceSalted'
-            ]
-        ];
-        $tsStyleConfig->setup['constants']['TSConstantEditor.'] = $setupTsConstantEditor;
-
         $expected = [
             'checkConfigurationFE' => [
                 'cat' => 'basic',
@@ -189,13 +181,7 @@ class ConfigurationUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                 'name' => 'BE.forceSalted',
                 'value' => '0',
                 'default_value' => '0',
-                'highlight' => 1,
             ],
-            '__meta__' => [
-                'advancedbackend' => [
-                    'highlightText' => '<span style="background:red; padding:1px 2px; color:#fff; font-weight:bold;">1</span> Install tool has hardcoded md5 hashing, enabling this setting will prevent use of a install-tool-created BE user.<br />Currently same is for changin password with user setup module unless you use pending patch!'
-                ]
-            ]
         ];
 
         $result = $configurationUtility->getDefaultConfigurationFromExtConfTemplateAsValuedArray($this->getUniqueId('some_extension'));
index 715c290..25852d9 100644 (file)
@@ -1177,4 +1177,53 @@ return [
             'Breaking-55298-DecoupledHistoryFunctionality.rst',
         ],
     ],
+    'TYPO3\CMS\Core\TypoScript\ConfigurationForm->ext_makeHelpInformationForCategory' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
+        ],
+    ],
+    'TYPO3\CMS\Core\TypoScript\ConfigurationForm->ext_displayExample' => [
+        'numberOfMandatoryArguments' => 0,
+        'maximumNumberOfArguments' => 0,
+        'restFiles' => [
+            'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
+        ],
+    ],
+    'TYPO3\CMS\Core\TypoScript\ExtendedTemplateService->ext_getTSCE_config' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationCategory->setHighlightText' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationCategory->getHighlightText' => [
+        'numberOfMandatoryArguments' => 0,
+        'maximumNumberOfArguments' => 0,
+        'restFiles' => [
+            'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem->setHighlight' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extensionmanager\Domain\Model\ConfigurationItem->getHighlight' => [
+        'numberOfMandatoryArguments' => 0,
+        'maximumNumberOfArguments' => 0,
+        'restFiles' => [
+            'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
+        ],
+    ],
 ];
index 4c2432e..15010cd 100644 (file)
@@ -179,6 +179,11 @@ return [
             'Breaking-55298-DecoupledHistoryFunctionality.rst',
         ],
     ],
+    'TYPO3\CMS\Core\TypoScript\ExtendedTemplateService->helpConfig' => [
+        'restFiles' => [
+            'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
+        ],
+    ],
 
     // Deprecated public properties
 ];
index a1edcfe..4de03c7 100644 (file)
@@ -83,22 +83,6 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
         return false;
     }
 
-    /**
-     * Get the data for display of an example
-     *
-     * @return array
-     */
-    public function getHelpConfig()
-    {
-        $result = [];
-        if ($this->templateService->helpConfig['description'] || $this->templateService->helpConfig['header']) {
-            $result['header'] = $this->templateService->helpConfig['header'];
-            $result['description'] = explode('//', $this->templateService->helpConfig['description']);
-            $result['bulletList'] = explode('//', $this->templateService->helpConfig['bulletlist']);
-        }
-        return $result;
-    }
-
     /**
      * Main
      *
@@ -157,7 +141,6 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
             }
             // Category and constant editor config:
             $category = $this->pObj->MOD_SETTINGS['constant_editor_cat'];
-            $this->templateService->ext_getTSCE_config($category);
 
             $printFields = trim($this->templateService->ext_printFields($this->constants, $category));
             foreach ($this->templateService->getInlineJavaScript() as $name => $inlineJavaScript) {
@@ -167,10 +150,6 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
             if ($printFields) {
                 $assigns['printFields'] = $printFields;
             }
-            $BE_USER_modOptions = BackendUtility::getModTSconfig(0, 'mod.' . $this->pObj->MCONF['name']);
-            if ($BE_USER_modOptions['properties']['constantEditor.']['example'] !== 'top') {
-                $assigns['helpConfig'] = $this->getHelpConfig();
-            }
             // Rendering of the output via fluid
             $view = GeneralUtility::makeInstance(StandaloneView::class);
             $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
index 78640f4..db4d7f0 100644 (file)
             </f:format.raw>
         </div>
     </f:if>
-    <f:if condition="{helpConfig.header}">
-        <div style="padding-top: 30px;"></div>
-        <div>
-            {helpConfig.header}<br>
-            <f:if condition="{helpConfig.description}">
-                <f:for each="{helpConfig.description}" as="line">
-                    {line}<br>
-                </f:for>
-            </f:if>
-            <f:if condition="{helpConfig.bulletList}">
-                <ul>
-                <f:for each="{helpConfig.bulletList}" as="line">
-                    <li>{line}</li>
-                </f:for>
-                </ul>
-            </f:if>
-        </div>
-    </f:if>
 </div>