Verified Commit 40ed96f6 authored by godotislate's avatar godotislate
Browse files

task: #3619447 Avoid rebuilding the router twice when uninstalling a profile in the installer

By: catch
By: gábor hojtsy
(cherry picked from commit 8cb43d97)
parent 000c5058
Loading
Loading
Loading
Loading
+6 −5
Changes for core/includes/install.core.inc: 6 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -1817,15 +1817,16 @@ function install_finished(&$install_state): void {
  if ($install_state['profile_info']['keep_profile'] ?? TRUE) {
    // Installation profiles are always loaded last.
    \Drupal::service(ModuleWeight::class)->set($profile, 1000);
  }
  else {
    \Drupal::service('module_installer')->uninstall([$profile]);
  }

    // 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.
    // This is not necessary when the profile is uninstalled because
    // uninstalling a module rebuilds the router anyway.
    \Drupal::service('router.builder')->rebuild();
  }
  else {
    \Drupal::service('module_installer')->uninstall([$profile]);
  }

  if ($install_state['interactive']) {
    // Load current user and perform final login tasks.