function drupal_check_incompatibility

Same name in other branches
  1. 7.x includes/common.inc \drupal_check_incompatibility()

Checks whether a version is compatible with a given dependency.

Parameters

$v: A parsed dependency structure e.g. from ModuleHandler::parseDependency().

$current_version: The version to check against (like 4.2).

Return value

NULL if compatible, otherwise the original dependency version string that caused the incompatibility.

Deprecated

in drupal:8.7.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Extension\Dependency::isCompatible() instead.

See also

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

1 call to drupal_check_incompatibility()
DrupalCheckIncompatibilityTest::testDrupalCheckIncompatibility in core/tests/Drupal/KernelTests/Core/Common/DrupalCheckIncompatibilityTest.php
Tests drupal_check_incompatibility().

File

core/includes/common.inc, line 1154

Code

function drupal_check_incompatibility($v, $current_version) {
    @trigger_error(__FUNCTION__ . '() is deprecated. Use \\Drupal\\Core\\Extension\\Dependency::isCompatible() instead. See https://www.drupal.org/node/2756875', E_USER_DEPRECATED);
    if (!empty($v['versions'])) {
        foreach ($v['versions'] as $required_version) {
            if (isset($required_version['op']) && !version_compare($current_version, $required_version['version'], $required_version['op'])) {
                return $v['original_version'];
            }
        }
    }
}

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