Feature #49988
closedBackport ApplicationContext from Flow
100%
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(); ...
Updated by Gerrit Code Review over 11 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22269
Updated by Steffen Müller over 11 years ago
Find this blog article by Matthias Witte about TYPO3 FLOW contexts.
Updated by Fabien Udriot over 11 years ago
Quoting Christian Kuhn from http://forge.typo3.org/issues/39441#note-2
Imho FLOW has a way better concept at this point: It has an object for context and subcontexts, they can be extended and new subcontexts can be added. This is the way to go for us, too. I think, Thomas is working on a similar thing in his sandbox and has something at hand already.
I don't really know the "subcontexts" of Flow... It looks it is mentioned in the Flow documentation. Wondering if we are able of such things...
Updated by Steffen Müller over 11 years ago
Yes, subcontexts are part of Flow and also part of the backport. See line 79 of ApplicationContext.php
We'd have static contexts "Production", "Development" and "Testing" and custom subcontexts, like Production/Staging, "Development/Debug", "Testing/Unit" etc.
So the root context is not extendable, but the subcontexts are.
The whole backport is 1:1 from Flow, so the Flow documentation would also be valid for us.
Updated by Gerrit Code Review over 11 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22269
Updated by Gerrit Code Review over 11 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22269
Updated by Gerrit Code Review over 11 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22269
Updated by Gerrit Code Review over 11 years ago
Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22269
Updated by Gerrit Code Review over 11 years ago
Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22269
Updated by Steffen Müller over 11 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 8fdab46dbd167b1969dcb30b823f3f3e591d03a2.
Updated by Mathias Brodala over 11 years ago
Why was this marked as resolved already? The configuration part is still missing and needs work in the core ConfigurationManager AFAIS since that's what Flow does.
Updated by Stefan Neufeind over 11 years ago
It was set Resolved by gerrit since the patch was merged.
Imho this was about the "core" of it (ApplicationContext). What other changes we'll have now depending on the current context are imho follow-ups to this. Maybe file separate issues and link them here.
Thanks for caring.
Updated by Mathias Brodala over 11 years ago
Stefan Neufeind wrote:
It was set Resolved by gerrit since the patch was merged.
Imho this was about the "core" of it (ApplicationContext). What other changes we'll have now depending on the current context are imho follow-ups to this. Maybe file separate issues and link them here.
OK, got it. Thanks for clarifying. :-)
Updated by Ingo Renner over 11 years ago
just extracted two issues from #39441 - see the linked sub tasks