You are here

function install_configure_form_submit in Drupal 7

Same name and namespace in other branches
  1. 6 install.php \install_configure_form_submit()

Form submission handler for install_configure_form().

See also

install_configure_form_validate()

File

includes/install.core.inc, line 1892
API functions for installing Drupal.

Code

function install_configure_form_submit($form, &$form_state) {
  global $user;
  variable_set('site_name', $form_state['values']['site_name']);
  variable_set('site_mail', $form_state['values']['site_mail']);
  variable_set('date_default_timezone', $form_state['values']['date_default_timezone']);
  variable_set('site_default_country', $form_state['values']['site_default_country']);

  // Enable update.module if this option was selected.
  if ($form_state['values']['update_status_module'][1]) {
    module_enable(array(
      'update',
    ), FALSE);

    // Add the site maintenance account's email address to the list of
    // addresses to be notified when updates are available, if selected.
    if ($form_state['values']['update_status_module'][2]) {
      variable_set('update_notify_emails', array(
        $form_state['values']['account']['mail'],
      ));
    }
  }

  // We precreated user 1 with placeholder values. Let's save the real values.
  $account = user_load(1);
  $merge_data = array(
    'init' => $form_state['values']['account']['mail'],
    'roles' => !empty($account->roles) ? $account->roles : array(),
    'status' => 1,
    'timezone' => $form_state['values']['date_default_timezone'],
  );
  user_save($account, array_merge($form_state['values']['account'], $merge_data));

  // Load global $user and perform final login tasks.
  $user = user_load(1);
  user_login_finalize();
  if (isset($form_state['values']['clean_url'])) {
    variable_set('clean_url', $form_state['values']['clean_url']);
  }

  // Record when this install ran.
  variable_set('install_time', $_SERVER['REQUEST_TIME']);
}