commit a57edaaf08be93b86443f2f840d7ec8c0aed6d19 Author: Neil Drumm Date: Mon Feb 27 17:36:04 2017 -0500 wip diff --git a/core/modules/update/images/shield-icon.svg b/core/modules/update/images/shield-icon.svg new file mode 100644 index 0000000..9a7c56d --- /dev/null +++ b/core/modules/update/images/shield-icon.svg @@ -0,0 +1,35 @@ + + + + + + + image/svg+xml + + + + + + + + + diff --git a/core/modules/update/src/UpdateProcessor.php b/core/modules/update/src/UpdateProcessor.php index 25dfc7a..9115357 100644 --- a/core/modules/update/src/UpdateProcessor.php +++ b/core/modules/update/src/UpdateProcessor.php @@ -231,6 +231,9 @@ protected function parseXml($raw_xml) { foreach ($release->children() as $k => $v) { $data['releases'][$version][$k] = (string) $v; } + if ($release->security['covered']) { + $data['releases'][$version]['security_covered'] = TRUE; + } $data['releases'][$version]['terms'] = []; if ($release->terms) { foreach ($release->terms->children() as $term) { diff --git a/core/modules/update/tests/modules/update_test/bbb_update_test.1_0.xml b/core/modules/update/tests/modules/update_test/bbb_update_test.1_0.xml index 8d705b5..2142c04 100644 --- a/core/modules/update/tests/modules/update_test/bbb_update_test.1_0.xml +++ b/core/modules/update/tests/modules/update_test/bbb_update_test.1_0.xml @@ -16,11 +16,11 @@ bbb_update_test 8.x-1.0 8.x-1.0 - DRUPAL-7--1-0 + 8.x-1.0 1 0 published - http://example.com/bbb_update_test-7-x-1-0-release + http://example.com/bbb_update_test-8-x-1-0-release http://example.com/bbb_update_test-8.x-1.0.tar.gz 1250424521 b966255555d9c9b86d480ca08cfaa98e @@ -29,6 +29,26 @@ Release typeNew features Release typeBug fixes + + + + bbb_update_test 8.x-1.0-beta1 + 8.x-1.0-beta1 + 8.x-1.0-beta1 + 1 + 0 + beta1 + published + http://example.com/bbb_update_test-8-x-1-0-beta1 + http://example.com/bbb_update_test-8.x-1.0-beta1.tar.gz + 1250424521 + 7da7b18ce17cef2122f5cbca1bfe626a + 1073751331 + + Release typeNew features + Release typeBug fixes + + Not covered! diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 32b5b8c..6b438ee 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -227,7 +227,7 @@ function update_theme() { // We are using template instead of '#type' => 'table' here to keep markup // out of preprocess and allow for easier changes to markup. 'update_version' => [ - 'variables' => ['version' => NULL, 'title' => NULL, 'attributes' => []], + 'variables' => ['version' => NULL, 'title' => NULL, 'security_icon' => NULL, 'attributes' => []], 'file' => 'update.report.inc', ], ]; diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 7b14a05..886071d 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -127,6 +127,14 @@ function template_preprocess_update_project_status(&$variables) { $versions_inner = []; $security_class = []; $version_class = []; + $security_icon = [ + '#theme' => 'image', + '#width' => 18, + '#height' => 18, + '#uri' => 'core/modules/update/images/shield-icon.svg', + '#alt' => t('shield'), + '#title' => t('shield'), + ]; if (isset($project['recommended'])) { if ($project['status'] != UPDATE_CURRENT || $project['existing_version'] !== $project['recommended']) { @@ -160,6 +168,7 @@ function template_preprocess_update_project_status(&$variables) { '#theme' => 'update_version', '#version' => $project['releases'][$project['recommended']], '#title' => t('Recommended version:'), + '#security_icon' => $security_icon, '#attributes' => ['class' => $version_class], ]; } @@ -172,6 +181,7 @@ function template_preprocess_update_project_status(&$variables) { '#theme' => 'update_version', '#version' => $security_update, '#title' => t('Security update:'), + '#security_icon' => $security_icon, '#attributes' => ['class' => $security_class], ]; } @@ -183,6 +193,7 @@ function template_preprocess_update_project_status(&$variables) { '#theme' => 'update_version', '#version' => $project['releases'][$project['latest_version']], '#title' => t('Latest version:'), + '#security_icon' => $security_icon, '#attributes' => ['class' => ['version-latest']], ]; } diff --git a/core/themes/stable/templates/admin/update-version.html.twig b/core/themes/stable/templates/admin/update-version.html.twig index 6c23584..a02f3d3 100644 --- a/core/themes/stable/templates/admin/update-version.html.twig +++ b/core/themes/stable/templates/admin/update-version.html.twig @@ -6,21 +6,33 @@ * Available variables: * - attributes: HTML attributes suitable for a container element. * - title: The title of the project. + * - security_icon: The security coverage icon. * - version: A list of data about the latest released version, containing: * - version: The version number. * - date: The date of the release. * - download_link: The URL for the downloadable file. * - release_link: The URL for the release notes. + * - security_covered: If the release is covered by the security advisory + * policy. + * - security: When not covered, the reason why. */ #}
{{ title }}
-
+
{{ version.version }} ({{ version.date|date('Y-M-d') }}) + {% if version.security_covered %} + + {{ security_icon }} + + {% endif %} + {% if version.security %} +
{{ version.security|t }} + {% endif %}
-