You are here

function hosting_web_server_form in Hosting 5

Implementation of hook_form().

File

web_server/hosting_web_server.module, line 168
Web server node type is defined here.

Code

function hosting_web_server_form(&$node) {
  $type = node_get_types('type', $node);
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Web server hostname'),
    '#required' => TRUE,
    '#default_value' => $node->title,
    '#description' => t('The host name of the server. This is the address that will be used by Hostmaster to connect to the web server to issue commands.<br /><strong>Be careful when changing the node title, it is used to create the SQL users if the IP address, below, is not set.</strong>'),
    '#weight' => -10,
  );

  #TODO : rename to db_ip_address, to avoid confusion
  $form['ip_address'] = array(
    '#type' => 'textfield',
    '#title' => t('IP address'),
    '#default_value' => $node->ip_address,
    '#size' => 15,
    '#maxlength' => 15,
    '#description' => t("The IP address the server can be accessed by. This will be used to create database grants, amongst other things.<br />If this is empty, Hostmaster will attempt to resolve the hostname to get the address.<br />If that fails, the hostname (ie. the node title) will be used instead."),
    '#weight' => -9,
  );
  $form['drush_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Drush path'),
    '#required' => TRUE,
    '#size' => 40,
    '#default_value' => $node->drush_path ? $node->drush_path : '',
    '#description' => t("The full path to the drush.php script on this server."),
    '#maxlength' => 255,
    '#weight' => -8,
  );
  $form['restart_cmd'] = array(
    '#type' => 'textfield',
    '#title' => t('Restart command'),
    '#required' => TRUE,
    '#description' => t('The command to run to restart the for new changes to take effect. This is required for the new site to become live'),
    '#default_value' => $node->restart_cmd ? $node->restart_cmd : HOSTING_DEFAULT_RESTART_CMD,
    '#size' => 40,
    '#maxlength' => 255,
    '#weight' => -7,
  );
  $form['script_user'] = array(
    '#type' => 'textfield',
    '#title' => t('System account'),
    '#required' => TRUE,
    '#description' => t('The system account that the hosted files will belong to, for security reasons.<br />This should be a different to the account the web server is running as.'),
    '#default_value' => $node->script_user ? $node->script_user : HOSTING_DEFAULT_SCRIPT_USER,
    '#size' => 20,
    '#maxlength' => 255,
    '#weight' => -6,
  );
  $form['web_group'] = array(
    '#type' => 'textfield',
    '#title' => t('Web server group'),
    '#required' => TRUE,
    '#description' => t('The group that the hosted files will belong to.<br />This should be the group the web server is running as.'),
    '#default_value' => $node->web_group ? $node->web_group : HOSTING_DEFAULT_WEB_GROUP,
    '#size' => 20,
    '#maxlength' => 75,
    '#weight' => -5,
  );
  $form['config_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Configuration path'),
    '#required' => TRUE,
    '#size' => 40,
    '#default_value' => $node->config_path ? $node->config_path : HOSTING_DEFAULT_CONFIG_PATH,
    '#description' => t("The path on the server where configuration files will be stored.<br />\n        It is essential that this directory should not be accessible via a web browser."),
    '#maxlength' => 255,
    '#weight' => -4,
  );
  $form['backup_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Backup path'),
    '#required' => TRUE,
    '#size' => 40,
    '#default_value' => $node->backup_path ? $node->backup_path : HOSTING_DEFAULT_BACKUP_PATH,
    '#description' => t("The path on the server where backups will be stored.<br />\n        It is essential that this directory should not be accessible via a web browser."),
    '#maxlength' => 255,
    '#weight' => -3,
  );
  return $form;
}