You are here

protected static function AutomaticUpdatesPsa::contribParser in Automatic Updates 7

Parse contrib project JSON version strings.

Parameters

array $messages: The messages array.

object $json: The JSON object.

1 call to AutomaticUpdatesPsa::contribParser()
AutomaticUpdatesPsa::getPublicServiceMessages in ./AutomaticUpdatesPsa.php

File

./AutomaticUpdatesPsa.php, line 75
Contains AutomaticUpdatesPsa class.

Class

AutomaticUpdatesPsa
Class AutomaticUpdatesPsa.

Code

protected static function contribParser(array &$messages, $json) {
  $extension_path = drupal_get_path($json->type, $json->project);
  $info = drupal_parse_info_file($extension_path . DIRECTORY_SEPARATOR . $json->project . '.info');
  $json->insecure = array_filter(array_map(static function ($version) {
    $version_array = explode('-', $version, 2);
    if ($version_array && $version_array[0] === DRUPAL_CORE_COMPATIBILITY) {
      return isset($version_array[1]) ? $version_array[1] : NULL;
    }
    if (count($version_array) === 1) {
      return $version_array[0];
    }
    if (count($version_array) === 2 && $version_array[1] === 'dev') {
      return $version;
    }
  }, $json->insecure));
  $version_array = explode('-', $info['version'], 2);
  $extension_version = isset($version_array[1]) && $version_array[1] !== 'dev' ? $version_array[1] : $info['version'];
  static::parseConstraints($messages, $json, $extension_version);
}