function install_finished

Same name and namespace in other branches
  1. 7.x includes/install.core.inc \install_finished()
  2. 9 core/includes/install.core.inc \install_finished()
  3. 8.9.x core/includes/install.core.inc \install_finished()
  4. 10 core/includes/install.core.inc \install_finished()

Performs final installation steps and displays a 'finished' page.

Parameters

array $install_state: An array of information about the current installation state.

File

core/includes/install.core.inc, line 1902

Code

function install_finished(&$install_state) : void {
  $profile = $install_state['parameters']['profile'];
  // Installation profiles are always loaded last.
  module_set_weight($profile, 1000);
  // Build the router once after installing all modules.
  // This would normally happen upon KernelEvents::TERMINATE, but since the
  // installer does not use an HttpKernel, that event is never triggered.
  \Drupal::service('router.builder')->rebuild();
  if ($install_state['interactive']) {
    // Load current user and perform final login tasks.
    // This has to be done after drupal_flush_all_caches()
    // to avoid session regeneration.
    $account = User::load(1);
    user_login_finalize($account);
  }
  $success_message = t('Congratulations, you installed @drupal!', [
    '@drupal' => drupal_install_profile_distribution_name(),
  ]);
  \Drupal::messenger()->addStatus($success_message);
  // Record when this install ran.
  \Drupal::state()->set('install_time', \Drupal::time()->getRequestTime());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.