Skip to content
  • benni's avatar
    [FEATURE] Introduce an Environment API class · f10f551b
    benni authored and Susanne Moog's avatar Susanne Moog committed
    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
    up.
    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.
    
    Resolves: #84153
    Releases: master
    Change-Id: I7ca35f752493d7e0d1c21c83a9ffbfb6a40eb463
    Reviewed-on: https://review.typo3.org/55960
    
    
    Reviewed-by: default avatarBenjamin Franzke <bfr@qbus.de>
    Tested-by: default avatarBenjamin Franzke <bfr@qbus.de>
    Tested-by: default avatarTYPO3com <no-reply@typo3.com>
    Reviewed-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
    Tested-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
    Reviewed-by: default avatarSusanne Moog <susanne.moog@typo3.org>
    Tested-by: default avatarSusanne Moog <susanne.moog@typo3.org>
    f10f551b