diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php b/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php index 6121bf0..0c7f4c1 100644 --- a/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php +++ b/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php @@ -11,7 +11,6 @@ use Symfony\Component\HttpFoundation\Response; use Drupal\Core\ControllerInterface; use Drupal\Core\Database\Connection; -use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\system\SystemManager; /** @@ -27,19 +26,11 @@ class SystemInfoController implements ControllerInterface { protected $systemManager; /** - * Module handler service. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( - $container->get('system.manager'), - $container->get('module_handler') + $container->get('system.manager') ); } @@ -47,13 +38,10 @@ public static function create(ContainerInterface $container) { * Constructs a SystemInfoController object. * * @param \Drupal\system\SystemManager $systemManager - * Module handler service. - * @param \Drupal\Core\Database\ModuleHandlerInterface $moduleHandler - * Database connection. + * System manager service. */ - public function __construct(SystemManager $systemManager, ModuleHandlerInterface $moduleHandler) { + public function __construct(SystemManager $systemManager) { $this->systemManager = $systemManager; - $this->moduleHandler = $moduleHandler; } /** @@ -63,7 +51,9 @@ public function __construct(SystemManager $systemManager, ModuleHandlerInterface * The current status of the Drupal installation. */ public function status() { - return $this->systemManager->status(); + $requirements = $this->systemManager->list_requirements(); + $this->systemManager->fix_anonymous_uid(); + 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 7b46fd0..cdb46e8 100644 --- a/core/modules/system/lib/Drupal/system/SystemManager.php +++ b/core/modules/system/lib/Drupal/system/SystemManager.php @@ -38,11 +38,23 @@ public function __construct(ModuleHandlerInterface $module_handler, Connection $ } /** + * Checks for requirement severity. + * + * @return boolean + * Returns the status of the system. + */ + public function check_requirements() { + $requirements = $this->list_requirements(); + return drupal_requirements_severity($requirements) == REQUIREMENT_ERROR; + } + + /** * Displays the site status report. Can also be used as a pure check. * - * @return bool|string + * @return array + * An array of system requirements. */ - public function status($check = FALSE) { + public function list_requirements() { // Load .install files include_once DRUPAL_ROOT . '/core/includes/install.inc'; drupal_load_updates(); @@ -59,19 +71,20 @@ public function status($check = FALSE) { return isset($b['weight']) ? $a['weight'] - $b['weight'] : $a['weight']; }); - if ($check) { - return drupal_requirements_severity($requirements) == REQUIREMENT_ERROR; - } + return $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 + /** + * 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() { $this->database->update('users') ->expression('uid', 'uid - uid') ->condition('name', '') ->condition('pass', '') ->condition('status', 0) ->execute(); - return theme('status_report', array('requirements' => $requirements)); } } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 3b619f1..e889dc4 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')->status(TRUE) && user_access('administer site configuration')) { + if (Drupal::service('system.manager')->check_requirements() && 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();