1 common.inc backdrop_check_incompatibility(array $dependency_info, $current_version)

Checks whether a version is compatible with a given dependency.

Parameters

array $dependency_info: The parsed dependency structure from backdrop_parse_dependency().

string $current_version: The version to check against (like 4.2 or 1.10.0-beta4).

Return value

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

See also

backdrop_parse_dependency()

File

core/includes/common.inc, line 8852
Common functions that many Backdrop modules will need to reference.

Code

function backdrop_check_incompatibility(array $dependency_info, $current_version) {
  $current_version = _backdrop_version_compare_convert($current_version);
  if (!empty($dependency_info['versions'])) {
    foreach ($dependency_info['versions'] as $required_version) {
      if ((isset($required_version['op']) && !version_compare($current_version, _backdrop_version_compare_convert($required_version['version']), $required_version['op']))) {
        return $dependency_info['original_version'];
      }
    }
  }
  // No incompatibilities.
  return NULL;
}