[TASK] Modernize condition matching
The TypoScript condition matching and our symfony expression language handling is a heavily convoluted mess: The entire API tends to fetch lots of global state, the classes are complex, hard to understand and handle, over-abstracted and full of anti-patterns. The patch aims to mitigate this. The main strategy is to provide relevant data from within callers directly instead of fetching globals TYPO3_REQUEST, calling GeneralUtility::_GP() and GeneralUtility::getIndpEnv(). * For TypoScript 'condition' expression handler usages, the frontend/backend related ConditionMatcher classes are obsoleted. The IncludeTreeConditionMatcherVisitor class within the new TypoScript parser is now the construct that prepares TypoScript relevant variables to initialize the symfony expression language construct, and gets variables actively hand over. * The default provider now prepares variables from state that can be injected, the entire ProviderInterface no longer relies on runtime state from globals. * Access to runtime Request object is streamlined: Especially PageTsConfig and UserTsConfig can not rely on a given request object since the DataHandler uses this a well, which denies systematic usage of request related data. This is deprecated. * The ProviderInterface config handling should still be streamlined towards a symfony service provider approach. The current solution is kept for now, an @todo is added to briefly outline on how this should be changed in v13 as a breaking change. * Note this patch avoids the last core usage of GeneralUtility::_GP() which will be deprecated with another patch. Additionally, a hard to fix call to GeneralUtility::getIndpEnv() is avoided. Change-Id: I476b69776e950a5a7e5ed937d2e2c58fe00f133f Resolves: #100047 Related: #97816 Releases: main Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77981 Tested-by:core-ci <typo3@b13.com> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch>
Showing
- typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php 10 additions, 0 deletions...uration/TypoScript/ConditionMatching/ConditionMatcher.php
- typo3/sysext/backend/Classes/Utility/BackendUtility.php 3 additions, 10 deletionstypo3/sysext/backend/Classes/Utility/BackendUtility.php
- typo3/sysext/backend/Classes/View/BackendLayoutView.php 1 addition, 7 deletionstypo3/sysext/backend/Classes/View/BackendLayoutView.php
- typo3/sysext/backend/Tests/FunctionalDeprecated/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php 1 addition, 1 deletion...ion/TypoScript/ConditionMatching/ConditionMatcherTest.php
- typo3/sysext/backend/Tests/FunctionalDeprecated/Fixtures/pages.csv 9 additions, 0 deletions...ext/backend/Tests/FunctionalDeprecated/Fixtures/pages.csv
- typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php 2 additions, 0 deletions...TypoScript/ConditionMatching/AbstractConditionMatcher.php
- typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcherInterface.php 2 additions, 0 deletions...ypoScript/ConditionMatching/ConditionMatcherInterface.php
- typo3/sysext/core/Classes/ExpressionLanguage/AbstractProvider.php 8 additions, 13 deletions...sext/core/Classes/ExpressionLanguage/AbstractProvider.php
- typo3/sysext/core/Classes/ExpressionLanguage/DefaultProvider.php 22 additions, 3 deletions...ysext/core/Classes/ExpressionLanguage/DefaultProvider.php
- typo3/sysext/core/Classes/ExpressionLanguage/DeprecatingRequestWrapper.php 140 additions, 0 deletions.../Classes/ExpressionLanguage/DeprecatingRequestWrapper.php
- typo3/sysext/core/Classes/ExpressionLanguage/FunctionsProvider/DefaultFunctionsProvider.php 57 additions, 42 deletions...onLanguage/FunctionsProvider/DefaultFunctionsProvider.php
- typo3/sysext/core/Classes/ExpressionLanguage/FunctionsProvider/Typo3ConditionFunctionsProvider.php 60 additions, 51 deletions...age/FunctionsProvider/Typo3ConditionFunctionsProvider.php
- typo3/sysext/core/Classes/ExpressionLanguage/ProviderConfigurationLoader.php 7 additions, 14 deletions...lasses/ExpressionLanguage/ProviderConfigurationLoader.php
- typo3/sysext/core/Classes/ExpressionLanguage/ProviderInterface.php 0 additions, 3 deletions...ext/core/Classes/ExpressionLanguage/ProviderInterface.php
- typo3/sysext/core/Classes/ExpressionLanguage/RequestWrapper.php 7 additions, 7 deletions...sysext/core/Classes/ExpressionLanguage/RequestWrapper.php
- typo3/sysext/core/Classes/ExpressionLanguage/Resolver.php 16 additions, 8 deletionstypo3/sysext/core/Classes/ExpressionLanguage/Resolver.php
- typo3/sysext/core/Classes/ExpressionLanguage/SiteConditionProvider.php 0 additions, 38 deletions...core/Classes/ExpressionLanguage/SiteConditionProvider.php
- typo3/sysext/core/Classes/ExpressionLanguage/TypoScriptConditionProvider.php 3 additions, 14 deletions...lasses/ExpressionLanguage/TypoScriptConditionProvider.php
- typo3/sysext/core/Classes/TypoScript/IncludeTree/Visitor/IncludeTreeConditionMatcherVisitor.php 120 additions, 9 deletions...ncludeTree/Visitor/IncludeTreeConditionMatcherVisitor.php
- typo3/sysext/core/Classes/TypoScript/PageTsConfigFactory.php 20 additions, 6 deletionstypo3/sysext/core/Classes/TypoScript/PageTsConfigFactory.php
Please register or sign in to comment