function devel_shutdown_real

Runs on shutdown to display developer information in the footer.

devel_shutdown() registers this function as a shutdown function.

1 string reference to 'devel_shutdown_real'
devel_shutdown in ./devel.module
Runs on shutdown to clean up and display developer information.

File

./devel.module, line 1155

Code

function devel_shutdown_real() {
    global $user;
    $output = $txt = '';
    // Set $GLOBALS['devel_shutdown'] = FALSE in order to supress the
    // devel footer for a page.  Not necessary if your page outputs any
    // of the Content-type http headers tested below (e.g. text/xml,
    // text/javascript, etc).  This is advised where applicable.
    if (!devel_silent() && !isset($GLOBALS['devel_shutdown']) && !isset($GLOBALS['devel_redirecting'])) {
        // Try not to break non html pages.
        if (function_exists('drupal_get_http_header')) {
            $header = drupal_get_http_header('content-type');
            if ($header) {
                $formats = array(
                    'xml',
                    'javascript',
                    'json',
                    'plain',
                    'image',
                    'application',
                    'csv',
                    'x-comma-separated-values',
                );
                foreach ($formats as $format) {
                    if (strstr($header, $format)) {
                        return;
                    }
                }
            }
        }
        if (isset($user) && user_access('access devel information')) {
            $queries = devel_query_enabled() ? Database::getLog('devel', 'default') : NULL;
            if (!empty($queries)) {
                // Remove caller args to avoid recursion.
                foreach ($queries as &$query) {
                    unset($query['caller']['args']);
                }
            }
            $output .= devel_shutdown_summary($queries);
            $output .= devel_shutdown_query($queries);
        }
        if ($output) {
            // TODO: gzip this text if we are sending a gzip page.
            // See drupal_page_header().
            // For some reason, this is not actually printing for cached pages even
            // though it gets executed and $output looks good.
            print $output;
        }
    }
}