You are here

function radioactivity_debug_memcache_form in Radioactivity 6

1 string reference to 'radioactivity_debug_memcache_form'
radioactivity_debug_menu in plugins/radioactivity_debug.module

File

plugins/radioactivity_debug.module, line 135
Debugging support for radioactivity

Code

function radioactivity_debug_memcache_form() {
  $form = array();
  if (!radioactivity_get_memcached_enable()) {
    $form['status'] = array(
      '#value' => t('Memcache acceleration not enabled'),
    );
    return $form;
  }
  list($start_entry_id, $stop_entry_id) = radioactivity_memcache_get_unprocessed_range();
  $form['range'] = array(
    '#type' => 'item',
    '#title' => t('Entry range'),
    '#value' => '[' . $start_entry_id . ', ' . $stop_entry_id . ')',
  );
  $combined = radioactivity_group_memcache_entries($start_entry_id, $stop_entry_id);
  $rows = array();
  foreach ($combined as $oid => $rest1) {
    foreach ($rest1 as $oclass => $rest2) {
      foreach ($rest2 as $source => $times) {
        $rows[] = array(
          $oclass . ':' . $oid,
          $source,
          $times,
        );
      }
    }
  }
  if (!count($rows)) {
    $rows[] = array(
      'data' => array(
        array(
          'data' => t('No data'),
          'colspan' => 3,
        ),
      ),
    );
  }
  $form['combined'] = array(
    '#type' => 'item',
    '#title' => t('Pending energy events'),
    '#value' => theme_table(array(
      'Object',
      'Source',
      'Multiplier',
    ), $rows),
  );
  return $form;
}