8.5.x common.inc drupal_check_incompatibility($v, $current_version)
8.0.x common.inc drupal_check_incompatibility($v, $current_version)
8.1.x common.inc drupal_check_incompatibility($v, $current_version)
8.2.x common.inc drupal_check_incompatibility($v, $current_version)
8.3.x common.inc drupal_check_incompatibility($v, $current_version)
8.4.x common.inc drupal_check_incompatibility($v, $current_version)
8.6.x common.inc drupal_check_incompatibility($v, $current_version)
7.x common.inc drupal_check_incompatibility($v, $current_version)

Checks whether a version is compatible with a given dependency.

Parameters

$v: The parsed dependency structure from drupal_parse_dependency().

$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.

See also

drupal_parse_dependency()

1 call to drupal_check_incompatibility()
system_requirements in modules/system/system.install
Implements hook_requirements().

File

includes/common.inc, line 7810
Common functions that many Drupal modules will need to reference.

Code

function drupal_check_incompatibility($v, $current_version) {
  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'];
      }
    }
  }
}