27
27
module_load_include('inc', 'update', 'update.compare');
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');
36
38
$available = array();
38
40
$site_key = md5($base_url . drupal_get_private_key());
39
41
$projects = update_get_projects();
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');
41
48
foreach ($projects as $key => $project) {
42
49
$url = _update_build_fetch_url($project, $site_key);
43
50
$xml = drupal_http_request($url);
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'));
101
108
* Perform any notifications that should be done once cron fetches new data.
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.
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'];