Performs final installation steps and displays a 'finished' page.
$install_state: An array of information about the current installation state.
A message informing the user that the installation is complete.
function install_finished(&$install_state) {
$profile = drupal_get_profile();
// Remember the profile which was used.
variable_set('install_profile', $profile);
// Installation profiles are always loaded last.
module_set_weight($profile, 1000);
// Flush all caches to ensure that any full bootstraps during the installer
// do not leave stale cached data, and that any content types or other items
// registered by the installation profile are registered correctly.
drupal_flush_all_caches();
drupal_set_title(st('@drupal installation complete', array(
'@drupal' => drupal_install_profile_distribution_name(),
)), PASS_THROUGH);
$messages = drupal_set_message();
$output = '<p>' . st('Congratulations, you installed @drupal!', array(
'@drupal' => drupal_install_profile_distribution_name(),
)) . '</p>';
// Ensure the URL that is generated for the home page does not have 'install.php'
// in it.
$request = Request::createFromGlobals();
$generator = Drupal::urlGenerator();
$generator
->setBasePath(str_replace('/core', '', $request
->getBasePath()) . '/');
$generator
->setScriptPath('');
$url = $generator
->generateFromPath('');
$output .= '<p>' . (isset($messages['error']) ? st('Review the messages above before visiting <a href="@url">your new site</a>.', array(
'@url' => $url,
)) : st('<a href="@url">Visit your new site</a>.', array(
'@url' => $url,
))) . '</p>';
// 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_cron_run();
// Save a snapshot of the intially installed configuration.
$active = drupal_container()
->get('config.storage');
$snapshot = drupal_container()
->get('config.storage.snapshot');
config_import_create_snapshot($active, $snapshot);
return $output;
}