Commit 28f278b4 authored by alexpott's avatar alexpott

Issue #1862538 by Berdir: Convert drupal_http_request() usage in update.fetch.inc to Guzzle.

parent 87f01f06
......@@ -5,6 +5,8 @@
* Code required only when fetching information about available updates.
*/
use Guzzle\Http\Exception\RequestException;
/**
* Page callback: Checks for updates and displays the update status report.
*
......@@ -149,12 +151,14 @@ function _update_process_fetch_task($project) {
$project_name = $project['name'];
if (empty($fail[$fetch_url_base]) || $fail[$fetch_url_base] < $max_fetch_attempts) {
$result = drupal_http_request($url, array('headers' => array('accept' => 'text/xml')));
if (isset($result->error)) {
watchdog('update', 'HTTP request to @url failed with error: @error.', array('@url' => $url, '@error' => $result->error));
try {
$data = Drupal::httpClient()
->get($url, array('Accept' => 'text/xml'))
->send()
->getBody(TRUE);
}
elseif (!isset($result->error) && isset($result->data)) {
$data = $result->data;
catch (RequestException $exception) {
watchdog_exception('update', $exception);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment