[FEATURE] Migrate more TS conditions#383
Conversation
8f5173b to
7a4db19
Compare
|
Please fix the code style by running:
And do a rebase, we only allow rebased commits. |
1cf64f9 to
32be102
Compare
|
I just noticed that the loginUser and usergroup is already handled in MigrateTypoScriptLoginUserAndUsergroupConditionsFractor. What do you think? Should we remove that rule again and use yours or you remove these migrations and only handle the globalVar? |
32be102 to
fadfb9a
Compare
...igrateTypoScriptLoginUserAndUsergroupConditionsFractor/Fixtures/fixture30.typoscript.fixture
Show resolved
Hide resolved
...ractor/rules/TYPO3v12/TypoScript/MigrateTypoScriptLoginUserAndUsergroupConditionsFractor.php
Show resolved
Hide resolved
0cc7204 to
5467ef8
Compare
Migrations for v10:
| Legacy condition | Migrated (v10 syntax) |
| ----------------------------------------------- | ----------------------------------------------------------------------- |
| `[globalVar = GP:key > 0]` | `[request && traverse(request.getQueryParams(), 'key') > 0]` |
| `[globalVar = GP:tx_ext|field > 0]` | `[request && traverse(request.getQueryParams(), 'tx_ext/field') > 0]` |
| `[globalVar = GP:tx_ext|field !=]` | `[request && traverse(request.getQueryParams(), 'tx_ext/field') != ""]` |
| `[globalVar = TSFE:id = {$page.home}]` | `[page["uid"] == {$page.home}]` |
| `[globalVar = TSFE:page|doktype = 3]` | `[page["doktype"] == 3]` |
| `[globalVar = TSFE:type = 1449874941]` | `[getTSFE().type == 1449874941]` |
| `[globalVar = TSFE:beUserLogin = 1]` | `[getTSFE().beUserLogin == 1]` |
| `[globalVar = LIT:1 = {$const}]` | `[{$const} == 1]` |
| `[globalVar = LIT:1 != {$const}]` | `[{$const} != 1]` |
| `[globalVar = BE_USER|user|admin = 1]` | `[backend.user.isAdmin]` |
| `[globalString = IENV:HTTP_HOST = example.org]` | `[request.getNormalizedParams().getHttpHost() == "example.org"]` |
| `[globalString = TSFE:id=2111]` | `[page["uid"] == 2111]` |
| `[PIDinRootline = 89,130]` | `[89 in tree.rootLineIds || 130 in tree.rootLineIds]` |
| `[PIDinRootline = {$page.foo}]` | `[{$page.foo} in tree.rootLineIds]` |
| `[PIDupinRootline = 89,130]` | `[89 in tree.rootLineParentIds || 130 in tree.rootLineParentIds]` |
| `[applicationContext = Development]` | `[applicationContext == "Development"]` |
| `[applicationContext = Development*]` | `[like(applicationContext, "Development*")]` |
| `[treeLevel = 1,3]` | `[tree.level in [1,3]]` |
And for v12:
| v10 syntax | Migrated (v12 syntax) |
| ------------------------------------ | ---------------------------------------------------------------------- |
| `[loginUser = *]` | `[frontend.user.isLoggedIn]` |
| `[usergroup = *]` | `[frontend.user.userGroupIds !== [0, -1]]` |
| `[usergroup = 1,2]` | `[1 in frontend.user.userGroupIds || 2 in frontend.user.userGroupIds]` |
| `[globalVar = TSFE:type = 9818]` | `[request.getPageArguments()?.getPageType() == '9818']` |
| `[globalVar = TSFE:beUserLogin > 0]` | `[getTSFE()?.isBackendUserLoggedIn()]` |
5467ef8 to
f8b6a19
Compare
|
It's really hard to review this when your stupid AI deletes existing fixture files and tries to number them differently. I wonder how you allowed your AI to do that. Copilot doesn't do these crazy things. |
|
I changed the filenames manually 🙈 To kinda group them. Does that make sense? |
|
ok, sorry to blame the AI :D I just wanted to check if all the tests are still there because usually git shows it as moved files but right now they are deleted and created. |
|
Thank you very much for your contributions! I really appreciate them! I've just created a new release. |
Migrations for v10:
[globalVar = GP:key > 0][request && traverse(request.getQueryParams(), 'key') > 0][globalVar = GP:tx_ext|field > 0][request && traverse(request.getQueryParams(), 'tx_ext/field') > 0][globalVar = GP:tx_ext|field !=][request && traverse(request.getQueryParams(), 'tx_ext/field') != ""][globalVar = TSFE:id = {$page.home}][page["uid"] == {$page.home}][globalVar = TSFE:page|doktype = 3][page["doktype"] == 3][globalVar = TSFE:type = 1449874941][getTSFE().type == 1449874941][globalVar = TSFE:beUserLogin = 1][getTSFE().beUserLogin == 1][globalVar = LIT:1 = {$const}][{$const} == 1][globalVar = LIT:1 != {$const}][{$const} != 1][globalVar = BE_USER|user|admin = 1][backend.user.isAdmin][globalString = IENV:HTTP_HOST = example.org][request.getNormalizedParams().getHttpHost() == "example.org"][globalString = TSFE:id=2111][page["uid"] == 2111][PIDinRootline = 89,130][89 in tree.rootLineIds || 130 in tree.rootLineIds][PIDinRootline = {$page.foo}][{$page.foo} in tree.rootLineIds][PIDupinRootline = 89,130][89 in tree.rootLineParentIds || 130 in tree.rootLineParentIds][applicationContext = Development][applicationContext == "Development"][applicationContext = Development*][like(applicationContext, "Development*")][treeLevel = 1,3][tree.level in [1,3]]And for v12:
[loginUser = *][frontend.user.isLoggedIn][usergroup = *][frontend.user.userGroupIds !== [0, -1]][usergroup = 1,2][1 in frontend.user.userGroupIds || 2 in frontend.user.userGroupIds][globalVar = TSFE:type = 9818][request.getPageArguments()?.getPageType() == '9818'][globalVar = TSFE:beUserLogin > 0][getTSFE()?.isBackendUserLoggedIn()]