Commit bb395cb0 authored by Lucas Hedding's avatar Lucas Hedding Committed by Lucas Hedding
Browse files

Issue #3039120 by heddn, catch, larowlan: Create initial feature to display...

Issue #3039120 by heddn, catch, larowlan: Create initial feature to display relevant PSA data in Drupal
parent 59c35735
Loading
Loading
Loading
Loading
+2 −2
Changes for automatic_updates.info.yml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
name: 'Automatic Updates'
type: module
description: 'Drupal Automatic Updates'
core: 8.7
package: 'Maintenance'
core: 8.x
package: 'Security'
+38 −0
Changes for automatic_updates.module: 38 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Contains automatic_updates.module..
 */

/**
 * Implements hook_page_top().
 */
function automatic_updates_page_top(array &$page_top) {
  /** @var \Drupal\Core\Routing\AdminContext $admin_context */
  $admin_context = \Drupal::service('router.admin_context');
  $route_match = \Drupal::routeMatch();
  if ($admin_context->isAdminRoute($route_match->getRouteObject()) && \Drupal::currentUser()->hasPermission('administer site configuration')) {
    $disabled_routes = [
      'update.theme_update',
      'system.theme_install',
      'update.module_update',
      'update.module_install',
      'update.status',
      'update.report_update',
      'update.report_install',
      'update.settings',
      'system.status',
      'update.confirmation_page',
    ];
    // These routes don't need additional nagging.
    if (in_array(\Drupal::routeMatch()->getRouteName(), $disabled_routes, TRUE)) {
        return;
    }
    /** @var \Drupal\automatic_updates\Services\AutomaticUpdatesPsaInterface $psa */
    $psa = \Drupal::service('automatic_updates.psa');
    foreach ($psa->getPublicServiceMessages() as $psa) {
      \Drupal::messenger()->addError($psa);
    }
  }
}
+15 −0
Changes for automatic_updates.services.yml: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
services:
  logger.channel.automatic_updates:
    parent: logger.channel_base
    arguments: ['automatic_updates']
  automatic_updates.psa:
    class: Drupal\automatic_updates\Services\AutomaticUpdatesPsa
    arguments:
      - '@config.factory'
      - '@cache.default'
      - '@datetime.time'
      - '@http_client'
      - '@extension.list.module'
      - '@extension.list.profile'
      - '@extension.list.theme'
      - '@logger.channel.automatic_updates'
+4 −0
Changes for config/install/automatic_updates.settings.yml: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Public service announcement URI endpoint.
# TODO:  Update to correct end point once it is available. See
# https://www.drupal.org/project/automatic_updates/issues/3045273
psa_endpoint: 'http://localhost/automatic_updates/test-json'
+7 −0
Changes for config/schema/automatic_updates.schema.yml: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
automatic_updates.settings:
  type: config_object
  label: 'Automatic updates settings'
  mapping:
    psa_endpoint:
      type: string
      label: 'Endpoint URI for PSAs'
Loading