You are here

function memcache_admin_stats_raw in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 modules/memcache/memcache_admin/memcache_admin.module \memcache_admin_stats_raw()
1 string reference to 'memcache_admin_stats_raw'
memcache_admin_menu in modules/memcache/memcache_admin/memcache_admin.module
Implements hook_menu().

File

modules/memcache/memcache_admin/memcache_admin.module, line 345

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);
  if (isset($stats[$cluster][$server]) && is_array($stats[$cluster][$server]) && count($stats[$cluster][$server])) {
    $output = theme('memcache_admin_stats_raw_table', array(
      'cluster' => $cluster,
      'server' => $server,
      'stats' => $stats[$cluster][$server],
      'type' => $type,
    ));
  }
  elseif ($type == 'slabs' && is_array($stats[$cluster]) && count($stats[$cluster])) {
    $output = theme('memcache_admin_stats_raw_table', array(
      'cluster' => $cluster,
      'server' => $server,
      'stats' => $stats[$cluster],
      'type' => $type,
    ));
  }
  else {
    $output = theme('memcache_admin_stats_raw_table', array(
      'cluster' => $cluster,
      'server' => $server,
      'stats' => array(),
      'type' => $type,
    ));
    drupal_set_message(t('No @type statistics for this bin.', array(
      '@type' => $type,
    )));
  }
  return $output;
}