From 62784b0589bf3b1d19728ff692616e665ba2fd19 Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:23:38 +0200 Subject: [PATCH] [TASK] Deprecate INCLUDE_TYPOSCRIPT syntax (#4827) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [TASK] Deprecate INCLUDE_TYPOSCRIPT syntax Resolves: https://github.com/TYPO3-Documentation/Changelog-To-Doc/issues/1070 Releases: main * Apply suggestions from code review Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Update Documentation/Configuration/TypoScript/Syntax/FileImports/Index.rst * Update Documentation/Configuration/TypoScript/Syntax/FileImports/Index.rst --------- Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> --- .../TypoScript/Syntax/CodeBlocks/Index.rst | 5 +- .../TypoScript/Syntax/Conditions/Index.rst | 2 +- .../TypoScript/Syntax/FileImports/Index.rst | 192 ++++++++++-------- .../GuidelinesIntegrators/Typoscript.rst | 51 ++--- 4 files changed, 126 insertions(+), 124 deletions(-) diff --git a/Documentation/Configuration/TypoScript/Syntax/CodeBlocks/Index.rst b/Documentation/Configuration/TypoScript/Syntax/CodeBlocks/Index.rst index 4e46ac6bcc..a3afe2bd73 100644 --- a/Documentation/Configuration/TypoScript/Syntax/CodeBlocks/Index.rst +++ b/Documentation/Configuration/TypoScript/Syntax/CodeBlocks/Index.rst @@ -46,8 +46,9 @@ Some rules apply during parsing: - Nesting is per-file / per-text-snippet: It does not "swap" into included files. This was the case with the old TypoScript parser. It has been a nasty side-effect, leading - to hard to debug problems. File includes with :typoscript:`@import` and - :typoscript:`` +* :ref:`Automatic global inclusion of page TSconfig of extensions ` +* :ref:`Automatic page TSconfig on site level ` +* :ref:`TypoScript provider for sites and sets ` + automatically loads TypoScript per site when the site set is included in the + site configuration. + + .. index:: TypoScript; Includes by conditions .. _typoscript-syntax-includes-conditions: .. _typoscript-syntax-includes-best-practices: +.. _typoscript-syntax-includes-migration: - +Most usages of :typoscript:` + +@import 'EXT:my_extension/Configuration/TypoScript/myMenu.typoscript' - A reference to a single file relative to :php:`\TYPO3\CMS\Core\Core\Environment::getPublicPath()`. + # Including .typoscript files in a single (non recursive!) directory + - + +@import 'EXT:my_extension/Configuration/TypoScript/*.typoscript' - Paths relative to the including file can be used, if the inclusion is called - from inside a file. These paths start with :file:`FILE:./`. This allows simple, nested - TypoScript templates that can be moved or copied without the need to adapt all includes. + # Including .typoscript and .ts files in a single (non recursive!) directory + - + +@import 'EXT:my_extension/Configuration/TypoScript/*.typoscript' + # Rename all files ending from .ts to .typoscript - Files within extensions can be used using :file:`FILE:EXT:my_extension/path/to/file.typoscript`. - This should be the preferred usage, importing files not located within extensions is - likely to be deprecated with TYPO3 v13, along with the file ending :file:`.txt`. + # Including a file conditionally + - + +[frontend.user.isLoggedIn] + + @import 'EXT:my_extension/Configuration/TypoScript/user.typoscript' + +[END] -* Keyword "DIR": +There are a few more use cases that cannot be transitioned so easily since +:typoscript:`@import` is a bit more restrictive. - Can be used instead of :typoscript:`FILE` to include multiple files at once. - It includes all files from a directory relative to :php:`\TYPO3\CMS\Core\Core\Environment::getPublicPath()`, - including subdirectories. +As one restriction :typoscript:`@import` cannot include files from arbitrary directories +like :file:`fileadmin/`, but only from extensions by using the :typoscript:`EXT:` +prefix. Instances that use :typoscript:`` feature and eventually transition towards it along the way. - Files are included in alphabetical. Also files are included first, then directories. +:typoscript:`@import` allows to import files with the file ending `.typoscript` +and `.tsconfig`. If you used any of the outdated file endings like `.ts` or +`.txt` rename those files before switching to the :typoscript:`@import` syntax. - .. attention:: - :typoscript:` + * Setup -* Keyword "condition": + * Extensions - Conditions are the same as was presented in the :ref:`condition chapter `. - The files or directories will be included only if the condition is met. Note this is obsolete - with TYPO3 v12 since :typoscript:` + * news.typoscript + * tt_address.typoscript - # Identical to: - [frontend.user.isLoggedIn] - - [END] + * ContentElements - # And identical to: - [frontend.user.isLoggedIn] - @import 'EXT:my_extension/Configuration/TypoScript/user.typoscript' - [END] + * file1.typoscript + * file2.typoscript + * file3.typoscript + + * myProject.typoscript + * someSettings.typoscript + + * setup.typoscript + +Each directory **must** be listed separately for inclusion when migrating to +the `@import` statement: + +.. code-block:: diff + :caption: EXT:my_sitepackage/Configuration/TypoScript/setup.typoscript (Difference) + + - + + +@import 'EXT:my_sitepackage/Configuration/TypoScript/Setup' + +@import 'EXT:my_sitepackage/Configuration/TypoScript/Extensions' + +@import 'EXT:my_sitepackage/Configuration/TypoScript/Extensions/Solr' + +@import 'EXT:my_sitepackage/Configuration/TypoScript/ContentElements' + +The need for recursive includes may also be mitigated by restructuring +TypoScript based functionality using :ref:`Site sets `. diff --git a/Documentation/Security/GuidelinesIntegrators/Typoscript.rst b/Documentation/Security/GuidelinesIntegrators/Typoscript.rst index fcf94f6bf0..558c804f5a 100644 --- a/Documentation/Security/GuidelinesIntegrators/Typoscript.rst +++ b/Documentation/Security/GuidelinesIntegrators/Typoscript.rst @@ -119,51 +119,26 @@ using `TypoScript`. .. index:: Security guidelines; External files -External file inclusion -======================= - -TYPO3 allows to include external files which implement `TypoScript` -code. Some integrators appreciate the option of having `TypoScript` -outside of TYPO3's backend because the files can be maintained in a -version control system and/or can be edited without the need to login -to TYPO3. A typical line to include an external TypoScript file looks like this: - -.. code-block:: typoscript - +.. _security-typoscript-external-inclusion: -It is obvious that this method introduces some serious security risks: -first, the file :file:`myConfig.typoscript` exists in a publicly accessible path -of the web server. Without any further protection, everyone who knows -or is able to guess the path/file name can access/download this file -which often causes an information disclosure. - -In order to deny access to all files with the file ending :file:`.typoscript`, the -following Apache configuration could be used: - -.. code-block:: apacheconf - :caption: .htaccess +External file inclusion +======================= - - deny from all - +.. deprecated:: 13.4 + The ` +This method is deprecated with TYPO3 v13.4 and will stop working with v14.0. +Move any TypoScript file either to a custom :ref:`site package ` +or use the :ref:`Site as a TypoScript provider `. .. index:: ! Clickjacking