Feature #84153

Introduce an Environment class

Added by Benni Mack over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
System/Bootstrap/Configuration
Target version:
Start date:
2018-03-06
Due date:
% Done:

100%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Associated revisions

Revision f10f551b (diff)
Added by Benni Mack over 1 year ago

[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
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: Benjamin Franzke <>
Tested-by: Benjamin Franzke <>
Tested-by: TYPO3com <>
Reviewed-by: Mathias Schreiber <>
Tested-by: Mathias Schreiber <>
Reviewed-by: Susanne Moog <>
Tested-by: Susanne Moog <>

History

#1 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55960

#2 Updated by Gerrit Code Review over 1 year ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55960

#3 Updated by Benni Mack over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#4 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF