From 25a615ebe4de1820fa8030446144880d3b6b0684 Mon Sep 17 00:00:00 2001 From: phenaproxima <phenaproxima@205645.no-reply.drupal.org> Date: Tue, 7 Dec 2021 18:20:26 +0000 Subject: [PATCH] Issue #3253055 by phenaproxima: Move 9.3 shim module into the main module --- automatic_updates.info.yml | 2 +- automatic_updates.module | 31 +++++++++++++ .../automatic_updates_9_3_shim.module | 43 ------------------- 3 files changed, 32 insertions(+), 44 deletions(-) delete mode 100644 automatic_updates_9_3_shim/automatic_updates_9_3_shim.module diff --git a/automatic_updates.info.yml b/automatic_updates.info.yml index 1c3cd662e8..b1f27b670e 100644 --- a/automatic_updates.info.yml +++ b/automatic_updates.info.yml @@ -3,6 +3,6 @@ type: module description: 'Experimental module to develop automatic updates. Currently the module provides checks for update readiness but does not yet provide update functionality.' core_version_requirement: ^9.2 dependencies: - - drupal:package_manager - drupal:automatic_updates_9_3_shim + - drupal:package_manager - drupal:update diff --git a/automatic_updates.module b/automatic_updates.module index f5dbe49308..d4d4ba3bbb 100644 --- a/automatic_updates.module +++ b/automatic_updates.module @@ -20,6 +20,37 @@ function automatic_updates_page_top() { /** @var \Drupal\automatic_updates\Validation\AdminReadinessMessages $readiness_messages */ $readiness_messages = \Drupal::classResolver(AdminReadinessMessages::class); $readiness_messages->displayAdminPageMessages(); + + // @todo Rely on the route option after https://www.drupal.org/i/3236497 is + // committed. + // @todo Remove 'system.batch_page.html' after + // https://www.drupal.org/i/3238311 is committed. + $skip_routes = [ + 'system.batch_page.html', + 'automatic_updates.confirmation_page', + 'automatic_updates.report_update', + 'automatic_updates.module_update', + ]; + $route_name = \Drupal::routeMatch()->getRouteName(); + if (!in_array($route_name, $skip_routes, TRUE) && function_exists('update_page_top')) { + update_page_top(); + } +} + +/** + * Implements hook_module_implements_alter(). + * + * @todo Remove after https://www.drupal.org/i/3236497 is committed. + */ +function automatic_updates_module_implements_alter(&$implementations, $hook) { + if ($hook === 'page_top') { + // Remove hook_page_top() implementation from the Update module. This ' + // implementation displays error messages about security releases. We call + // this implementation in our own automatic_updates_page_top() except on our + // own routes to avoid stale messages about the security releases after an + // update. + unset($implementations['update']); + } } /** diff --git a/automatic_updates_9_3_shim/automatic_updates_9_3_shim.module b/automatic_updates_9_3_shim/automatic_updates_9_3_shim.module deleted file mode 100644 index 0734d6dafa..0000000000 --- a/automatic_updates_9_3_shim/automatic_updates_9_3_shim.module +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -/** - * @file - * Contains hook implementations for Automatic Updates 9.3 shim module. - */ - -/** - * Implements hook_page_top(). - */ -function automatic_updates_9_3_shim_page_top() { - // @todo Rely on the route option after https://www.drupal.org/i/3236497 is - // committed. - // @todo Remove 'system.batch_page.html' after - // https://www.drupal.org/i/3238311 is committed. - $skip_routes = [ - 'system.batch_page.html', - 'automatic_updates.confirmation_page', - 'automatic_updates.report_update', - 'automatic_updates.module_update', - ]; - $route_name = \Drupal::routeMatch()->getRouteName(); - if (!in_array($route_name, $skip_routes, TRUE) && function_exists('update_page_top')) { - update_page_top(); - } -} - -/** - * Implements hook_module_implements_alter(). - * - * @todo Remove after https://www.drupal.org/i/3236497 is committed. - */ -function automatic_updates_9_3_shim_module_implements_alter(&$implementations, $hook) { - if ($hook === 'page_top') { - // Remove hook_page_top() implementation from the Update module. This ' - // implementation displays error messages about security releases. We call - // this implementation in our own automatic_updates_page_top() except on our - // own routes to avoid stale messages about the security releases after an - // update. - unset($implementations['update']); - } - -} -- GitLab