diff --git modules/update/update.fetch.inc modules/update/update.fetch.inc index 2340200..5b1d0c4 100644 --- modules/update/update.fetch.inc +++ modules/update/update.fetch.inc @@ -27,25 +27,11 @@ function _update_refresh() { $fail = &drupal_static(__FUNCTION__, array()); module_load_include('inc', 'update', 'update.compare'); - // Since we're fetching new available update data, we want to clear - // our cache of both the projects we care about, and the current update - // status of the site. We do *not* want to clear the cache of available - // releases just yet, since that data (even if it's stale) can be useful - // during update_get_projects(); for example, to modules that implement - // hook_system_info_alter() such as cvs_deploy. - _update_cache_clear('update_project_projects'); - _update_cache_clear('update_project_data'); - $available = array(); $data = array(); $site_key = md5($base_url . drupal_get_private_key()); $projects = update_get_projects(); - // Now that we have the list of projects, we should also clear our cache of - // available release data, since even if we fail to fetch new data, we need - // to clear out the stale data at this point. - _update_cache_clear('update_available_releases'); - $max_fetch_attempts = variable_get('update_max_fetch_attempts', UPDATE_MAX_FETCH_ATTEMPTS); foreach ($projects as $key => $project) { @@ -53,7 +39,8 @@ function _update_refresh() { $fetch_url_base = _update_get_fetch_url_base($project); if (empty($fail[$fetch_url_base]) || count($fail[$fetch_url_base]) < $max_fetch_attempts) { $xml = drupal_http_request($url); - if (isset($xml->data)) { + // make sure we have a proper error code + if ($xml->code == 200 && isset($xml->data)) { $data[] = $xml->data; } else { @@ -71,6 +58,15 @@ function _update_refresh() { $available = update_parse_xml($data); } if (!empty($available) && is_array($available)) { + // Since we're fetching new available update data, we want to clear our + // cache of both the projects we care about, and the current update status + // of the site. We do *not* want to clear the cache of available releases + // just yet, since that data (even if it's stale) can be useful during + // update_get_projects(); for example, to modules that implement + // hook_system_info_alter() such as cvs_deploy. + _update_cache_clear('update_project_projects'); + _update_cache_clear('update_project_data'); + // Record the projects where we failed to fetch data. foreach ($fail as $fetch_url_base => $failures) { foreach ($failures as $key => $value) {