diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php b/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php index 0c7f4c1..0f7cba1 100644 --- a/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php +++ b/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php @@ -51,8 +51,8 @@ public function __construct(SystemManager $systemManager) { * The current status of the Drupal installation. */ public function status() { - $requirements = $this->systemManager->list_requirements(); - $this->systemManager->fix_anonymous_uid(); + $requirements = $this->systemManager->listRequirements(); + $this->systemManager->fixAnonymousUid(); return theme('status_report', array('requirements' => $requirements)); } diff --git a/core/modules/system/lib/Drupal/system/SystemManager.php b/core/modules/system/lib/Drupal/system/SystemManager.php index cdb46e8..c6b9572 100644 --- a/core/modules/system/lib/Drupal/system/SystemManager.php +++ b/core/modules/system/lib/Drupal/system/SystemManager.php @@ -43,9 +43,9 @@ public function __construct(ModuleHandlerInterface $module_handler, Connection $ * @return boolean * Returns the status of the system. */ - public function check_requirements() { - $requirements = $this->list_requirements(); - return drupal_requirements_severity($requirements) == REQUIREMENT_ERROR; + public function checkRequirements() { + $requirements = $this->listRequirements(); + return $this->getMaxSeverity($requirements) == REQUIREMENT_ERROR; } /** @@ -54,7 +54,7 @@ public function check_requirements() { * @return array * An array of system requirements. */ - public function list_requirements() { + public function listRequirements() { // Load .install files include_once DRUPAL_ROOT . '/core/includes/install.inc'; drupal_load_updates(); @@ -78,7 +78,7 @@ public function list_requirements() { * MySQL import might have set the uid of the anonymous user to autoincrement * value. Let's try fixing it. See http://drupal.org/node/204411 */ - public function fix_anonymous_uid() { + public function fixAnonymousUid() { $this->database->update('users') ->expression('uid', 'uid - uid') ->condition('name', '') @@ -87,4 +87,24 @@ public function fix_anonymous_uid() { ->execute(); } + /** + * Extracts the highest severity from the requirements array. + * + * @param $requirements + * An array of requirements, in the same format as is returned by + * hook_requirements(). + * + * @return + * The highest severity in the array. + */ + public function getMaxSeverity(&$requirements) { + $severity = REQUIREMENT_OK; + foreach ($requirements as $requirement) { + if (isset($requirement['severity'])) { + $severity = max($severity, $requirement['severity']); + } + } + return $severity; + } + } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index e889dc4..9459998 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -20,7 +20,7 @@ function system_admin_config_page() { // Check for status report errors. // @todo Use depedancy injection in http://drupal.org/node/1987810. - if (Drupal::service('system.manager')->check_requirements() && user_access('administer site configuration')) { + if (Drupal::service('system.manager')->checkRequirements() && user_access('administer site configuration')) { drupal_set_message(t('One or more problems were detected with your Drupal installation. Check the status report for more information.', array('@status' => url('admin/reports/status'))), 'error'); } $blocks = array();