@@ -29,24 +29,26 @@ Function Get-SqlsrvReleaseUrl()
2929}
3030
3131# Function to add sqlsrv extension from GitHub.
32- Function Add-SqlsrvFromGithub ()
32+ Function Add-SqlsrvFromMSGithub ()
3333{
3434 Param (
3535 [Parameter (Position = 0 , Mandatory = $true )]
3636 [ValidateNotNull ()]
3737 [string ]
3838 $extension
3939 )
40- $zipUrl = SqlsrvReleaseUrl
41- if ($zipUrl ) {
42- $nts = if (! $installed.ThreadSafe ) { " nts" } else { " ts" }
43- $noDotVersion = $version.replace (' .' , ' ' )
44- $extensionFilePath = " Windows-$version \$arch \php_${extension} _${noDotVersion} _${nts} .dll"
45- Get-File - Url $zipUrl - OutFile $ENV: RUNNER_TOOL_CACHE \sqlsrv.zip > $null 2>&1
46- Expand-Archive - Path $ENV: RUNNER_TOOL_CACHE \sqlsrv.zip - DestinationPath $ENV: RUNNER_TOOL_CACHE \sqlsrv - Force > $null 2>&1
47- Copy-Item - Path " $ENV: RUNNER_TOOL_CACHE \sqlsrv\$extensionFilePath " - Destination " $ext_dir \php_$extension .dll"
48- Enable-PhpExtension - Extension $extension - Path $php_dir
49- }
40+ try {
41+ $zipUrl = SqlsrvReleaseUrl
42+ if ($zipUrl ) {
43+ $nts = if (! $installed.ThreadSafe ) { " nts" } else { " ts" }
44+ $noDotVersion = $version.replace (' .' , ' ' )
45+ $extensionFilePath = " Windows-$version \$arch \php_${extension} _${noDotVersion} _${nts} .dll"
46+ Get-File - Url $zipUrl - OutFile $ENV: RUNNER_TOOL_CACHE \sqlsrv.zip > $null 2>&1
47+ Expand-Archive - Path $ENV: RUNNER_TOOL_CACHE \sqlsrv.zip - DestinationPath $ENV: RUNNER_TOOL_CACHE \sqlsrv - Force > $null 2>&1
48+ Copy-Item - Path " $ENV: RUNNER_TOOL_CACHE \sqlsrv\$extensionFilePath " - Destination " $ext_dir \php_$extension .dll"
49+ Enable-PhpExtension - Extension $extension - Path $php_dir
50+ }
51+ } catch { }
5052}
5153
5254# Function to add sqlsrv extension.
@@ -61,7 +63,12 @@ Function Add-Sqlsrv() {
6163 if (Test-Path $ext_dir \php_$extension.dll ) {
6264 Enable-PhpExtension - Extension $extension - Path $php_dir
6365 } else {
64- Add-SqlsrvFromGithub $extension > $null 2>&1
66+ try {
67+ Add-ExtensionFromGithub $extension > $null 2>&1
68+ } catch {}
69+ if (-not (Test-Extension $extension )) {
70+ Add-SqlsrvFromMSGithub $extension > $null 2>&1
71+ }
6572 if (-not (Test-Extension $extension )) {
6673 Add-Extension $extension > $null 2>&1
6774 }
0 commit comments