Disable CakePHP DebugKit

Rob Wilkerson picture Rob Wilkerson · Jul 13, 2011 · Viewed 10.4k times · Source

I recently installed the insanely useful DebugKit plugin for my CakePHP projects and I just realized that something wasn't working the way I expected it to work. I assumed that when I pushed code to production, the DebugKit wouldn't show up because my debug value is 0.

Although I haven't pushed to production yet, I did have a need to disable the plugin in my dev environment and it seems that simply setting the debug value to 0 isn't enough. I actually had to remove the plugin from my AppController to get it to stop...debugging.

Is this expected? There are no specific instructions for disabling, but I made one of those assumption things that setting Configure::write( 'debug', 0 ) would suffice. Is this a bug or was my expectation just wrong?

Thanks.

Answer

Tass Skoudros picture Tass Skoudros · Jul 15, 2011

Absolutely right, in CakePHP 1.2 I do this.

In my app_controller.php I use the following.

public function constructClasses() {

    if(Configure::read('debug') >= 1):
    $this->components[] = 'DebugKit.Toolbar';
    endif;

    parent::constructClasses();
}

Its simple and elegant.