function memcache_admin_shutdown in Zircon Profile 8.0
Same name and namespace in other branches
- 8 modules/memcache/memcache_admin/memcache_admin.module \memcache_admin_shutdown()
See memcache_admin_init() which registers this function as a shutdown function. Displays memcache stats in the footer.
1 string reference to 'memcache_admin_shutdown'
- memcache_admin_init in modules/
memcache/ memcache_admin/ memcache_admin.module - For the collection of memcache stats. This small .js file makes sure that the HTML displaying the stats is inside of the <body> part of the HTML document.
File
- modules/
memcache/ memcache_admin/ memcache_admin.module, line 529
Code
function memcache_admin_shutdown() {
global $_memcache_statistics;
// Don't call theme() during shutdown if the registry has been rebuilt (such
// as when enabling/disabling modules on admin/build/modules) as things break.
// Instead, simply exit without displaying admin statistics for this page
// load. See http://drupal.org/node/616282 for discussion.
if (!function_exists('theme_get_registry') || !theme_get_registry()) {
return;
}
// 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 (variable_get('show_memcache_statistics', FALSE) && function_exists('user_access') && user_access('access memcache statistics')) {
if (!empty($_memcache_statistics)) {
foreach ($_memcache_statistics as $row => $stats) {
$_memcache_statistics[$row][1] = check_plain($stats[1]);
$_memcache_statistics[$row][2] = check_plain($stats[2]);
}
$variables = array(
'header' => array(
t('Operation'),
t('Bin'),
t('Key'),
t('Hit'),
),
'rows' => $_memcache_statistics,
);
$output = theme('table', $variables);
// this makes sure all of the HTML is within the <body> even though this <script> is outside it
print '<div id="memcache-devel"><h2>' . t('Memcache statistics') . '</h2>' . $output . '</div>';
}
}
}