这个旧的打字条件有什么作用,我如何用 Symfony 表达式表达它?

What does this old typoscript condition do and how to I express it with Symfony Expressions?

我正在将 TYPO3 (6.x) 的旧实例更新为 TYPO3 9.5. 每次加载页面时,我都会在日志文件中收到投诉,例如:

[WARNING] request="bc60e12f63cf8" component="TYPO3.CMS.Frontend.Configuration.TypoScript.ConditionMatching.ConditionMatcher": Expression could not be parsed, fallback kicks in. It looks like an old condition with only one equal sign. - {"expression":"globalVar = TSFE : beUserLogin > 0"}

从第 9 版开始,TYPO 使用一种称为 Symfony 的用于 Typoscript 的 nex 表达式语言。我找到了很好的文档。但是,我找不到任何关于旧语法的文档。

[globalVar = TSFE : beUserLogin > 0]
[globalVar = GP:L = 1]
[globalString = IENV:HTTP_HOST=www.domain.de]

我想“=”是 euqals 运算符,错误消息已经提示了如何修复它。但是我不知道这些语句中的“:”是什么。我猜它是 "AND" 或 "OR" 运算符。但我不确定。在理解这些陈述方面的任何帮助都将极大地帮助我将它们转移到新标准。

[globalVar = TSFE : beUserLogin > 0] 用户是否登录后台?

[globalVar = GP:L = 1] 语言 UID 是否等于 1?

[globalString = IENV:HTTP_HOST=www.domain.de] 环境宿主是否等于www.domain.de?

可以在与实际文件相同的位置找到旧的错字文档。只需更改左栏底部的版本即可。 https://docs.typo3.org/m/typo3/reference-typoscript/6.2/en-us/Conditions/Reference/Index.html

Caring about this means that you would get values like HTTP_HOST by getenv() and you would retrieve GET/POST values with TYPO3CMSCoreUtilityGeneralUtility::_GP() (t3lib_div::_GP()). Finally a lot of values from the TSFE object are useful. In order to get those values for comparison with “globalVar” and “globalString” conditions, you prefix that variable’s name with either “IENV:”/”ENV:”, “GP:”, “TSFE:” or “LIT:” respectively. Still the “|” divider may be used to separate keys in arrays and/or objects. “LIT” means “literal” and the string after “:” is trimmed and returned as the value (without being divided by “|” or anything)

Note: Using the “IENV:” prefix is highly recommended to get server/environment variables which are system-independent. Basically this will get the value using TYPO3CMSCoreUtilityGeneralUtility::getIndpEnv() (t3lib_div::getIndpEnv()). With “ENV:” you get the raw output from getenv() which is not always the same on all systems!