Turning off debug_kit within controller action, Cakephp

cakephp

Solution

HyperCas is correct in suggesting the beforeFilter() callback as an appropriate solution.

The code could look something like this in the controller where the action (ie, export) resides:

function beforeFilter() {
    // filter actions which should not output debug messages
    if(in_array($this->action, array('export'))) {
        Configure::write('debug', 0);
    }
}

You would adjust `array('export')` to include all the actions you want to prevent debug.

Problem

I am currently working on an export function in cakephp app and im doing a query that is getting around 10,000 rows each export which cake can handle but debug_kit seems to be using lot of memory and putting me over 128mb of memory used. I have tried tried writing this in the top of the function but debugkit is still getting involved and using large amounts of memory. ``` Configure::write('debug',0); ```

Original source