Introduce an Environment class
[FEATURE] Introduce an Environment API class
A new class Environment is added, which is initialized right at the very
beginning of any TYPO3-based request.
The class contains a static list of properties commonly used throughout the
core to access paths, constants or global variables. The class also contains
methods that are relevant for ALL kind of PHP requests, CLI and web requests.
In order to avoid constants, and global variables, this is centralized in one
place, which allows to "re-define" values for testing purposes, making functional
tests a lot simpler.
This would better be stored in a dependency injection container and injected
as dependency/parameter into the respective classes that need the information.
We're not at that point to use dependency injection for every class, therefore
this class provides a static interface as a long-term interim solution.
Additionally, it adds a new functionality, basically finally allowing to move
code outside of the PATH_site constant with a proper API.
If the environment variable "TYPO3_PATH_APP" is set, this acts as a root path
for the project, which can be the same as PATH_site, or (usually) one level
All typical new composer-based installations have this folder structure set up
automatically. Non-composer mode installations can set this environment variable
to make TYPO3 aware of non-public-accessable folders.
The following changes apply (with further patches):
- When TYPO3_PATH_APP is set, all logs / sessions / cache files are moved into $PROJECT_ROOT/var/.
- Same applies to typo3conf/l10n/, effectively moving this into a semi-writable
place, the same place where logs should be placed.
- LocalConfiguration.php, PackageStates.php and AdditionalConfiguration.php
are now located at $PROJECT_ROOT/config/
The folder typo3conf then only contains code related to extensions.
The long-term goal until 9 LTS is that TYPO3 Core does not use any constants
anymore, which have been superseded by this class right now.
Reviewed-by: Benjamin Franzke <email@example.com>
Tested-by: Benjamin Franzke <firstname.lastname@example.org>
Tested-by: TYPO3com <email@example.com>
Reviewed-by: Mathias Schreiber <firstname.lastname@example.org>
Tested-by: Mathias Schreiber <email@example.com>
Reviewed-by: Susanne Moog <firstname.lastname@example.org>
Tested-by: Susanne Moog <email@example.com>