View source
<?php
function memcache_init() {
if (strstr($_SERVER['PHP_SELF'], 'update.php') || strstr($_GET['q'], 'autocomplete')) {
}
else {
register_shutdown_function('memcache_shutdown');
}
}
function memcache_perm() {
return array(
'access memcache statistics',
);
}
function memcache_shutdown() {
global $user, $_memcache_statistics;
$output = '';
if (function_exists('drupal_get_headers')) {
$headers = drupal_get_headers();
if (strstr($headers, 'xml') || strstr($headers, 'javascript') || strstr($headers, 'plain')) {
return;
}
}
if (user_access('access memcache statistics')) {
drupal_add_js(drupal_get_path('module', 'memcache') . '/memcache.js');
$stats = array();
foreach ($_memcache_statistics as $stat => $val) {
$stats[] = "<strong>{$stat}:</strong> " . theme('item_list', $val);
}
if (!empty($stats)) {
$output = theme('item_list', $stats);
print '<div id="memcache-devel"><h2>' . t('Memcache statistics') . '</h2>' . $output . '</div>';
}
}
}