Skip to content

Commit 14d9660

Browse files
committed
Fix support for sqlsrv and pdo_sqlsrv
1 parent efffd0e commit 14d9660

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

src/scripts/extensions/add_extensions.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Function Enable-Extension() {
6666
}
6767

6868
# Function to add custom built PHP extension for nightly builds.
69-
Function Add-NightlyExtension {
69+
Function Add-ExtensionFromGithub {
7070
Param (
7171
[Parameter(Position = 0, Mandatory = $true)]
7272
[ValidateNotNull()]
@@ -123,7 +123,7 @@ Function Add-Extension {
123123
}
124124
else {
125125
if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) {
126-
Add-NightlyExtension $extension
126+
Add-ExtensionFromGithub $extension
127127
} else {
128128
# Patch till DLLs for PHP 8.1 and above are released as stable.
129129
$minimumStability = $stability

src/scripts/extensions/sqlsrv.ps1

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)