-
Notifications
You must be signed in to change notification settings - Fork 142
Core overwrites
Mark edited this page Jun 25, 2014
·
1 revision
Overwriting stuff in core.php
This little snippet allows you to automatically keep debug 0 for all domains except for the local invironment:
Configure::write('debug', 0);
if (!empty($_SERVER['HTTP_HOST']) && in_array($_SERVER['HTTP_HOST'], array('localhost', 'mydomain.local'))) {
Configure::write('debug', 2);
}
The ErrorHandler can get overwritten by the Tools one:
App::uses('MyErrorHandler', 'Tools.Error');
Configure::write('Error', array(
'handler' => 'MyErrorHandler::handleError',
'level' => E_ALL & ~E_DEPRECATED,
'trace' => true
));
Same for ExceptionHandler:
Configure::write('Exception', array(
'handler' => 'MyErrorHandler::handleException',
'renderer' => 'Tools.MyExceptionRenderer',
'log' => true
));
This useful snippet allows you to catch all logging streams that are not caught yet:
App::uses('CakeLog', 'Log');
CakeLog::config('default', array('engine' => 'FileLog'));
Don't forget to raise the cookieTimeout to avoid too early session kills:
Configure::write('Session', array(
...
'timeout' => 6000, // minutes, updates each page hit
'cookieTimeout' => 80000, // minutes, fixed value
));