protected function InPlaceUpdate::doGetResource in Automatic Updates 8
Perform retrieval of archive, with delay if archive is still being created.
Parameters
string $url: The URL to retrieve.
string $destination: The destination to download the archive.
null|int $delay: The delay, defaults to NULL.
1 call to InPlaceUpdate::doGetResource()
- InPlaceUpdate::getArchive in src/
Services/ InPlaceUpdate.php - Get an archive with the quasi-patch contents.
File
- src/
Services/ InPlaceUpdate.php, line 278
Class
- InPlaceUpdate
- Class to apply in-place updates.
Namespace
Drupal\automatic_updates\ServicesCode
protected function doGetResource($url, $destination, $delay = NULL) {
try {
$this->httpClient
->get($url, [
'sink' => $destination,
'delay' => $delay,
// Some of the core quasi-patch zip files are large, increase timeout.
'timeout' => 120,
]);
} catch (RequestException $exception) {
$response = $exception
->getResponse();
if ($response && $response
->getStatusCode() === 429) {
$delay = 1000 * (isset($response
->getHeader('Retry-After')[0]) ? $response
->getHeader('Retry-After')[0] : 10);
$this
->doGetResource($url, $destination, $delay);
}
else {
$this->logger
->error('Retrieval of "@url" failed with: @message', [
'@url' => $exception
->getRequest()
->getUri(),
'@message' => $exception
->getMessage(),
]);
throw $exception;
}
}
}