You are here

function install_write_profile in Drupal 8

Installation task; writes profile to settings.php if possible.

Parameters

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

Deprecated

in drupal:8.3.0 and is removed from drupal:9.0.0. The install profile is written to core.extension.

See also

_install_select_profile()

File

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

Code

function install_write_profile($install_state) {

  // Only write the install profile to settings.php if it already exists. The
  // value from settings.php is never used but drupal_rewrite_settings() does
  // not support removing a setting. If the value is present in settings.php
  // there will be an informational notice on the status report.
  $settings_path = \Drupal::service('site.path') . '/settings.php';
  if (is_writable($settings_path) && array_key_exists('install_profile', Settings::getAll())) {

    // Remember the profile which was used.
    $settings['settings']['install_profile'] = (object) [
      'value' => $install_state['parameters']['profile'],
      'required' => TRUE,
    ];
    drupal_rewrite_settings($settings);
  }
}