function devel_init in Devel 5
Same name and namespace in other branches
- 6 devel.module \devel_init()
- 7 devel.module \devel_init()
Implementation of hook_init(). Avoids custom error handling for better behavior when stepping though in a debugger.
File
- ./
devel.module, line 244
Code
function devel_init() {
if (strstr($_SERVER['PHP_SELF'], 'update.php') || strstr($_GET['q'], 'autocomplete') || $_GET['q'] == 'admin/content/node-settings/rebuild' || $_GET['q'] == 'upload/js' || substr($_GET['q'], 0, strlen('system/files')) == 'system/files') {
// update.php relies on standard error handler. avoid breaking a few other pages.
}
else {
// no css or handler if we are serving a cached page
if (function_exists('drupal_set_content')) {
if (user_access('access devel information')) {
drupal_add_css(drupal_get_path('module', 'devel') . '/devel.css');
$handler = variable_get('devel_error_handler', DEVEL_ERROR_HANDLER_STANDARD);
switch ($handler) {
case DEVEL_ERROR_HANDLER_STANDARD:
// do nothing
break;
case DEVEL_ERROR_HANDLER_BACKTRACE:
set_error_handler('backtrace_error_handler');
// we want to include the class early so that anyone may call krumo() as needed.
has_krumo();
break;
case DEVEL_ERROR_HANDLER_NONE:
restore_error_handler();
break;
}
}
}
else {
// we need user_access() in the shutdown function
drupal_load('module', 'user');
}
register_shutdown_function('devel_shutdown');
if (variable_get('dev_mem', 0) && function_exists('memory_get_usage')) {
global $memory_init;
$memory_init = memory_get_usage();
}
}
}