function theme_memcache_admin_stats_raw_table in Memcache API and Integration 6
Same name and namespace in other branches
- 7 memcache_admin/memcache_admin.module \theme_memcache_admin_stats_raw_table()
1 theme call to theme_memcache_admin_stats_raw_table()
- memcache_admin_stats_raw in memcache_admin/
memcache_admin.module
File
- memcache_admin/
memcache_admin.module, line 448
Code
function theme_memcache_admin_stats_raw_table($cluster, $server, $stats, $current_type = 'default') {
$memcache_bins = variable_get('memcache_bins', array());
$bin = isset($memcache_bins[$cluster]) ? $memcache_bins[$cluster] : 'default';
// Provide navigation for the various memcache stats types
if (count(memcache_admin_stats_types($bin)) > 1) {
foreach (memcache_admin_stats_types($bin) as $type) {
if ($current_type == $type) {
$links[] = '<strong>' . l(t($type), "admin/reports/memcache/{$bin}/{$server}/" . ($type == 'default' ? '' : $type)) . '</strong>';
}
else {
$links[] = l(t($type), "admin/reports/memcache/{$bin}/{$server}/" . ($type == 'default' ? '' : $type));
}
}
}
$output = !empty($links) ? implode($links, ' | ') : '';
$headers = array(
t('Property'),
t('Value'),
);
$rows = array();
// Items are returned as an array within an array within an array. We step
// in one level to properly display the contained statistics.
if ($current_type == 'items' && isset($stats['items'])) {
$stats = $stats['items'];
}
foreach ($stats as $key => $value) {
// Add navigation for getting a cachedump of individual slabs
if (($current_type == 'slabs' || $current_type == 'items') && is_int($key) && user_access('access slab cachedump')) {
$key = l($key, "admin/reports/memcache/{$bin}/{$server}/slabs/cachedump/{$key}");
}
if (is_array($value)) {
$rs = array();
foreach ($value as $k => $v) {
// Format timestamp when viewing cachedump of individual slabs.
if ($current_type == 'slabs' && user_access('access slab cachedump') && arg(6) == 'cachedump' && $k == 0) {
$k = t('Size');
$v = format_size($v);
}
else {
if ($current_type == 'slabs' && user_access('access slab cachedump') && arg(6) == 'cachedump' && $k == 1) {
$k = t('Expire');
$full_stats = dmemcache_stats($cluster, 'default');
$infinite = $full_stats[$cluster][$server]['time'] - $full_stats[$cluster][$server]['uptime'];
if ($v == $infinite) {
$v = t('infinite');
}
else {
$v = t('in @time', array(
'@time' => format_interval($v - time()),
));
}
}
}
$rs[] = array(
check_plain($k),
check_plain($v),
);
}
$rows[] = array(
$key,
theme('table', array(), $rs),
);
}
else {
$rows[] = array(
check_plain($key),
check_plain($value),
);
}
}
$output .= theme('table', $headers, $rows);
return $output;
}