File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11
22# Install PHP
3- $client = New-Object System.Net.WebClient
4- $client.Headers.Add (' User-Agent' , " AppVeyor CI PowerShell $ ( $PSVersionTable.PSVersion ) $ ( [Environment ]::OSVersion.VersionString) " )
5- $phpUrl = " http://windows.php.net/downloads/releases/php-$env: PHP_VERSION -nts-Win32-VC$env: VC_VERSION -x86.zip"
63$target = Join-Path $PWD ' php.zip'
7- Write-Output " Downloading $phpUrl "
8- try {
4+ function Download-PHP ([string ] $phpUrl ) {
5+ $client = New-Object System.Net.WebClient
6+ $client.Headers.Add (' User-Agent' , " AppVeyor CI PowerShell $ ( $PSVersionTable.PSVersion ) $ ( [Environment ]::OSVersion.VersionString) " )
7+ Write-Output " Downloading $phpUrl "
98 $client.DownloadFile ($phpUrl , $target )
109}
10+ try {
11+ Download- PHP " http://windows.php.net/downloads/releases/php-$env: PHP_VERSION -nts-Win32-VC$env: VC_VERSION -x86.zip"
12+ }
1113catch [System.Net.WebException ] {
1214 if ($_.Exception.Response.StatusCode.Value__ -eq 404 ) {
1315 # Older releases get moved to archives/
14- $phpUrl = " http://windows.php.net/downloads/releases/archives/php-$env: PHP_VERSION -nts-Win32-VC$env: VC_VERSION -x86.zip"
15- Write-Output " Downloading $phpUrl "
16- $client.DownloadFile ($phpUrl , $target )
16+ Download- PHP " http://windows.php.net/downloads/releases/archives/php-$env: PHP_VERSION -nts-Win32-VC$env: VC_VERSION -x86.zip"
1717 Write-Warning " PHP $env: PHP_VERSION is outdated and was moved to archives"
1818 }
1919 else {
You can’t perform that action at this time.
0 commit comments