You are here

function memcache_admin_stats_raw in Memcache API and Integration 6

Same name and namespace in other branches
  1. 7 memcache_admin/memcache_admin.module \memcache_admin_stats_raw()
1 string reference to 'memcache_admin_stats_raw'
memcache_admin_menu in memcache_admin/memcache_admin.module
Implementation of hook_menu().

File

memcache_admin/memcache_admin.module, line 350

Code

function memcache_admin_stats_raw($bin, $server, $type = 'default') {
  $cluster = memcache_admin_bin_mapping($bin);
  $slab = (int) arg(7);
  if (arg(6) == 'cachedump' && !empty($slab) && user_access('access slab cachedump')) {
    $stats = dmemcache_stats($cluster, arg(7), FALSE);
  }
  else {
    $stats = dmemcache_stats($cluster, $type, FALSE);
  }
  $breadcrumbs = array(
    l(t('Home'), NULL),
    l(t('Administer'), 'admin'),
    l(t('Reports'), 'admin/reports'),
    l(t('Memcache'), 'admin/reports/memcache'),
    l(t($bin), "admin/reports/memcache/{$bin}"),
  );
  if ($type == 'slabs' && arg(6) == 'cachedump' && user_access('access slab cachedump')) {
    $breadcrumbs[] = l($server, "admin/reports/memcache/{$bin}/{$server}");
    $breadcrumbs[] = l('slabs', "admin/reports/memcache/{$bin}/{$server}/{$type}");
  }
  drupal_set_breadcrumb($breadcrumbs);
  $output = '';
  if (is_array($stats[$cluster][$server]) && count($stats[$cluster][$server])) {
    $output .= theme('memcache_admin_stats_raw_table', $cluster, $server, $stats[$cluster][$server], $type);
  }
  elseif ($type == 'slabs' && is_array($stats[$cluster]) && count($stats[$cluster])) {
    $output .= theme('memcache_admin_stats_raw_table', $cluster, $server, $stats[$cluster], $type);
  }
  else {
    drupal_set_message(t('No !type statistics for this bin.', array(
      '!type' => $type,
    )));
  }
  return $output;
}