Skip to content

Commit

Permalink
quality of life improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarbone committed Dec 28, 2024
1 parent 5be1e90 commit e7c9b2c
Show file tree
Hide file tree
Showing 8 changed files with 1,856 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/vendor
/composer.lock
/tmp
/*.iml
/.idea
Expand Down
2 changes: 1 addition & 1 deletion bin/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
'testEndpoint' => 'http://hapi.fhir.org/baseDstu3',
],
'R4' => [
'url' => 'http://www.hl7.org/fhir/fhir-all-xsd.zip',
'url' => 'http://www.hl7.org/fhir/R4/fhir-all-xsd.zip',
'namespace' => '\\HL7\\FHIR\\R4',
'testEndpoint' => 'http://hapi.fhir.org/baseR4',
],
Expand Down
25 changes: 22 additions & 3 deletions bin/generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,28 @@ function is_dir_empty($dir)

if ($download) {
echo 'Downloading ' . $version . ' from ' . $url . PHP_EOL;
// Download/extract ZIP file
if (!copy($url, $zip_file_name)) {
echo "Unable to download.\n";
$fh = fopen($zip_file_name, 'w');
$ch = curl_init($url);
curl_setopt_array(
$ch,
[
CURLOPT_USERAGENT => 'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0',
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HEADER => 0,
CURLOPT_FILE => $fh,
]
);
$resp = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$err = curl_error($ch);
curl_close($ch);
fclose($fh);
if ('' !== $err) {
echo sprintf('Error downloading from %s: %s%s', $version, $err, PHP_EOL);
exit(1);
}
if ($code !== 200) {
echo sprintf('Error downlodaing from %s: %d (%s)%s', $version, $code, $resp, PHP_EOL);
exit(1);
}
}
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
},
"require-dev": {
"ext-curl": "*",
"ext-zip": "*",
"phpunit/phpunit": "@stable"
},
"replace": {
Expand Down
Loading

0 comments on commit e7c9b2c

Please sign in to comment.