~ubuntu-branches/ubuntu/karmic/drupal6/karmic

« back to all changes in this revision

Viewing changes to modules/update/update.fetch.inc

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano, Luigi Gangitano
  • Date: 2009-05-04 19:56:12 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090504195612-hvdmh4goeszhjo0k
Tags: 6.11-1
[ Luigi Gangitano ]
* New upstream release
  - Fixes XSS vulnerability (Ref: SA-CORE-2009-005, CVE-TBD)
    (Closes: #526378)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
// $Id: update.fetch.inc,v 1.7.2.2 2009/01/14 21:36:16 goba Exp $
 
2
// $Id: update.fetch.inc,v 1.7.2.4 2009/04/29 18:43:11 goba Exp $
3
3
 
4
4
/**
5
5
 * @file
27
27
  module_load_include('inc', 'update', 'update.compare');
28
28
 
29
29
  // Since we're fetching new available update data, we want to clear
30
 
  // everything in our cache, to ensure we recompute the status. Note that
31
 
  // this does not cause update_get_projects() to be recomputed twice in the
32
 
  // same page load (e.g. when manually checking) since that function stashes
33
 
  // its answer in a static array.
34
 
  update_invalidate_cache();
 
30
  // our cache of both the projects we care about, and the current update
 
31
  // status of the site. We do *not* want to clear the cache of available
 
32
  // releases just yet, since that data (even if it's stale) can be useful
 
33
  // during update_get_projects(); for example, to modules that implement
 
34
  // hook_system_info_alter() such as cvs_deploy.
 
35
  _update_cache_clear('update_project_projects');
 
36
  _update_cache_clear('update_project_data');
35
37
 
36
38
  $available = array();
37
39
  $data = array();
38
40
  $site_key = md5($base_url . drupal_get_private_key());
39
41
  $projects = update_get_projects();
40
42
 
 
43
  // Now that we have the list of projects, we should also clear our cache of
 
44
  // available release data, since even if we fail to fetch new data, we need
 
45
  // to clear out the stale data at this point.
 
46
  _update_cache_clear('update_available_releases');
 
47
  
41
48
  foreach ($projects as $key => $project) {
42
49
    $url = _update_build_fetch_url($project, $site_key);
43
50
    $xml = drupal_http_request($url);
52
59
  }
53
60
  if (!empty($available) && is_array($available)) {
54
61
    $frequency = variable_get('update_check_frequency', 1);
55
 
    cache_set('update_info', $available, 'cache_update', time() + (60 * 60 * 24 * $frequency));
 
62
    _update_cache_set('update_available_releases', $available, time() + (60 * 60 * 24 * $frequency));
56
63
    variable_set('update_last_check', time());
57
64
    watchdog('update', 'Fetched information about all available new releases and updates.', array(), WATCHDOG_NOTICE, l(t('view'), 'admin/reports/updates'));
58
65
  }
101
108
 * Perform any notifications that should be done once cron fetches new data.
102
109
 *
103
110
 * This method checks the status of the site using the new data and depending
104
 
 * on the configuration of the site, notifys administrators via email if there
 
111
 * on the configuration of the site, notifies administrators via email if there
105
112
 * are new releases or missing security updates.
106
113
 *
107
114
 * @see update_requirements()
110
117
  include_once './includes/install.inc';
111
118
  $status = update_requirements('runtime');
112
119
  $params = array();
 
120
  $notify_all = (variable_get('update_notification_threshold', 'all') == 'all');
113
121
  foreach (array('core', 'contrib') as $report_type) {
114
122
    $type = 'update_'. $report_type;
115
123
    if (isset($status[$type]['severity'])
116
 
        && $status[$type]['severity'] == REQUIREMENT_ERROR) {
 
124
        && ($status[$type]['severity'] == REQUIREMENT_ERROR || ($notify_all && $status[$type]['reason'] == UPDATE_NOT_CURRENT))) {
117
125
      $params[$report_type] = $status[$type]['reason'];
118
126
    }
119
127
  }