function update_check_incompatibility

Same name in other branches
  1. 7.x includes/update.inc \update_check_incompatibility()
  2. 9 core/includes/update.inc \update_check_incompatibility()

Tests the compatibility of a module or theme.

1 call to update_check_incompatibility()
update_fix_compatibility in core/includes/update.inc
Disables any extensions that are incompatible with the current core version.

File

core/includes/update.inc, line 48

Code

function update_check_incompatibility($name, $type = 'module') {
    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;
}

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