mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-25 13:03:04 +07:00
Add retry logic to Invoke-Webrequests
Add fallback url to nightly setup
This commit is contained in:
parent
f42145a164
commit
f9390a5478
@ -65,7 +65,7 @@ Function Add-NightlyExtension {
|
|||||||
if($ts) { $ts_part = 'ts' } else { $ts_part = 'nts' }
|
if($ts) { $ts_part = 'ts' } else { $ts_part = 'nts' }
|
||||||
$repo = "$github/shivammathur/php-extensions-windows"
|
$repo = "$github/shivammathur/php-extensions-windows"
|
||||||
$url = "$repo/releases/download/builds/php$version`_$ts_part`_$arch`_$extension.dll"
|
$url = "$repo/releases/download/builds/php$version`_$ts_part`_$arch`_$extension.dll"
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile "$ext_dir\php_$extension.dll"
|
Get-File -Url $url -OutFile "$ext_dir\php_$extension.dll"
|
||||||
if(Test-Path "$ext_dir\php_$extension.dll") {
|
if(Test-Path "$ext_dir\php_$extension.dll") {
|
||||||
Enable-Extension $extension > $null
|
Enable-Extension $extension > $null
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,7 +21,7 @@ Function Add-Blackfire() {
|
|||||||
$status="Enabled"
|
$status="Enabled"
|
||||||
} else {
|
} else {
|
||||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||||
Invoke-WebRequest -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
Get-File -Url "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
||||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||||
$status="Installed and enabled"
|
$status="Installed and enabled"
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ Function Get-ICUUrl() {
|
|||||||
$trunk = "https://windows.php.net"
|
$trunk = "https://windows.php.net"
|
||||||
$urls=@("${trunk}/downloads/php-sdk/deps/${vs_version}/${arch}", "${trunk}/downloads/php-sdk/deps/archives/${vs_version}/${arch}")
|
$urls=@("${trunk}/downloads/php-sdk/deps/${vs_version}/${arch}", "${trunk}/downloads/php-sdk/deps/archives/${vs_version}/${arch}")
|
||||||
foreach ($url in $urls) {
|
foreach ($url in $urls) {
|
||||||
$web_content = Invoke-WebRequest -Uri $url
|
$web_content = Get-File -Url $url
|
||||||
foreach ($link in $web_content.Links) {
|
foreach ($link in $web_content.Links) {
|
||||||
if ($link -match "/.*ICU-${icu_version}.*/") {
|
if ($link -match "/.*ICU-${icu_version}.*/") {
|
||||||
return $trunk + $link.HREF
|
return $trunk + $link.HREF
|
||||||
@ -32,7 +32,7 @@ Function Repair-ICU() {
|
|||||||
$zip_url = Get-ICUUrl $icu.Groups[1].Value $installed.Architecture $vs
|
$zip_url = Get-ICUUrl $icu.Groups[1].Value $installed.Architecture $vs
|
||||||
if ($zip_url -ne '') {
|
if ($zip_url -ne '') {
|
||||||
New-Item -Path "$php_dir" -Name "icu" -ItemType "directory" -Force > $null 2>&1
|
New-Item -Path "$php_dir" -Name "icu" -ItemType "directory" -Force > $null 2>&1
|
||||||
Invoke-WebRequest -Uri $zip_url -OutFile "$php_dir\icu\icu.zip"
|
Get-File -Url $zip_url -OutFile "$php_dir\icu\icu.zip"
|
||||||
Expand-Archive -Path $php_dir\icu\icu.zip -DestinationPath $php_dir\icu -Force
|
Expand-Archive -Path $php_dir\icu\icu.zip -DestinationPath $php_dir\icu -Force
|
||||||
Get-ChildItem $php_dir\icu\bin -Filter *.dll | Copy-Item -Destination $php_dir -Force
|
Get-ChildItem $php_dir\icu\bin -Filter *.dll | Copy-Item -Destination $php_dir -Force
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ Function Add-Ioncube() {
|
|||||||
if (-not($installed.ThreadSafe)) {
|
if (-not($installed.ThreadSafe)) {
|
||||||
$ts_part = "_nonts"
|
$ts_part = "_nonts"
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
|
Get-File -Url "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
|
||||||
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
|
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
|
||||||
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
|
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ Function Add-InstantClient() {
|
|||||||
if ($arch -eq 'x86') {
|
if ($arch -eq 'x86') {
|
||||||
$suffix = 'nt'
|
$suffix = 'nt'
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
Get-File -Url https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
||||||
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
|
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
|
||||||
Copy-Item $php_dir\instantclient*\* $php_dir
|
Copy-Item $php_dir\instantclient*\* $php_dir
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ Function Add-Oci() {
|
|||||||
Copy-Item -Path $oci8DLL -Destination $ext_dir\php_oci8.dll
|
Copy-Item -Path $oci8DLL -Destination $ext_dir\php_oci8.dll
|
||||||
} else {
|
} else {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
Invoke-WebRequest -Uri (Get-Oci8Url) -OutFile $php_dir\oci8.zip
|
Get-File -Url (Get-Oci8Url) -OutFile $php_dir\oci8.zip
|
||||||
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
|
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,14 @@ Function Get-PhalconReleaseAssetUrl() {
|
|||||||
try {
|
try {
|
||||||
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
||||||
} catch {
|
} catch {
|
||||||
$match = (Invoke-WebRequest -Uri "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
|
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
|
||||||
try {
|
try {
|
||||||
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
$match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||||
} catch {
|
} catch {
|
||||||
$match = (Invoke-WebRequest -Uri "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
$match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($NULL -ne $match) {
|
if($NULL -ne $match) {
|
||||||
@ -39,7 +39,7 @@ Function Add-PhalconFromGitHub() {
|
|||||||
)
|
)
|
||||||
$zip_url = Get-PhalconReleaseAssetUrl $Semver
|
$zip_url = Get-PhalconReleaseAssetUrl $Semver
|
||||||
if($zip_url) {
|
if($zip_url) {
|
||||||
Invoke-WebRequest -Uri $zip_url -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
Get-File -Url $zip_url -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
||||||
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
|
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
|
||||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
||||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||||
|
@ -11,7 +11,7 @@ Function Get-ZephirParserReleaseAssetUrl() {
|
|||||||
try {
|
try {
|
||||||
$match = (Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/tags/$extension_version").assets | Select-String -Pattern "browser_download_url=.*(zephir_parser-php-${version}.*windows.*.zip)"
|
$match = (Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/tags/$extension_version").assets | Select-String -Pattern "browser_download_url=.*(zephir_parser-php-${version}.*windows.*.zip)"
|
||||||
} catch {
|
} catch {
|
||||||
$match = (Invoke-WebRequest -Uri "$zp_releases/expanded_assets/$extension_version").Links.href | Select-String -Pattern "(zephir_parser-php-${version}.*windows.*.zip)"
|
$match = (Get-File -Url "$zp_releases/expanded_assets/$extension_version").Links.href | Select-String -Pattern "(zephir_parser-php-${version}.*windows.*.zip)"
|
||||||
}
|
}
|
||||||
if($NULL -ne $match) {
|
if($NULL -ne $match) {
|
||||||
return "$zp_releases/download/$extension_version/$($match.Matches[0].Groups[1].Value)"
|
return "$zp_releases/download/$extension_version/$($match.Matches[0].Groups[1].Value)"
|
||||||
@ -30,7 +30,7 @@ Function Get-ZephirParserVersion() {
|
|||||||
$repo = 'zephir-lang/php-zephir-parser'
|
$repo = 'zephir-lang/php-zephir-parser'
|
||||||
$zp_releases = "$github/$repo/releases"
|
$zp_releases = "$github/$repo/releases"
|
||||||
if($extension -eq 'zephir_parser') {
|
if($extension -eq 'zephir_parser') {
|
||||||
return (Invoke-WebRequest -UseBasicParsing -Uri $zp_releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
return (Get-File -Url $zp_releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
} else {
|
} else {
|
||||||
return 'v' + ($extension.split('-')[1] -replace 'v')
|
return 'v' + ($extension.split('-')[1] -replace 'v')
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ Function Add-ZephirParserFromGitHub() {
|
|||||||
$extension_version = Get-ZephirParserVersion $extension
|
$extension_version = Get-ZephirParserVersion $extension
|
||||||
$zip_url = Get-ZephirParserReleaseAssetUrl $extension_version
|
$zip_url = Get-ZephirParserReleaseAssetUrl $extension_version
|
||||||
if($zip_url) {
|
if($zip_url) {
|
||||||
Invoke-WebRequest -Uri $zip_url -OutFile $ENV:RUNNER_TOOL_CACHE\zp.zip > $null 2>&1
|
Get-File -Url $zip_url -OutFile $ENV:RUNNER_TOOL_CACHE\zp.zip > $null 2>&1
|
||||||
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\zp.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\zp -Force > $null 2>&1
|
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\zp.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\zp -Force > $null 2>&1
|
||||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\zp\php_zephir_parser.dll" -Destination "$ext_dir\php_zephir_parser.dll"
|
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\zp\php_zephir_parser.dll" -Destination "$ext_dir\php_zephir_parser.dll"
|
||||||
Enable-PhpExtension -Extension zephir_parser -Path $php_dir
|
Enable-PhpExtension -Extension zephir_parser -Path $php_dir
|
||||||
|
@ -152,7 +152,7 @@ Function Add-Tool() {
|
|||||||
} catch {
|
} catch {
|
||||||
if($url -match '.*github.com.*releases.*latest.*') {
|
if($url -match '.*github.com.*releases.*latest.*') {
|
||||||
try {
|
try {
|
||||||
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((Invoke-WebRequest -Uri ($url.split('/release')[0] + "/releases")).Content, "([0-9]+\.[0-9]+\.[0-9]+)/" + ($url.Substring($url.LastIndexOf("/") + 1))).Groups[0].Value).split('/')[0])
|
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((Get-File -Url ($url.split('/release')[0] + "/releases")).Content, "([0-9]+\.[0-9]+\.[0-9]+)/" + ($url.Substring($url.LastIndexOf("/") + 1))).Groups[0].Value).split('/')[0])
|
||||||
$status_code = (Invoke-WebRequest -Passthru -Uri $url -OutFile $tool_path).StatusCode
|
$status_code = (Invoke-WebRequest -Passthru -Uri $url -OutFile $tool_path).StatusCode
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ Function Add-Blackfire() {
|
|||||||
}
|
}
|
||||||
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
||||||
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
||||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
||||||
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
||||||
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
||||||
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Function Get-ProtobufTag() {
|
Function Get-ProtobufTag() {
|
||||||
$releases = 'https://github.com/protocolbuffers/protobuf/releases'
|
$releases = 'https://github.com/protocolbuffers/protobuf/releases'
|
||||||
if("$protobuf_tag" -eq "latest") {
|
if("$protobuf_tag" -eq "latest") {
|
||||||
$protobuf_tag = (Invoke-WebRequest -UseBasicParsing -Uri $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
$protobuf_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$protobuf_tag = $protobuf_tag -replace '^v', ''
|
$protobuf_tag = $protobuf_tag -replace '^v', ''
|
||||||
@ -11,7 +11,7 @@ Function Get-ProtobufTag() {
|
|||||||
$response.Close()
|
$response.Close()
|
||||||
$protobuf_tag = "v$protobuf_tag"
|
$protobuf_tag = "v$protobuf_tag"
|
||||||
} catch {
|
} catch {
|
||||||
$protobuf_tag = (Invoke-WebRequest -UseBasicParsing -Uri $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
$protobuf_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $protobuf_tag
|
return $protobuf_tag
|
||||||
@ -29,7 +29,7 @@ Function Add-Protoc() {
|
|||||||
$arch_num = '32'
|
$arch_num = '32'
|
||||||
}
|
}
|
||||||
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
||||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
||||||
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
||||||
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
||||||
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
||||||
|
@ -4,7 +4,7 @@ Function Add-Symfony() {
|
|||||||
$arch_name = '386'
|
$arch_name = '386'
|
||||||
}
|
}
|
||||||
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
||||||
Invoke-WebRequest -Uri $url -OutFile $bin_dir\symfony.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\symfony.zip >$null 2>&1
|
||||||
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
||||||
if(Test-Path $bin_dir\symfony.exe) {
|
if(Test-Path $bin_dir\symfony.exe) {
|
||||||
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
|
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
|
||||||
|
@ -128,13 +128,47 @@ Function Add-EnvPATH {
|
|||||||
$env_data | Add-Content -Path $env_file -Encoding utf8
|
$env_data | Add-Content -Path $env_file -Encoding utf8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to fetch a file from a URL.
|
||||||
|
Function Get-File {
|
||||||
|
param (
|
||||||
|
[string]$Url,
|
||||||
|
[string]$FallbackUrl,
|
||||||
|
[string]$OutFile,
|
||||||
|
[int]$Retries = 3,
|
||||||
|
[int]$TimeoutSec = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $Retries; $i++) {
|
||||||
|
try {
|
||||||
|
if($null -ne $OutFile) {
|
||||||
|
Invoke-WebRequest -Uri $Url -OutFile $OutFile -TimeoutSec $TimeoutSec
|
||||||
|
} else {
|
||||||
|
Invoke-WebRequest -Uri $Url -TimeoutSec $TimeoutSec
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} catch {
|
||||||
|
if ($i -eq ($Retries - 1) -and ($null -ne $FallbackUrl)) {
|
||||||
|
try {
|
||||||
|
if($null -ne $OutFile) {
|
||||||
|
Invoke-WebRequest -Uri $FallbackUrl -OutFile $OutFile -TimeoutSec $TimeoutSec
|
||||||
|
} else {
|
||||||
|
Invoke-WebRequest -Uri $FallbackUrl -TimeoutSec $TimeoutSec
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
throw "Failed to download the build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Function to make sure printf is in PATH.
|
# Function to make sure printf is in PATH.
|
||||||
Function Add-Printf {
|
Function Add-Printf {
|
||||||
if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) {
|
if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) {
|
||||||
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
||||||
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe -Force > $null 2>&1
|
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe -Force > $null 2>&1
|
||||||
} else {
|
} else {
|
||||||
Invoke-WebRequest -Uri "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$bin_dir\printf.zip"
|
Get-File -Url "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$bin_dir\printf.zip"
|
||||||
Expand-Archive -Path $bin_dir\printf.zip -DestinationPath $bin_dir -Force
|
Expand-Archive -Path $bin_dir\printf.zip -DestinationPath $bin_dir -Force
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -166,7 +200,7 @@ Function Install-PSPackage() {
|
|||||||
$module_path = "$bin_dir\$psm1_path.psm1"
|
$module_path = "$bin_dir\$psm1_path.psm1"
|
||||||
if(-not (Test-Path $module_path -PathType Leaf)) {
|
if(-not (Test-Path $module_path -PathType Leaf)) {
|
||||||
$zip_file = "$bin_dir\$package.zip"
|
$zip_file = "$bin_dir\$package.zip"
|
||||||
Invoke-WebRequest -Uri $url -OutFile $zip_file
|
Get-File -Url $url -OutFile $zip_file
|
||||||
Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force
|
Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force
|
||||||
}
|
}
|
||||||
Import-Module $module_path
|
Import-Module $module_path
|
||||||
@ -229,14 +263,14 @@ Function Set-PhpCache {
|
|||||||
throw "Asset not found"
|
throw "Asset not found"
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
$release = Invoke-WebRequest $php_builder/releases/expanded_assets/php$version
|
$release = Get-File -Url $php_builder/releases/expanded_assets/php$version
|
||||||
$asset = $release.links.href | ForEach-Object {
|
$asset = $release.links.href | ForEach-Object {
|
||||||
if($_ -match "php-$version.[0-9]+$env:PHPTS-Win32-.*-$arch.zip") {
|
if($_ -match "php-$version.[0-9]+$env:PHPTS-Win32-.*-$arch.zip") {
|
||||||
return $_.split('/')[-1]
|
return $_.split('/')[-1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset
|
Get-File -Url $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset
|
||||||
Set-PhpDownloadCache -Path $php_dir CurrentUser
|
Set-PhpDownloadCache -Path $php_dir CurrentUser
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
@ -250,14 +284,14 @@ Function Add-DebugSymbols {
|
|||||||
return $_.name
|
return $_.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset
|
Get-File -Url $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset
|
||||||
Expand-Archive -Path $php_dir\$asset -DestinationPath $php_dir -Force
|
Expand-Archive -Path $php_dir\$asset -DestinationPath $php_dir -Force
|
||||||
Get-ChildItem -Path $php_dir -Filter php_*.pdb | Move-Item -Destination $ext_dir
|
Get-ChildItem -Path $php_dir -Filter php_*.pdb | Move-Item -Destination $ext_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install nightly version of PHP
|
# Function to install nightly version of PHP
|
||||||
Function Install-PhpNightly {
|
Function Install-PhpNightly {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $php_builder/releases/latest/download/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
Get-File -Url $php_builder/releases/latest/download/Get-PhpNightly.ps1 -FallbackUrl https://dl.cloudsmith.io/public/shivammathur/php-builder-windows/raw/files/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
||||||
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
|
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
|
||||||
if(Test-Path $php_dir\COMMIT) {
|
if(Test-Path $php_dir\COMMIT) {
|
||||||
return " ($( Get-Content $php_dir\COMMIT ))"
|
return " ($( Get-Content $php_dir\COMMIT ))"
|
||||||
@ -387,7 +421,7 @@ if($installed.MajorMinorVersion -ne $version) {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
if($version -lt "5.5") {
|
if($version -lt "5.5") {
|
||||||
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
|
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Get-File -Url "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
|
||||||
} else {
|
} else {
|
||||||
$enable_extensions += ('opcache')
|
$enable_extensions += ('opcache')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user