You are here

function update_fix_compatibility in Drupal 8

Same name and namespace in other branches
  1. 6 update.php \update_fix_compatibility()
  2. 7 includes/update.inc \update_fix_compatibility()

Disables any extensions that are incompatible with the current core version.

Deprecated

in Drupal 8.8.5 and is removed from Drupal 9.0.0.

See also

https://www.drupal.org/node/3026100

1 call to update_fix_compatibility()
CompatibilityFixTest::testFixCompatibility in core/tests/Drupal/KernelTests/Core/Update/CompatibilityFixTest.php
@expectedDeprecation update_fix_compatibility() is deprecated in Drupal 8.8.5 and will be removed before Drupal 9.0.0. There is no replacement. See https://www.drupal.org/node/3026100

File

core/includes/update.inc, line 23
Drupal database update API.

Code

function update_fix_compatibility() {
  @trigger_error(__FUNCTION__ . '() is deprecated in Drupal 8.8.5 and will be removed before Drupal 9.0.0. There is no replacement. See https://www.drupal.org/node/3026100', E_USER_DEPRECATED);

  // Fix extension objects if the update is being done via Drush 8. In non-Drush
  // environments this will already be fixed by the UpdateKernel this point.
  UpdateKernel::fixSerializedExtensionObjects(\Drupal::getContainer());
  $extension_config = \Drupal::configFactory()
    ->getEditable('core.extension');
  $save = FALSE;
  foreach ([
    'module',
    'theme',
  ] as $type) {
    foreach ($extension_config
      ->get($type) as $name => $weight) {
      if (update_check_incompatibility($name, $type)) {
        $extension_config
          ->clear("{$type}.{$name}");
        $save = TRUE;
      }
    }
  }
  if ($save) {
    $extension_config
      ->set('module', module_config_sort($extension_config
      ->get('module')));
    $extension_config
      ->save();
  }
}