Last active
December 16, 2015 10:49
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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