function _drush_pm_get_release_history_xml

4.x pm.drush.inc _drush_pm_get_release_history_xml($request)

Download the release history xml for the specified request.

2 calls to _drush_pm_get_release_history_xml()
drush_pm_download in commands/pm/pm.drush.inc
Command callback. Download Drupal core or any project.
_drush_pm_get_releases in commands/pm/pm.drush.inc
Obtain releases info for given projects and fill in status information.

File

commands/pm/pm.drush.inc, line 2122
The drush Project Manager

Code

function _drush_pm_get_release_history_xml($request) {
  // Don't rely on UPDATE_DEFAULT_URL since perhaps we are not fully
  // bootstrapped.
  $url = drush_get_option('source', 'http://updates.drupal.org/release-history') . '/' . $request['name'] . '/' . $request['drupal_version'];
  drush_log('Downloading release history from ' . $url);
  if ($path = drush_download_file($url, drush_tempnam($request['name']), drush_get_option('cache-duration-releasexml', 24 * 3600))) {
    $xml = simplexml_load_file($path);
  }
  if (!$xml) {
    // We are not getting here since drupal.org always serves an XML response.
    return drush_set_error('DRUSH_PM_DOWNLOAD_FAILED', dt('Could not download project status information from !url', array('!url' => $url)));
  }
  if ($error = $xml->xpath('/error')) {
    // Don't set an error here since it stops processing during site-upgrade.
    drush_log($error[0], 'warning'); // 'DRUSH_PM_COULD_NOT_LOAD_UPDATE_FILE',
    return FALSE;
  }
  // Unpublished project?
  $project_status = $xml->xpath('/project/project_status');
  if ($project_status[0][0] == 'unpublished') {
    return drush_set_error('DRUSH_PM_PROJECT_UNPUBLISHED', dt("Project !project is unpublished and has no releases available.", array('!project' => $request['name'])), 'warning');
  }

  return $xml;
}