You are here

function radioactivity_admin_general_form in Radioactivity 5

Same name and namespace in other branches
  1. 6 radioactivity-admin-ui.inc \radioactivity_admin_general_form()
  2. 7.2 radioactivity-admin-ui.inc \radioactivity_admin_general_form()
  3. 7 radioactivity-admin-ui.inc \radioactivity_admin_general_form()
1 string reference to 'radioactivity_admin_general_form'
radioactivity_menu in ./radioactivity.module

File

./radioactivity.module, line 108

Code

function radioactivity_admin_general_form() {
  $form = array();
  $form['radioactivity_decay_granularity'] = array(
    '#type' => 'textfield',
    '#title' => t('Decay granularity (in seconds)'),
    '#description' => t('This setting determines how often at most the radioactivity is decreased by the decay formula. ' . 'The shorter the time, the more accurate the modeling will be, but the more database ' . 'activity is required. The default (10 minutes) should be good starting point.'),
    '#size' => 10,
    '#required' => TRUE,
    '#default_value' => _radioactivity_get_decay_granularity(),
  );
  $form['memcached'] = array(
    '#type' => 'fieldset',
    '#tree' => FALSE,
    '#title' => t('Memcached acceleration'),
  );
  $memcached_ok = FALSE;
  switch (radioactivity_determine_memcached_availability()) {
    case RADIOACTIVITY_MEMCACHE_OK:
      $memcached_availability_text = t('Ok');
      $memcached_ok = TRUE;
      break;
    case RADIOACTIVITY_MEMCACHE_NO_BIN:
      $memcached_availability_text = t('Cannot obtain memcache bin %bin', array(
        '%bin' => 'radioactivity',
      ));
      break;
    case RADIOACTIVITY_MEMCACHE_NO_MODULE:
      $memcached_availability_text = t('Memcache not enabled');
      break;
  }
  $form['memcached']['availability'] = array(
    '#type' => 'item',
    '#title' => t('Memcached configuration status'),
    '#value' => $memcached_availability_text,
  );
  $form['memcached']['radioactivity_memcached_enable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Memcached acceleration for node views'),
    '#description' => t('If this option is enabled, node views do not update radioactivity energies directly. Instead, ' . 'entry with minimal information is written to memcached. These entries are processed during cron runs.'),
    '#default_value' => radioactivity_get_memcached_enable(),
    '#disabled' => !$memcached_ok,
  );
  $form['memcached']['radioactivity_memcached_expiration'] = array(
    '#type' => 'textfield',
    '#title' => t('Memcached entry expiration time (in seconds)'),
    '#description' => t('Expiration time for memcached entries used by radioactivity. This should be at least twice as long as your maximum ' . 'cron interval.'),
    '#size' => 10,
    '#required' => TRUE,
    '#disabled' => !$memcached_ok,
    '#default_value' => radioactivity_get_memcached_expiration(),
  );
  return system_settings_form($form);
}