Same name and namespace in other branches
  1. 7.x modules/update/update.fetch.inc \_update_build_fetch_url()

Generates the URL to fetch information about project updates.

This figures out the right URL to use, based on the project's .info file and the global defaults. Appends optional query arguments when the site is configured to report usage stats.

Parameters

$project: The array of project information from update_get_projects().

$site_key: The anonymous site key hash (optional).

See also

update_refresh()

update_get_projects()

1 call to _update_build_fetch_url()
_update_refresh in modules/update/update.fetch.inc
Fetch project info via XML from a central server.

File

modules/update/update.fetch.inc, line 106
Code required only when fetching information about available updates.

Code

function _update_build_fetch_url($project, $site_key = '') {
  $name = $project['name'];
  $url = _update_get_fetch_url_base($project);
  $url .= '/' . $name . '/' . DRUPAL_CORE_COMPATIBILITY;

  // Only append a site_key and the version information if we have a site_key
  // in the first place, and if this is not a disabled module or theme. We do
  // not want to record usage statistics for disabled code.
  if (!empty($site_key) && strpos($project['project_type'], 'disabled') === FALSE) {
    $url .= strpos($url, '?') === TRUE ? '&' : '?';
    $url .= 'site_key=';
    $url .= rawurlencode($site_key);
    if (!empty($project['info']['version'])) {
      $url .= '&version=';
      $url .= rawurlencode($project['info']['version']);
    }
  }
  return $url;
}