function drupal_install_system

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

Install the base system and any required database drivers.

Separated from the installation of other modules so core system functions can be made available while other modules are installed.

Parameters

array $install_state: An array of information about the current installation state. This is used to set the default language.

1 call to drupal_install_system()
install_base_system in core/includes/install.core.inc
Installation task; install the base functionality Drupal needs to bootstrap.

File

core/includes/install.inc, line 190

Code

function drupal_install_system($install_state) : void {
  // Remove the service provider of the early installer.
  unset($GLOBALS['conf']['container_service_providers']['InstallerServiceProvider']);
  // Add the normal installer service provider.
  $GLOBALS['conf']['container_service_providers']['InstallerServiceProvider'] = 'Drupal\\Core\\Installer\\NormalInstallerServiceProvider';
  // Get the existing request.
  $request = \Drupal::request();
  // Reboot into a full production environment to continue the installation.
  /** @var \Drupal\Core\Installer\InstallerKernel $kernel */
  $kernel = \Drupal::service('kernel');
  $kernel->shutdown();
  // Have installer rebuild from the disk, rather then building from scratch.
  $kernel->rebuildContainer();
  // Reboot the kernel with new container.
  $kernel->boot();
  $kernel->preHandle($request);
  // Ensure our request includes the session if appropriate.
  if (PHP_SAPI !== 'cli') {
    $request->setSession($kernel->getContainer()
      ->get('session'));
  }
  // Install base system configuration.
  \Drupal::service('config.installer')->installDefaultConfig('core', 'core');
  // Store the installation profile in configuration to populate the
  // 'install_profile' container parameter.
  $config = \Drupal::configFactory()->getEditable('core.extension');
  if ($install_state['parameters']['profile'] === FALSE || !empty($install_state['profile_info']['opt_out_install'])) {
    $config->clear('profile');
  }
  else {
    $config->set('profile', $install_state['parameters']['profile']);
  }
  $config->save();
}

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