function install_config_revert_install_changes

Same name in other branches
  1. 8.9.x core/includes/install.core.inc \install_config_revert_install_changes()
  2. 10 core/includes/install.core.inc \install_config_revert_install_changes()
  3. 11.x core/includes/install.core.inc \install_config_revert_install_changes()

Reverts configuration if hook_install() implementations have made changes.

This step ensures that the final configuration matches the configuration provided to the installer.

File

core/includes/install.core.inc, line 2413

Code

function install_config_revert_install_changes() {
    global $install_state;
    $storage_comparer = new StorageComparer(\Drupal::service('config.storage.sync'), \Drupal::service('config.storage'));
    $storage_comparer->createChangelist();
    if ($storage_comparer->hasChanges()) {
        $config_importer = new ConfigImporter($storage_comparer, \Drupal::service('event_dispatcher'), \Drupal::service('config.manager'), \Drupal::service('lock.persistent'), \Drupal::service('config.typed'), \Drupal::service('module_handler'), \Drupal::service('module_installer'), \Drupal::service('theme_handler'), \Drupal::service('string_translation'), \Drupal::service('extension.list.module'), \Drupal::service('extension.list.theme'));
        try {
            $config_importer->import();
        } catch (ConfigImporterException $e) {
            $messenger = \Drupal::messenger();
            // There are validation errors.
            $messenger->addError(t('The configuration synchronization failed validation.'));
            foreach ($config_importer->getErrors() as $message) {
                $messenger->addError($message);
            }
            install_display_output([
                '#title' => t('Configuration validation'),
            ], $install_state);
        }
        // At this point the configuration should match completely.
        if (\Drupal::moduleHandler()->moduleExists('language')) {
            // If the English language exists at this point we need to ensure
            // install_download_additional_translations_operations() does not delete
            // it.
            if (ConfigurableLanguage::load('en')) {
                $install_state['profile_info']['keep_english'] = TRUE;
            }
        }
    }
}

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