automatic_updates.module 1.45 KB
Newer Older
1
2
3
4
<?php

/**
 * @file
5
 * Contains automatic_updates.module.
6
7
8
 */

/**
9
 * Implements hook_init().
10
 */
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function automatic_updates_init() {
  if (arg(0) == 'admin' && user_access('administer site configuration')) {
    $disabled_routes = array(
      'admin/appearance/update',
      'admin/appearance/install',
      'admin/modules/update',
      'admin/modules/install',
      'admin/reports/updates',
      'admin/reports/updates/update',
      'admin/reports/updates/install',
      'admin/reports/updates/settings',
      'admin/reports/status',
      'admin/update/ready',
    );
    // These paths don't need additional nagging.
    if (in_array($_GET['q'], $disabled_routes)) {
27
      return;
28
    }
29
30
31
32
33
34
35

    $messages = AutomaticUpdatesPsa::getPublicServiceMessages();
    if ($messages) {
      drupal_set_message(t('Drupal public service announcements:'), 'error');
      foreach ($messages as $message) {
        drupal_set_message($message, 'error');
      }
36
37
38
    }
  }
}
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

/**
 * Implements hook_menu().
 */
function automatic_updates_menu() {
  $items = [];

  $items['admin/config/system/automatic_updates'] = [
    'title' => 'Automatic Updates',
    'page callback' => 'drupal_get_form',
    'page arguments' => ['automatic_updates_admin_form'],
    'file' => 'automatic_updates.admin.inc',
    'file path' => drupal_get_path('module', 'automatic_updates'),
    'access arguments' => ['administer software updates'],
    'tab parent' => 'admin/config/system',
  ];

  return $items;
}