protected function InPlaceUpdateTest::doGetArchive in Automatic Updates 8
Get the archive with protection against 429s.
Parameters
string $project: The project.
string $file_name: The filename.
string $zip_file: The zip file path.
int $delay: (optional) The delay.
1 call to InPlaceUpdateTest::doGetArchive()
- InPlaceUpdateTest::getDeletions in tests/
src/ Build/ InPlaceUpdateTest.php - Helper method to retrieve files slated for deletion.
File
- tests/
src/ Build/ InPlaceUpdateTest.php, line 256
Class
- InPlaceUpdateTest
- @coversDefaultClass \Drupal\automatic_updates\Services\InPlaceUpdate
Namespace
Drupal\Tests\automatic_updates\BuildCode
protected function doGetArchive($project, $file_name, $zip_file, $delay = 0) {
try {
sleep($delay);
$http_client = new Client();
$http_client
->get("https://www.drupal.org/in-place-updates/{$project}/{$file_name}", [
'sink' => $zip_file,
]);
} catch (RequestException $exception) {
$response = $exception
->getResponse();
if ($response && $response
->getStatusCode() === 429) {
$this
->doGetArchive($project, $file_name, $zip_file, 10);
}
else {
throw $exception;
}
}
}