You are here

function performance_clear_form in Performance Logging and Monitoring 7

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

Clear logs form. This is actually a multistep form: first choose the data store you want to clear, second confirm that you actually want this.

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

File

./performance.module, line 1223
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, &$form_state) {

  // Check if we are in step 2 of the form.
  if (isset($form_state['storage']['store']) && !empty($form_state['storage']['store'])) {
    return performance_clear_form_confirm($form, $form_state);
  }

  // Step one of the form.
  $form = $options = array();
  foreach (performance_data_stores() as $store => $data) {
    if ($data['#enabled']) {
      $options[$store] = $data['#name'];
    }
  }
  $form['store'] = array(
    '#type' => 'radios',
    '#title' => t('Select data store to clear'),
    '#options' => $options,
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Clear'),
  );
  return $form;
}