Skip to content

Commit 58493b3

Browse files
authored
Also check archives for qa 8.0.0rc releases (nikic#190)
I forgot, these get moved to the /archive folder when they're no longer the newest releases. Avoid nested ifs and use powershell foreach.
1 parent 0447f04 commit 58493b3

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

.appveyor.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,16 @@ build_script:
155155
$ts_part = ''
156156
if ('0' -eq $env:TS) { $ts_part = '-nts' }
157157
$bname = 'php-devel-pack-' + $env:PHP_VER + $ts_part + '-Win32-' + $env:VC.toUpper() + '-' + $env:ARCH + '.zip'
158-
if (-not (Test-Path c:\build-cache\$bname)) {
159-
Invoke-WebRequest "https://windows.php.net/downloads/releases/archives/$bname" -OutFile "c:\build-cache\$bname"
160-
if (-not (Test-Path c:\build-cache\$bname)) {
161-
Invoke-WebRequest "https://windows.php.net/downloads/releases/$bname" -OutFile "c:\build-cache\$bname"
162-
if (-not (Test-Path c:\build-cache\$bname)) {
163-
Invoke-WebRequest "https://windows.php.net/downloads/qa/$bname" -OutFile "c:\build-cache\$bname"
164-
}
158+
$urls = @(
159+
"https://windows.php.net/downloads/releases/archives/$bname",
160+
"https://windows.php.net/downloads/releases/$bname",
161+
"https://windows.php.net/downloads/qa/$bname",
162+
"https://windows.php.net/downloads/qa/archives/$bname"
163+
)
164+
foreach ($url in $urls) {
165+
Invoke-WebRequest $url -OutFile "c:\build-cache\$bname"
166+
if (Test-Path c:\build-cache\$bname) {
167+
break;
165168
}
166169
}
167170
$dname0 = 'php-' + $env:PHP_VER + '-devel-' + $env:VC.toUpper() + '-' + $env:ARCH
@@ -203,13 +206,16 @@ test_script:
203206
$ts_part = ''
204207
if ('0' -eq $env:TS) { $ts_part = '-nts' }
205208
$bname = 'php-' + $env:PHP_VER + $ts_part + '-Win32-' + $env:VC.toUpper() + '-' + $env:ARCH + '.zip'
206-
if (-not (Test-Path c:\build-cache\$bname)) {
207-
Invoke-WebRequest "https://windows.php.net/downloads/releases/archives/$bname" -OutFile "c:\build-cache\$bname"
208-
if (-not (Test-Path c:\build-cache\$bname)) {
209-
Invoke-WebRequest "https://windows.php.net/downloads/releases/$bname" -OutFile "c:\build-cache\$bname"
210-
if (-not (Test-Path c:\build-cache\$bname)) {
211-
Invoke-WebRequest "https://windows.php.net/downloads/qa/$bname" -OutFile "c:\build-cache\$bname"
212-
}
209+
$urls = @(
210+
"https://windows.php.net/downloads/releases/archives/$bname",
211+
"https://windows.php.net/downloads/releases/$bname",
212+
"https://windows.php.net/downloads/qa/$bname",
213+
"https://windows.php.net/downloads/qa/archives/$bname"
214+
)
215+
foreach ($url in $urls) {
216+
Invoke-WebRequest $url -OutFile "c:\build-cache\$bname"
217+
if (Test-Path c:\build-cache\$bname) {
218+
break;
213219
}
214220
}
215221
$dname = 'php-' + $env:PHP_VER + $ts_part + '-' + $env:VC.toUpper() + '-' + $env:ARCH

0 commit comments

Comments
 (0)