Actions
Feature #49988
closedBackport ApplicationContext from Flow
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2013-07-17
Due date:
% Done:
100%
Estimated time:
(Total: 0.00 h)
PHP Version:
Tags:
Complexity:
Sprint Focus:
Description
Flow has the notion of ApplicationContext which provides a unique API for handling contexts.
Having this API in TYPO3 CMS would allow us to provide default configuration sets for particular contexts. For example having decent logging in production context vs. full reports in development context.
Extension developers would also benefit from streamlining their custom solutions to a single API.
The context is set using the TYPO3_CONTEXT environment variable.
Here's an example of how to set this variable in apache htaccess:
RewriteCond %{HTTP_HOST} ^dev\.example\.com$ RewriteRule (.*) $1 [E=TYPO3_CONTEXT:Development] RewriteCond %{HTTP_HOST} ^www\.example\.com$ RewriteRule (.*) $1 [E=TYPO3_CONTEXT:Production]
The particular context can be obtained in the following way:
\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getContext() # shorthand to predefined contexts: \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getContext()->isDevelopment(); \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getContext()->isProduction(); ...
Actions