You are here

function apdqc_admin_get_settings in Asynchronous Prefetch Database Query Cache 7

Return the admin settings form for apdqc.

Return value

array Array of form elements.

3 calls to apdqc_admin_get_settings()
apdqc_admin_devel_admin_settings_form in ./apdqc.admin.inc
Add the apdqc_verbose_devel_output setting to the devel_admin_settings form.
apdqc_admin_settings_form in ./apdqc.admin.inc
Form builder; Configure apdqc settings.
apdqc_admin_system_performance_settings_form in ./apdqc.admin.inc
Add various apdqc settings to the system_performance_settings form.

File

./apdqc.admin.inc, line 382
Admin page callbacks for the apdqc module.

Code

function apdqc_admin_get_settings() {
  $period = drupal_map_assoc(array(
    0,
    60,
    180,
    300,
    600,
    900,
    1800,
    2700,
    3600,
    10800,
    21600,
    32400,
    43200,
    86400,
  ), 'format_interval');

  // @codingStandardsIgnoreLine
  $period[0] = '<' . t('none') . '>';
  $period += apdqc_admin_additional_times();
  ksort($period);
  if (!defined('CACHE_GARBAGE_COLLECTION_FREQUENCY')) {
    module_load_include('cache.inc', 'apdqc');
  }

  // Set GC collection frequency.
  $form['cache_garbage_collection_frequency'] = array(
    '#type' => 'select',
    '#title' => t('Cache garbage collection frequency'),
    // @codingStandardsIgnoreLine
    '#default_value' => variable_get('cache_garbage_collection_frequency', CACHE_GARBAGE_COLLECTION_FREQUENCY),
    '#options' => $period,
    '#description' => t('The frequency with which cache bins are cleared on cron. When ran from system_cron, garbage collection will use the max value of this field and minimum cache lifetime field: <code>max($min_cache_lifetime, $gc_frequency)</code>.'),
  );

  // Allow for module level prefetching to be disabled.
  $form['apdqc_prefetch'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prefetch cached data'),
    '#default_value' => variable_get('apdqc_prefetch', APDQC_PREFETCH),
  );

  // Allow for views_unpack prefetching to be enabled.
  $form['apdqc_prefetch_views_unpack'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prefetch views unpack data'),
    '#default_value' => variable_get('apdqc_prefetch_views_unpack', APDQC_PREFETCH_VIEWS_UNPACK),
  );

  // Adjust devel verbose output.
  if (module_exists('devel')) {
    $form['apdqc_verbose_devel_output'] = array(
      '#type' => 'checkbox',
      '#title' => t('Devel: Output prefetch info from apdqc'),
      '#default_value' => variable_get('apdqc_verbose_devel_output', APDQC_VERBOSE_DEVEL_OUTPUT),
    );
  }
  return $form;
}