You are here

function install_finished in Drupal 8

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

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

Parameters

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

Return value

A message informing the user that the installation is complete.

File

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

Code

function install_finished(&$install_state) {
  $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();

  // Run cron to populate update status tables (if available) so that users
  // will be warned if they've installed an out of date Drupal version.
  // Will also trigger indexing of profile-supplied content or feeds.
  \Drupal::service('cron')
    ->run();
  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);
}