diff --git a/automatic_updates.info.yml b/automatic_updates.info.yml index 1c3cd662e80c42fbb8ab3ae1d84625bac6e69409..b1f27b670e2d09b1f3abefa20bb9a97f14a3af2f 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 f5dbe493088b4e350a7e2ef2e0e30f46c31626e7..d4d4ba3bbb71cd494717d1f94b60b662bb744cd9 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 0734d6dafab92a0b0de1abdba9071d57074d0d07..0000000000000000000000000000000000000000 --- 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']); - } - -}