[FLOW3-general] Deactivate packages in certain contexts

Bastian Waidelich bastian at typo3.org
Fri Oct 26 19:06:04 CEST 2012


Marc Neuhaus wrote:

Hi Marc,

> in general i would absolutely recommend not to install the Debug.Toolbar on
> a production machine

I know ;)
I still would like to be able to debug my application in the same 
environment before it's live and during maintainance.
Unfortunately the debug toolbar breaks AJAX calls currently, as it 
appends the toolbar to my JSON response :) But I guess this can be 
worked around somehow.

Anyways, this was just one example use case.

> Nonetheless, i think context-dependent package states and a way to disable
> the Debug.Toolbar both make sense i guess :)

I just gave this a try and it seems to work quite nicely!

My PackageStates.php looks like this now:

//...
array (
   'manifestPath' => '',
   'state' => array(
     'Production/Debugging' => 'active',
   ),
   'packagePath' => 'Application/Debug.Toolbar/',
   'classesPath' => 'Classes/',
),
// ...

An alternative syntax I thought about was to keep 'state' => 'active' / 
'inactive' and add another key 'overrideStateByContext':

//...
array (
   'manifestPath' => '',
   'state' => 'inactive'
   'overrideStateByContext' => array(
     'Production/Debugging' => 'active',
   ),
   'packagePath' => 'Application/Debug.Toolbar/',
   'classesPath' => 'Classes/',
),
// ...


Well, not so important, as this is not meant to be changed there 
anyways. Instead we could adjust the 
"package:activate"/"package:deactivate" commands to expect an (optional) 
parameter "contexts"

WDYT?


-- 
Bastian Waidelich
TYPO3 Core Team Member

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the FLOW3-general mailing list