You are here

function devel_admin_settings in Devel 5

Same name and namespace in other branches
  1. 6 devel.module \devel_admin_settings()
  2. 7 devel.admin.inc \devel_admin_settings()
2 string references to 'devel_admin_settings'
devel_menu in ./devel.module
Implementation of hook_menu().
devel_node_access_form_alter in ./devel_node_access.module

File

./devel.module, line 713

Code

function devel_admin_settings() {
  $form['queries'] = array(
    '#type' => 'fieldset',
    '#title' => t('Query log'),
  );
  $description = t("Collect query info. If disabled, no query log functionality will work.");
  if (!devel_is_compatible_optimizer()) {
    $description = t('You must disable or upgrade the php Zend Optimizer extension in order to enable this feature. The minimum required version is 3.2.8. Earlier versions of Zend Optimizer are <a href="!url">horribly buggy and segfault your Apache</a> ... ', array(
      '!url' => url('http://drupal.org/node/126098'),
    )) . $description;
  }
  $form['queries']['dev_query'] = array(
    '#type' => 'checkbox',
    '#title' => t('Collect query info'),
    '#default_value' => variable_get('dev_query', 0),
    '#description' => $description,
    '#disabled' => !devel_is_compatible_optimizer() ? TRUE : FALSE,
  );
  $form['queries']['devel_query_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display query log'),
    '#default_value' => variable_get('devel_query_display', 0),
    '#description' => t('Display a log of the database queries needed to generate the current page, and the execution time for each. Also, queries which are repeated during a single page view are summed in the # column, and printed in red since they are candidates for caching.'),
  );
  $form['queries']['devel_query_sort'] = array(
    '#type' => 'radios',
    '#title' => t('Sort query log'),
    '#default_value' => variable_get('devel_query_sort', DEVEL_QUERY_SORT_BY_SOURCE),
    '#options' => array(
      t('by source'),
      t('by duration'),
    ),
    '#description' => t('The query table can be sorted in the order that the queries were executed or by descending duration.'),
  );
  $form['queries']['devel_execution'] = array(
    '#type' => 'textfield',
    '#title' => t('Slow query highlighting'),
    '#default_value' => variable_get('devel_execution', 5),
    '#size' => 4,
    '#maxlength' => 4,
    '#description' => t('Enter an integer in milliseconds. Any query which takes longer than this many milliseconds will be highlighted in the query log. This indicates a possibly inefficient query, or a candidate for caching.'),
  );
  $form['queries']['devel_store_queries'] = array(
    '#type' => 'checkbox',
    '#title' => t('Store executed queries'),
    '#default_value' => variable_get('devel_store_queries', 0),
    '#description' => t('Store statistics about executed queries. See the devel_x tables. This feature is currently only available for the MySQL database backend.'),
  );
  $form['queries']['devel_store_random'] = array(
    '#type' => 'textfield',
    '#title' => t('Sampling interval'),
    '#default_value' => variable_get('devel_store_random', 1),
    '#size' => 4,
    '#description' => t('If storing query statistics, only store every nth page view. 1 means every page view, 2 every second, and so on.'),
  );
  $form['dev_timer'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display page timer'),
    '#default_value' => variable_get('dev_timer', 0),
    '#description' => t('Display page execution time in the query log box.'),
  );
  $form['dev_mem'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display memory usage'),
    '#default_value' => variable_get('dev_mem', 0),
    '#description' => t('Display how much memory is used to generate the current page. This will show memory usage when devel_init() is called and when devel_exit() is called. PHP must have been compiled with the <em>--enable-memory-limit</em> configuration option for this feature to work.'),
  );
  $form['devel_redirect_page'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display redirection page'),
    '#default_value' => variable_get('devel_redirect_page', 0),
    '#description' => t('When a module executes drupal_goto(), the query log and other developer information is lost. Enabling this setting presents an intermediate page to developers so that the log can be examined before continuing to the destination page.'),
  );
  $form['devel_form_weights'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display form element keys and weights'),
    '#default_value' => variable_get('devel_form_weights', 0),
    '#description' => t('Form element names are needed for performing themeing or altering a form. Their weights determine the position of the element. Enabling this setting will show these keys and weights beside each form item.'),
  );
  $form['devel_error_handler'] = array(
    '#type' => 'radios',
    '#title' => t('Error handler'),
    '#default_value' => variable_get('devel_error_handler', DEVEL_ERROR_HANDLER_STANDARD),
    '#options' => array(
      DEVEL_ERROR_HANDLER_NONE => t('None'),
      DEVEL_ERROR_HANDLER_STANDARD => t('Standard drupal'),
      DEVEL_ERROR_HANDLER_BACKTRACE => t('Backtrace'),
    ),
    '#description' => t('Choose an error handler for your site. <em>Backtrace</em> prints nice debug information when an error is noticed, and you <a href="@choose">choose to show errors on screen</a>. <strong>Backtrace requires the <a href="@krumo">krumo library</a></strong>. <em>None</em> is a good option when stepping through the site in your debugger.', array(
      '@krumo' => url('http://krumo.sourceforge.net'),
      '@choose' => url('admin/settings/error-reporting'),
    )),
  );

  // Save any old SMTP library
  if (variable_get('smtp_library', '') != '' && variable_get('smtp_library', '') != drupal_get_filename('module', 'devel')) {
    variable_set('devel_old_smtp_library', variable_get('smtp_library', ''));
  }
  $smtp_options = array(
    '' => t('Default'),
    drupal_get_filename('module', 'devel') => t('Log only'),
  );
  if (variable_get('devel_old_smtp_library', '') != '') {
    $smtp_options[variable_get('devel_old_smtp_library', '')] = t('Other (!library)', array(
      '!library' => variable_get('devel_old_smtp_library', ''),
    ));
  }
  $form['smtp_library'] = array(
    '#type' => 'radios',
    '#title' => t('SMTP library'),
    '#options' => $smtp_options,
    '#default_value' => variable_get('smtp_library', ''),
  );
  return system_settings_form($form);
}