You are here

private function EvaluationCode::updateProcessFetchTask in Drupal 8 upgrade evaluation 7

Same name and namespace in other branches
  1. 6 includes/EvaluationCode.php \Upgrade_check\EvaluationCode::updateProcessFetchTask()

Processes a task to fetch available update data for a single project.

Once the release history XML data is downloaded, it is parsed and saved into the {cache_update} table in an entry just for that project.

Parameters

$data: Associative array of information about the project to fetch data for.

Return value

array if we fetched parsable XML.

2 calls to EvaluationCode::updateProcessFetchTask()
EvaluationCode::modulesEvaluation in includes/EvaluationCode.php
Implements _upgrade_check_modules_evaluation().
EvaluationCode::themesEvaluation in includes/EvaluationCode.php
Implements _upgrade_check_themes_evaluation().

File

includes/EvaluationCode.php, line 180

Class

EvaluationCode

Namespace

Upgrade_check

Code

private function updateProcessFetchTask($data) {
  global $base_url;
  $site_key = drupal_hmac_base64($base_url, drupal_get_private_key());
  $data['info']['version'] = str_replace($this->oldVersion, $this->version, $data['info']['version']);
  $url = $this
    ->updateBuildFetchUrl($data, $site_key);
  $xml = drupal_http_request($url);
  if (!empty($xml)) {
    $available = $this
      ->parseXml($xml);
  }
  if (!empty($available)) {
    $available['type'] = $this->contrib;
  }
  else {
    $url = $this
      ->updateBuildFetchUrl($data, $site_key, TRUE);
    $xml = drupal_http_request($url);
    if (!empty($xml)) {
      $availableOld = $this
        ->parseXml($xml);
      if (!empty($availableOld)) {
        $available['type'] = $this->contribNoUpgrade;
      }
      else {
        $available['type'] = $this->custom;
      }
    }
    else {
      $available['type'] = $this->custom;
    }
  }
  return !empty($available) ? $available : array();
}