Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turning off debug_kit within controller action, Cakephp

Tags:

cakephp

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);
like image 811
Shard Avatar asked Jan 05 '10 22:01

Shard


1 Answers

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.

like image 148
Benjamin Pearson Avatar answered Sep 28 '22 08:09

Benjamin Pearson