function install_finished
Same name in other branches
- 7.x includes/install.core.inc \install_finished()
- 9 core/includes/install.core.inc \install_finished()
- 8.9.x core/includes/install.core.inc \install_finished()
- 11.x 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.
File
-
core/
includes/ install.core.inc, line 1883
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);
// 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.