Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
28f278b4
Commit
28f278b4
authored
Apr 11, 2013
by
alexpott
Browse files
Issue
#1862538
by Berdir: Convert drupal_http_request() usage in update.fetch.inc to Guzzle.
parent
87f01f06
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/modules/update/update.fetch.inc
View file @
28f278b4
...
...
@@ -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
)
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment