From e87beb039f3b0daf55d0dec7f676c8bbd88e1df9 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Tue, 30 Apr 2013 23:36:04 +0100 Subject: [PATCH] Revert "Issue #1938822 by sandhya.m, EllaTheHarpy: Convert update_status() to a new-style Controller." This reverts commit c7d74b3c70f5747d81aa588200465903ee550b34. --- .../update/Controller/UpdateController.php | 65 ------------------- core/modules/update/update.module | 4 +- core/modules/update/update.report.inc | 16 +++++ core/modules/update/update.routing.yml | 7 -- 4 files changed, 19 insertions(+), 73 deletions(-) delete mode 100644 core/modules/update/lib/Drupal/update/Controller/UpdateController.php diff --git a/core/modules/update/lib/Drupal/update/Controller/UpdateController.php b/core/modules/update/lib/Drupal/update/Controller/UpdateController.php deleted file mode 100644 index d46af8aa8724..000000000000 --- a/core/modules/update/lib/Drupal/update/Controller/UpdateController.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\update\Controller\UpdateController - */ - -namespace Drupal\update\Controller; - -use Drupal\Core\ControllerInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Controller routines for update routes. - */ -class UpdateController implements ControllerInterface { - - /** - * Module handler service. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * Constructs update status data. - * - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * Module Handler Service. - */ - public function __construct(ModuleHandlerInterface $module_handler) { - $this->moduleHandler = $module_handler; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('module_handler') - ); - } - - /** - * Returns a page about the update status of projects. - * - * @return array - * A build array with the update status of projects. - */ - public function updateStatus() { - $build = array( - '#theme' => 'update_report' - ); - if ($available = update_get_available(TRUE)) { - $this->moduleHandler->loadInclude('update', 'compare.inc'); - $build['#data'] = update_calculate_project_data($available); - } - else { - $build['#data'] = _update_no_data(); - } - return $build; - } - -} diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 59b35753db28..7dee311259fa 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -158,8 +158,10 @@ function update_menu() { $items['admin/reports/updates'] = array( 'title' => 'Available updates', 'description' => 'Get a status report about available updates for your installed modules and themes.', - 'route_name' => 'update_status', + 'page callback' => 'update_status', + 'access arguments' => array('administer site configuration'), 'weight' => -50, + 'file' => 'update.report.inc', ); $items['admin/reports/updates/list'] = array( 'title' => 'List', diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 35677d889244..607b523137cb 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -5,6 +5,22 @@ * Code required only when rendering the available updates report. */ +/** + * Page callback: Generates a page about the update status of projects. + * + * @see update_menu() + */ +function update_status() { + if ($available = update_get_available(TRUE)) { + module_load_include('inc', 'update', 'update.compare'); + $data = update_calculate_project_data($available); + return theme('update_report', array('data' => $data)); + } + else { + return theme('update_report', array('data' => _update_no_data())); + } +} + /** * Returns HTML for the project status report. * diff --git a/core/modules/update/update.routing.yml b/core/modules/update/update.routing.yml index 16ac4b4d805e..f201302d814c 100644 --- a/core/modules/update/update.routing.yml +++ b/core/modules/update/update.routing.yml @@ -4,10 +4,3 @@ update_settings: _form: '\Drupal\update\UpdateSettingsForm' requirements: _permission: 'administer site configuration' - -update_status: - pattern: '/admin/reports/updates' - defaults: - _content: '\Drupal\update\Controller\UpdateController::updateStatus' - requirements: - _permission: 'administer site configuration' -- GitLab