Check for 404 before downloading
This commit is contained in:
parent
a767f5a56c
commit
01fdcce73e
|
@ -76,6 +76,15 @@ function get_versions() {
|
||||||
return $versions;
|
return $versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function release_exists($url) {
|
||||||
|
exec("curl --silent -I -o /dev/null -w '%{http_code}' $url", $output);
|
||||||
|
if (trim($output[0]) == '404') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach(get_versions() as $version) {
|
foreach(get_versions() as $version) {
|
||||||
foreach($oses as $os) {
|
foreach($oses as $os) {
|
||||||
foreach($archs as $arch) {
|
foreach($archs as $arch) {
|
||||||
|
@ -105,7 +114,9 @@ foreach(get_versions() as $version) {
|
||||||
$url = "https://github.com/electron/electron/releases/download/$version/electron-$version-$os-$arch.zip";
|
$url = "https://github.com/electron/electron/releases/download/$version/electron-$version-$os-$arch.zip";
|
||||||
echo $url . PHP_EOL;
|
echo $url . PHP_EOL;
|
||||||
|
|
||||||
if (download_release($url, $zipfile)) {
|
if (!release_exists($url)) {
|
||||||
|
echo "[DL:404] $url\n";
|
||||||
|
} else if (download_release($url, $zipfile)) {
|
||||||
extract_release($zipfile, $output);
|
extract_release($zipfile, $output);
|
||||||
generateFingerprint($version, $output, $hash_file);
|
generateFingerprint($version, $output, $hash_file);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue