Commit 68a786b4 authored by heddn's avatar heddn Committed by heddn
Browse files

Issue #3045690 by heddn: Handle contrib version that contains core version compatibility

parent 36566220
......@@ -78,7 +78,7 @@ class AutomaticUpdatesPsa {
$version_string = implode('||', $json->secure_versions);
$psa_constraint = $parser->parseConstraints($version_string);
$core_constraint = $parser->parseConstraints(trim(VERSION, '-dev'));
$core_constraint = $parser->parseConstraints(VERSION);
if ($psa_constraint->matches($core_constraint)) {
$messages[] = t('Drupal Core PSA: <a href="!url">%message</a>', array(
'%message' => $json->title,
......@@ -96,6 +96,11 @@ class AutomaticUpdatesPsa {
* The JSON object.
*/
protected static function contribParser(array &$messages, $json) {
array_walk($json->secure_versions, function (&$version) {
if (substr($version, 0, 4) === DRUPAL_CORE_COMPATIBILITY . '-') {
$version = substr($version, 4);
}
});
$modules = array_keys(module_list());
$themes = array_keys(list_themes());
$extensions = array_merge($modules, $themes);
......
......@@ -62,7 +62,7 @@ function automatic_updates_test_json() {
'project' => 'node',
'extensions' => array('node'),
'type' => 'module',
'secure_versions' => array('7.22'),
'secure_versions' => array('7.x-7.22', '8.x-8.8.0'),
'pubDate' => 'Tue, 19 Mar 2019 12:50:00 +0000',
);
$feed[] = array(
......@@ -71,7 +71,7 @@ function automatic_updates_test_json() {
'project' => 'Standard Install Profile',
'extensions' => array('standard'),
'type' => 'profile',
'secure_versions' => array('7.999'),
'secure_versions' => array('7.x-7.999'),
'pubDate' => 'Tue, 19 Mar 2019 12:50:00 +0000',
);
$feed[] = array(
......@@ -80,7 +80,7 @@ function automatic_updates_test_json() {
'project' => 'seven',
'extensions' => array('seven'),
'type' => 'theme',
'secure_versions' => array('7.999'),
'secure_versions' => array('7.x-7.999'),
'pubDate' => 'Tue, 19 Mar 2019 12:50:00 +0000',
);
$feed[] = array(
......@@ -89,7 +89,7 @@ function automatic_updates_test_json() {
'project' => 'foobar',
'extensions' => array('foobar'),
'type' => 'foobar',
'secure_versions' => array('7.0'),
'secure_versions' => array('7.x-1.2'),
'pubDate' => 'Tue, 19 Mar 2019 12:50:00 +0000',
);
$feed[] = array(
......@@ -98,7 +98,7 @@ function automatic_updates_test_json() {
'project' => 'token',
'extensions' => array('token'),
'type' => 'module',
'secure_versions' => array('1.5'),
'secure_versions' => array('7.x-1.7', '8.x-1.5'),
'pubDate' => 'Tue, 19 Mar 2019 12:50:00 +0000',
);
return drupal_json_output($feed);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment