You are here

function hosting_settings in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 hosting.module \hosting_settings()
  2. 7.3 hosting.module \hosting_settings()

General settings form.

1 string reference to 'hosting_settings'
hosting_menu in ./hosting.module
Implementation of hook_menu().

File

./hosting.module, line 942
Hosting module.

Code

function hosting_settings() {
  $form['settings'] = array(
    '#type' => 'item',
    '#title' => t('General Hosting settings'),
    '#value' => t('Here you may set various general settings that apply to site management or to the frontend system.'),
    '#weight' => 0,
  );
  $profiles = array();
  foreach (hosting_get_profiles() as $id => $name) {
    $profile = hosting_package_instance_load(array(
      'p.nid' => $id,
    ));
    $profiles[$profile->short_name] = theme('hosting_site_profile', $profile);

    // Don't allow a site to be provisioned with hostslave or hostmaster profile
    if (in_array($name, array(
      'Hostslave',
      'Hostmaster',
    ))) {
      unset($profiles[$profile->short_name]);
    }
  }
  natcasesort($profiles);
  $default_value = hosting_package_instance_load(array(
    'p.nid' => hosting_get_default_profile(),
  ))->short_name;
  $form['hosting_default_profile'] = array(
    '#type' => 'select',
    '#title' => t('Default profile'),
    '#options' => $profiles,
    '#description' => t('The default install profile to use when creating new sites.'),
    '#default_value' => $default_value,
  );
  $form['hosting_ignore_default_profiles'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide platforms with non-default profiles'),
    '#description' => t('When selecting a Drupal core profile, hide platforms that also contain other profiles (i.e intended as distributions). Warning: requires a platform other than the Hostmaster platform.'),
    '#default_value' => variable_get('hosting_ignore_default_profiles', FALSE),
  );
  $form['hosting_lock_platforms_by_default'] = array(
    '#type' => 'checkbox',
    '#title' => t('Lock platforms by default on initial creation'),
    '#description' => t('When verifying a new platform, set its initial state to \'Locked\'. This can avoid having sites created on a new platform before there has been a chance to test it. Those users with the \'create sites on locked platforms\' permission (e.g., with the \'platform manager\' role) will still be able to build sites.'),
    '#default_value' => variable_get('hosting_lock_platforms_by_default', FALSE),
  );
  $form['hosting_require_disable_before_delete'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require site to be disabled before deletion'),
    '#description' => t('Check if you wish for users to run the Disable task on a site prior to running the Delete task.'),
    '#default_value' => variable_get('hosting_require_disable_before_delete', TRUE),
  );
  $form['hosting_welcome_page'] = array(
    '#type' => 'checkbox',
    '#title' => t('Redirect anonymous users to the Welcome page'),
    '#description' => t('By default, anonymous users will receive a 403 error, since they don\'t have the \'access content\' permission. This option will redirect them to the !welcome_page.', array(
      '!welcome_page' => l('Welcome page', 'welcome'),
    )),
    '#default_value' => variable_get('hosting_welcome_page', TRUE),
  );
  if (hosting_feature('cron')) {
    $form['hosting_cron_use_backend'] = array(
      '#type' => 'radios',
      '#title' => t('Cron method'),
      '#description' => t('For running cron on a site. You can use the drush cron implementation or the web-based cron.php method using builtin HTTP requests. The drush implementation is more reliable but will be slower than the web-based approach if the webserver has an opcode cache (like APC) configured.'),
      '#options' => array(
        'Web-based',
        'Drush',
      ),
      '#default_value' => variable_get('hosting_cron_use_backend', TRUE),
    );
  }
  return system_settings_form($form);
}