Skip to content

Instantly share code, notes, and snippets.

@prbaron
Last active December 16, 2015 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prbaron/5423414 to your computer and use it in GitHub Desktop.
Save prbaron/5423414 to your computer and use it in GitHub Desktop.
Improved core.php file for CakePHP Change the debug level whether you are in local or production mode.
<?php
/**
* CakePHP Debug Level:
*
* Production Mode:
* 0: No error messages, errors, or warnings shown. Flash messages redirect.
*
* Development Mode:
* 1: Errors and warnings shown, models refreshed, flash messages halted.
* 2: As in 1, but also with full debug messages and SQL output.
*
* In production mode, flash messages redirect after a time interval.
* In development mode, you need to click the flash message to continue.
*/
$host_r = explode('.', $_SERVER['SERVER_NAME']);
if(count($host_r)>2) while(count($host_r)>2)array_shift($host_r);
$mainhost = implode('.', $host_r);
#switch between servers
switch(strtolower($mainhost)) {
case 'localhost':
Configure::write('debug', 2);
break;
case '{your live url}':
Configure::write('debug', 0);
break;
default:
Configure::write('debug', 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment