[TASK] Avoid calls to TemplatePaths constructor
The constructor of Fluid's `TemplatePath` class allowed both a package name and a configuration array (containing `templateRootPaths`, `layoutRootPaths`, `partialRootPaths` and a `format`). It also tried to set defaults for TYPO3, without the base `TemplatePaths` class being part of TYPO3. To streamline Fluid's API and to untangle Fluid's configuration from TYPO3, both constructor variants have been soft-deprecated with Fluid v2.15 and will log deprecation notices with Fluid v4. In preparation of the switch to Fluid v4, all usages of the constructor are removed from the core. A lot of this work has already been done in previous patches. The remaining usages are related to the `FluidEmail` class, which unfortunately uses Fluid's `TemplatePaths` class as API. In all cases, the default mailer configuration is extended, which is part of the system configuration: from DefaultConfiguration.php: ``` 'MAIL' => [ // Mail configurations to tune how \TYPO3\CMS\Core\Mail\ classes will send their mails. //… 'format' => 'both', 'layoutRootPaths' => [ 0 => 'EXT:core/Resources/Private/Layouts/', 10 => 'EXT:backend/Resources/Private/Layouts/', ], 'partialRootPaths' => [ 0 => 'EXT:core/Resources/Private/Partials/', 10 => 'EXT:backend/Resources/Private/Partials/', ], 'templateRootPaths' => [ 0 => 'EXT:core/Resources/Private/Templates/Email/', 10 => 'EXT:backend/Resources/Private/Templates/Email/', ], ``` `format` is already problematic, because `both` is not a valid value to Fluid. So that value is *not* set in this patch because `FluidEmail` overwrites the value internally anyways once `txt`, `html` or `both` are rendered for an email. The three path arrays are set by using the appropriate setter methods of the `TemplatePaths` object and thus avoiding the deprecated constructor. Merges with additional paths are performed in the same way they were before. Due to slightly different implementations, changes to tests are necessary. The new implementation preserves numeric array keys, while the old implementation didn't. However, the order of the templates stays the same and overriding by key is still possible. Resolves: #104823 Releases: main Change-Id: Iee9e08e3320657bfffa4c069da94efcf0f9ebd2a Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85832 Reviewed-by:Simon Praetorius <simon@praetorius.me> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Markus Klein <markus.klein@typo3.org> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Simon Praetorius <simon@praetorius.me> Tested-by:
Markus Klein <markus.klein@typo3.org> Tested-by:
Stefan Bürk <stefan@buerk.tech>
Showing
- typo3/sysext/core/Classes/Mail/FluidEmail.php 7 additions, 1 deletiontypo3/sysext/core/Classes/Mail/FluidEmail.php
- typo3/sysext/felogin/Classes/Configuration/RecoveryConfiguration.php 14 additions, 14 deletions...t/felogin/Classes/Configuration/RecoveryConfiguration.php
- typo3/sysext/felogin/Tests/Unit/Configuration/RecoveryConfigurationTest.php 5 additions, 5 deletions...in/Tests/Unit/Configuration/RecoveryConfigurationTest.php
- typo3/sysext/fluid/Tests/Unit/View/TemplatePathsTest.php 9 additions, 9 deletionstypo3/sysext/fluid/Tests/Unit/View/TemplatePathsTest.php
- typo3/sysext/install/Classes/Authentication/AuthenticationService.php 7 additions, 3 deletions.../install/Classes/Authentication/AuthenticationService.php
- typo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php 8 additions, 3 deletionstypo3/sysext/reports/Classes/Task/SystemStatusUpdateTask.php
- typo3/sysext/workspaces/Classes/Notification/StageChangeNotification.php 14 additions, 1 deletion...rkspaces/Classes/Notification/StageChangeNotification.php
Please register or sign in to comment