function install_configure_form_submit

Form submission handler for install_configure_form().

See also

install_configure_form_validate()

File

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

Code

function install_configure_form_submit($form, &$form_state) {
  global $user;
  config('system.site')
    ->set('name', $form_state['values']['site_name'])
    ->set('mail', $form_state['values']['site_mail'])
    ->set('langcode', language_default()->langcode)
    ->save();
  config('system.timezone')
    ->set('default', $form_state['values']['date_default_timezone'])
    ->save();
  config('system.date')
    ->set('country.default', $form_state['values']['site_default_country'])
    ->save();

  // Enable update.module if this option was selected.
  if ($form_state['values']['update_status_module'][1]) {
    module_enable(array(
      'file',
      '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]) {
      config('update.settings')
        ->set('notification.emails', array(
        $form_state['values']['account']['mail'],
      ))
        ->save();
    }
  }

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

  // Load global $user and perform final login tasks.
  $user = user_load(1);
  user_login_finalize();

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