You are here

function performance_clear_form in Performance Logging and Monitoring 6.2

Same name and namespace in other branches
  1. 6 performance.module \performance_clear_form()
  2. 7.2 performance.module \performance_clear_form()
  3. 7 performance.module \performance_clear_form()

Clear logs form.

1 string reference to 'performance_clear_form'
performance_menu in ./performance.module
Implementation of hook_menu().

File

./performance.module, line 661
Logs detailed and/or summary page generation time and memory consumption for page requests. Copyright Khalid Baheyeldin 2008 of http://2bits.com

Code

function performance_clear_form(&$form_state, $store = NULL) {
  $base = 'admin/reports/performance-logging/';

  // Seemed the best solution, instead of doing something like
  // t('Are you sure you want to clear all @store data?', array ('@store' => $store));
  switch ($store) {
    case 'summary':
      $question = t('Are you sure you want to clear all summary data?');
      $path = $base . 'summary';
      break;
    case 'details':
      $question = t('Are you sure you want to clear all detail data?');
      $path = $base . 'details';
      break;
    default:

      // None or unrecognised store => 404.
      drupal_not_found();
      return 2;
  }
  $form['store'] = array(
    '#type' => 'value',
    '#value' => $store,
  );
  $form['#redirect'] = $path;
  return confirm_form($form, $question, $path);
}