You are here

function demo_reset_form_demo_admin_settings_alter in Demonstration site (Sandbox / Snapshot) 6

Same name and namespace in other branches
  1. 7 demo_reset/demo_reset.module \demo_reset_form_demo_admin_settings_alter()

@file Demonstration site reset module.

This module is supposed to be used on public Drupal demonstration sites only. Use at your own risk.

File

./demo_reset.module, line 11
Demonstration site reset module.

Code

function demo_reset_form_demo_admin_settings_alter(&$form, &$form_state) {
  $form['status'][] = array(
    '#value' => t('<p><strong>Default snapshot:</strong> @snapshot</p>', array(
      '@snapshot' => variable_get('demo_dump_cron', t('None')),
    )),
  );
  $intervals = array(
    // 0, 5, 10, 15, 30 minutes
    0,
    300,
    600,
    900,
    1800,
    // 1-6, 9, 12 hours
    3600,
    3600 * 2,
    3600 * 3,
    3600 * 4,
    3600 * 5,
    3600 * 6,
    3600 * 9,
    3600 * 12,
    // 1-3 days
    86400,
    86400 * 2,
    86400 * 3,
    // 1, 2, 3 weeks
    604800,
    604800 * 2,
    604800 * 3,
    // 1, 3 months
    86400 * 30,
    86400 * 90,
  );
  $intervals = drupal_map_assoc($intervals, 'format_interval');
  $intervals[0] = t('Disabled');
  $form['dump']['demo_reset_interval'] = array(
    '#type' => 'select',
    '#title' => t('Automatically reset site every'),
    '#default_value' => variable_get('demo_reset_interval', 0),
    '#options' => $intervals,
    '#description' => t('Select how often this demonstration site is automatically reset. Ensure that you have chosen a snapshot for cron runs in <a href="!manage">Manage snapshots</a> first. <strong>Note:</strong> This requires cron to run at least within this interval.', array(
      '!manage' => url('admin/build/demo/manage'),
    )),
  );
}