diff --git a/core/modules/system/src/SystemManager.php b/core/modules/system/src/SystemManager.php index e5d3a18..4504f05 100644 --- a/core/modules/system/src/SystemManager.php +++ b/core/modules/system/src/SystemManager.php @@ -110,7 +110,7 @@ public function listRequirements() { // Check run-time requirements and status information. $requirements = $this->moduleHandler->invokeAll('requirements', array('runtime')); - usort($requirements, function($a, $b) { + uasort($requirements, function ($a, $b) { if (!isset($a['weight'])) { if (!isset($b['weight'])) { return strcasecmp($a['title'], $b['title']); diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index f9c49c7..16d605d 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -146,7 +146,7 @@ function template_preprocess_status_report(&$variables) { ), ); - foreach ($variables['requirements'] as $i => $requirement) { + foreach ($variables['requirements'] as $key => $requirement) { // Always use the explicit requirement severity, if defined. Otherwise, // default to REQUIREMENT_OK in the installer to visually confirm that // installation requirements are met. And default to REQUIREMENT_INFO to @@ -160,8 +160,8 @@ function template_preprocess_status_report(&$variables) { else { $severity = $severities[REQUIREMENT_INFO]; } - $variables['requirements'][$i]['severity_title'] = $severity['title']; - $variables['requirements'][$i]['severity_status'] = $severity['status']; + $variables['requirements'][$key]['severity_title'] = $severity['title']; + $variables['requirements'][$key]['severity_status'] = $severity['status']; } } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 7bb68b6..4b86c01 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -497,28 +497,19 @@ function system_requirements($phase) { ], ]; } - $cron_url = \Drupal::url('system.cron', ['key' => \Drupal::state()->get('system.cron_key'), ['absolute' => TRUE]]); - $requirements['cron']['run_cron'][] = [ - [ - '#type' => 'link', - '#title' => t('Run cron'), - '#attributes' => [ - 'class' => ['button', 'button--primary', 'button--small'], - ], - '#url' => Url::fromRoute('system.run_cron'), - ], - ]; - $requirements['cron']['cron_settings'][] = [ + $requirements['cron']['description'][] = [ [ '#type' => 'link', + '#prefix' => '(', '#title' => t('more information'), + '#suffix' => ')', '#url' => Url::fromRoute('system.cron_settings'), ], - ]; - $requirements['cron']['description'][] = [ [ - '#prefix' => '
', - '#markup' => t('To run cron from outside the site, go to @cron', [':url' => $cron_url, '@cron' => $cron_url]), + '#prefix' => '
', + '#type' => 'link', + '#title' => t('Run cron'), + '#url' => Url::fromRoute('system.run_cron'), ], ]; } diff --git a/core/themes/seven/css/components/system-status-report.css b/core/themes/seven/css/components/system-status-report.css index c8168f3..809d044 100644 --- a/core/themes/seven/css/components/system-status-report.css +++ b/core/themes/seven/css/components/system-status-report.css @@ -53,15 +53,14 @@ background-size: 30px; } - .system-status-general-info__item-details { box-sizing: border-box; display: inline-block; - width: 80%; + width: calc(100% - 60px); padding-left: 10px; position: relative; } -.system-status-general-info__item-details h3 { +.system-status-general-info__item-title { margin-bottom: 0; } .system-status-general-info__run-cron { @@ -95,6 +94,7 @@ } [dir="rtl"] .system-status-general-info__run-cron { left: 1em; + right: auto; } } @media screen and (min-width: 60em) { @@ -124,7 +124,7 @@ padding: 1em 1em 1em 3em; box-sizing: border-box; } -a.details-title { +.system-status-report__status-title .details-title { color: inherit; text-transform: none; } @@ -134,7 +134,7 @@ html:not(.details) .system-status-report__status-title { .system-status-report__status-title .details-title { padding-left: 3em; } -[dir="rtl"] a.details-title { +[dir="rtl"] .system-status-report__status-title .details-title { padding-right: 3em; padding-left: 0; } @@ -170,7 +170,7 @@ html[dir="rtl"].details .system-status-report__status-title { margin-right: 10px; } [dir="rtl"] .system-status-report__status-title .details-title:before, -html[dir="rtl"].details .system-status-report__status-title:before { +[dir="rtl"].details .system-status-report__status-title:before { left: auto; right: 10px; } @@ -188,7 +188,8 @@ html[dir="rtl"].details .system-status-report__status-title:before { padding: 0 1em 1em 3em; } [dir="rtl"] .system-status-report__entry__value { - padding: 0 3em 1em 1em; + padding-left: 3em; + padding-right: 1em; } @media screen and (max-width: 48em) { @@ -204,7 +205,7 @@ html[dir="rtl"].details .system-status-report__status-title:before { clear: both; } .system-status-report details > summary:first-child { - width: 25%; + width: 35ch; float: left; } .collapse-processed > .system-status-report__status-title:before { @@ -214,7 +215,7 @@ html[dir="rtl"].details .system-status-report__status-title:before { display: none; } .system-status-report__entry__value { - width: 70%; + width: calc(100% - 35ch - 1em); float: right; display: block; padding-left: 0; diff --git a/core/themes/seven/js/responsive-details.js b/core/themes/seven/js/responsive-details.js index 58d29d1..d1628da 100644 --- a/core/themes/seven/js/responsive-details.js +++ b/core/themes/seven/js/responsive-details.js @@ -1,46 +1,37 @@ /** * @file - * Responsive details elements + * Responsive details elements. */ + (function ($, Drupal) { 'use strict'; - function init(context) { - var $statusDetails = $(context).find('.system-status-report__entry'); - - function closeAllDetails() { - // If user explicitly opened one, leave it alone - $statusDetails.each(function() { - $(this).find('summary[aria-pressed!=true]') - .parent('details') - .attr('open', false); - }) - } - - function openAllDetails() { - $statusDetails.attr('open', true); - } - - function handleResize(e) { - var desktop = window.matchMedia('(min-width:48em)'); - if (desktop.matches) { - openAllDetails() - } - else { - closeAllDetails(); - } - } - - $(window).on('resize.details', Drupal.debounce(handleResize, 150)).trigger('resize.details'); - } - /** - * Initialise the details JS. + * Attaches the responsive behavior to details elements. + * + * @type {Drupal~behavior} + * + * @prop {Drupal~behaviorAttach} attach + * Attaches the responsive behavior to status report specific details elements. */ Drupal.behaviors.responsiveDetails = { - attach: function (context, settings) { - init(context); + attach: function (context) { + var $statusDetails = $(context).find('.system-status-report__entry'); + + function handleResize() { + if (window.matchMedia('(min-width:48em)').matches) { + $statusDetails.attr('open', true); + } + else { + // If user explicitly opened one, leave it alone. + $statusDetails.find('summary[aria-pressed!=true]') + .parent('details') + .attr('open', false); + } + } + + $(window).on('resize.details', Drupal.debounce(handleResize, 150)).trigger('resize.details'); } }; diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme index b2358b4..6dd5e32 100644 --- a/core/themes/seven/seven.theme +++ b/core/themes/seven/seven.theme @@ -159,11 +159,11 @@ function seven_preprocess_status_report(&$variables) { 'status' => 'ok', ], REQUIREMENT_WARNING => [ - 'title' => t('Warnings Found'), + 'title' => t('Warning'), 'status' => 'warning', ], REQUIREMENT_ERROR => [ - 'title' => t('Errors Found'), + 'title' => t('Error'), 'status' => 'error', ], ]; @@ -177,44 +177,31 @@ function seven_preprocess_status_report(&$variables) { $grouped_requirements = []; // Loop through requirements and pull out items. - foreach ($variables['requirements'] as $i => &$requirement) { - /** @var Drupal\Core\StringTranslation\TranslatableMarkup $title */ - $title = $requirement['title']; - $title = $title->getUntranslatedString(); - switch ($title) { - case 'Drupal': - $variables['version'] = $requirement; - unset($variables['requirements'][$i]); + foreach ($variables['requirements'] as $key => &$requirement) { + switch ($key) { + case 'cron': + foreach ($requirement['description'] as &$description_elements) { + foreach ($description_elements as &$description_element) { + if (isset($description_element['#url']) && $description_element['#url']->getRouteName() == 'system.run_cron') { + $description_element['#attributes']['class'][] = 'button'; + $description_element['#attributes']['class'][] = 'button--small'; + $description_element['#attributes']['class'][] = 'button--primary'; + $description_element['#attributes']['class'][] = 'system-status-general-info__run-cron'; + } + } + } + $variables[$key] = $requirement; + unset($variables['requirements'][$key]); break; - case 'Cron maintenance tasks': - $variables['cron'] = $requirement; - unset($variables['requirements'][$i]); - break; - - case 'Web server': - $variables['webserver'] = $requirement; - unset($variables['requirements'][$i]); - break; - - case 'Database system': - $variables['database_system'] = $requirement; - unset($variables['requirements'][$i]); - break; - - case 'Database system version': - $variables['database_system_version'] = $requirement; - unset($variables['requirements'][$i]); - break; - - case 'PHP': - $variables['php'] = $requirement; - unset($variables['requirements'][$i]); - break; - - case 'PHP memory limit': - $variables['php_memory_limit'] = $requirement; - unset($variables['requirements'][$i]); + case 'drupal': + case 'webserver': + case 'database_system': + case 'database_system_version': + case 'php': + case 'php_memory_limit': + $variables[$key] = $requirement; + unset($variables['requirements'][$key]); break; } @@ -232,7 +219,7 @@ function seven_preprocess_status_report(&$variables) { } // If the requirement is still set, add it to its group. - if (isset($variables['requirements'][$i])) { + if (isset($variables['requirements'][$key])) { $grouped_requirements[$severity['status']]['title'] = $severity['title']; $grouped_requirements[$severity['status']]['type'] = $severity['status']; $grouped_requirements[$severity['status']]['items'][] = $requirement; diff --git a/core/themes/seven/templates/status-report.html.twig b/core/themes/seven/templates/status-report.html.twig index c984965..1116048 100644 --- a/core/themes/seven/templates/status-report.html.twig +++ b/core/themes/seven/templates/status-report.html.twig @@ -24,7 +24,6 @@ {% set element_width_class = ' system-status-report-counters__item--half-width' %} {% endif %}
- {% if error %}
@@ -74,34 +73,30 @@
-

Drupal Version

- {{ version.value }} - {% if version.description %} -
{{ version.description }}
+

{{ 'Drupal Version'|t }}

+ {{ drupal.value }} + {% if drupal.description %} +
{{ drupal.description }}
{% endif %}
-

Last Cron Run

+

{{ 'Last Cron Run'|t }}

{{ cron.value }} - {% if cron.cron_settings %} -
({{ cron.cron_settings }}) - {% endif %} - {{ cron.run_cron }} {% if cron.run_cron %}
{{ cron.run_cron }}
{% endif %} {% if cron.description %} -
{{ cron.description }}
+
{{ cron.description }}
{% endif %}
-

Web Server

+

{{ 'Web Server'|t }}

{{ webserver.value }} {% if webserver.description %}
{{ webserver.description }}
@@ -111,13 +106,13 @@
-

PHP

+

{{ 'PHP'|t }}

{{ 'Version'|t }}
{{ php.value }} {% if php.description %}
{{ php.description }}
{% endif %}
- {{ 'Memory'|t }}
{{ php_memory_limit.value }} + {{ 'Memory limit'|t }}
{{ php_memory_limit.value }} {% if php_memory_limit.description %}
{{ php_memory_limit.description }}
{% endif %} @@ -126,7 +121,7 @@
-

Database

+

{{ 'Database'|t }}

{{ 'Version'|t }}
{{ database_system_version.value }} {% if database_system_version.description %}
{{ database_system_version.description }}