1 install.core.inc install_configure_form_submit($form, &$form_state)

Form submission handler for install_configure_form().

See also

install_configure_form_validate()

File

core/includes/install.core.inc, line 1941
API functions for installing Backdrop.

Code

function install_configure_form_submit($form, &$form_state) {
  global $user;

  config('system.core')
    ->set('site_name', $form_state['values']['site_name'])
    ->save();
  config('system.date')
    ->set('default_timezone', $form_state['values']['date_default_timezone'])
    ->set('default_country', _install_get_timezone_country($form_state['values']['date_default_timezone']))
    ->save();

  // Enable checking for updates on cron.
  if (module_exists('update')) {
    // Set the update interval to 0 if automatic checking is disabled.
    config_set('update.settings', 'update_interval_days', (int) $form_state['values']['update_status_module'][1]);

    // 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_set('update.settings', 'update_emails', array($form_state['values']['account']['mail']));
    }
  }

  // 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();

  if (isset($form_state['values']['clean_url'])) {
    config_set('system.core', 'clean_url', $form_state['values']['clean_url']);
    backdrop_static_reset('url');
  }

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