Project

General

Profile

Actions

Feature #49988

closed

Backport ApplicationContext from Flow

Added by Steffen Müller over 11 years ago. Updated about 6 years ago.

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();
...

Subtasks 3 (0 open3 closed)

Feature #50131: Load context specific configuration filesClosed2013-07-17

Actions
Feature #50132: TypoScript: Application Context conditionClosed2013-07-17

Actions
Bug #50983: Add public API to get ApplicationContext ClosedSteffen Müller2013-08-10

Actions

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Feature #39441: Add TYPO3 Context informationClosed2012-08-01

Actions
Related to TYPO3 Core - Task #49953: Disable DeprecationLog by defaultClosed2013-07-11

Actions
Actions #1

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

Actions #2

Updated by Steffen Müller over 11 years ago

Find this blog article by Matthias Witte about TYPO3 FLOW contexts.

Actions #3

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...

Actions #4

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.

Actions #5

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

Actions #6

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

Actions #7

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

Actions #8

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

Actions #9

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

Actions #10

Updated by Steffen Müller over 11 years ago

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

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.

Actions #12

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.

Actions #13

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. :-)

Actions #14

Updated by Ingo Renner over 11 years ago

just extracted two issues from #39441 - see the linked sub tasks

Actions #15

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF