You are here

function update_check_incompatibility in Drupal 9

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

Tests the compatibility of a module or theme.

Deprecated

in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided.

See also

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

\Drupal\Core\Extension\ExtensionList::checkIncompatibility()

1 call to update_check_incompatibility()
UpdateDeprecationTest::testUpdateCheckIncompatibility in core/tests/Drupal/KernelTests/Core/Extension/UpdateDeprecationTest.php
Tests update_check_incompatibility() function.

File

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

Code

function update_check_incompatibility($name, $type = 'module') {
  @trigger_error('update_check_incompatibility() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3150727', E_USER_DEPRECATED);
  static $themes, $modules;

  // Store values of expensive functions for future use.
  if (empty($themes) || empty($modules)) {

    // We need to do a full rebuild here to make sure the database reflects any
    // code changes that were made in the filesystem before the update script
    // was initiated.
    $themes = \Drupal::service('theme_handler')
      ->rebuildThemeData();
    $modules = \Drupal::service('extension.list.module')
      ->reset()
      ->getList();
  }
  if ($type == 'module' && isset($modules[$name])) {
    $file = $modules[$name];
  }
  elseif ($type == 'theme' && isset($themes[$name])) {
    $file = $themes[$name];
  }
  if (!isset($file) || $file->info['core_incompatible'] || version_compare(phpversion(), $file->info['php']) < 0) {
    return TRUE;
  }
  return FALSE;
}