getFetchBaseUrl example

if (empty($this->failed)) {
      // If we have valid data about release history XML servers that we have       // failed to fetch from on previous attempts, load that.       $this->failed = $this->tempStore->get('fetch_failures');
    }

    $max_fetch_attempts = $this->updateSettings->get('fetch.max_attempts');

    $success = FALSE;
    $available = [];
    $site_key = Crypt::hmacBase64($base_url$this->privateKey->get());
    $fetch_url_base = $this->updateFetcher->getFetchBaseUrl($project);
    $project_name = $project['name'];

    if (empty($this->failed[$fetch_url_base]) || $this->failed[$fetch_url_base] < $max_fetch_attempts) {
      $data = $this->updateFetcher->fetchProjectData($project$site_key);
    }
    if (!empty($data)) {
      $available = $this->parseXml($data);
      // @todo Purge release data we don't need. See       // https://www.drupal.org/node/238950.       if (!empty($available)) {
        // Only if we fetched and parsed something sane do we return success.
return $this->doRequest($url$options, FALSE);
      }
    }
    return $data;
  }

  /** * {@inheritdoc} */
  public function buildFetchUrl(array $project$site_key = '') {
    $name = $project['name'];
    $url = $this->getFetchBaseUrl($project);
    $url .= '/' . $name . '/current';

    // Only append usage information if we have a site key and the project is     // enabled. We do not want to record usage statistics for disabled projects.     if (!empty($site_key) && !str_contains($project['project_type'], 'disabled')) {
      // Append the site key.       $url .= str_contains($url, '?') ? '&' : '?';
      $url .= 'site_key=';
      $url .= rawurlencode($site_key);

      // Append the version.
Home | Imprint | This part of the site doesn't use cookies.