mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Fix support for sqlsrv and pdo_sqlsrv
This commit is contained in:
parent
efffd0e4f2
commit
14d9660823
@ -66,7 +66,7 @@ Function Enable-Extension() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Function to add custom built PHP extension for nightly builds.
|
# Function to add custom built PHP extension for nightly builds.
|
||||||
Function Add-NightlyExtension {
|
Function Add-ExtensionFromGithub {
|
||||||
Param (
|
Param (
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
@ -123,7 +123,7 @@ Function Add-Extension {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) {
|
if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) {
|
||||||
Add-NightlyExtension $extension
|
Add-ExtensionFromGithub $extension
|
||||||
} else {
|
} else {
|
||||||
# Patch till DLLs for PHP 8.1 and above are released as stable.
|
# Patch till DLLs for PHP 8.1 and above are released as stable.
|
||||||
$minimumStability = $stability
|
$minimumStability = $stability
|
||||||
|
@ -29,7 +29,7 @@ Function Get-SqlsrvReleaseUrl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Function to add sqlsrv extension from GitHub.
|
# Function to add sqlsrv extension from GitHub.
|
||||||
Function Add-SqlsrvFromGithub()
|
Function Add-SqlsrvFromMSGithub()
|
||||||
{
|
{
|
||||||
Param (
|
Param (
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
@ -37,16 +37,18 @@ Function Add-SqlsrvFromGithub()
|
|||||||
[string]
|
[string]
|
||||||
$extension
|
$extension
|
||||||
)
|
)
|
||||||
$zipUrl = SqlsrvReleaseUrl
|
try {
|
||||||
if($zipUrl) {
|
$zipUrl = SqlsrvReleaseUrl
|
||||||
$nts = if (!$installed.ThreadSafe) { "nts" } else { "ts" }
|
if($zipUrl) {
|
||||||
$noDotVersion = $version.replace('.', '')
|
$nts = if (!$installed.ThreadSafe) { "nts" } else { "ts" }
|
||||||
$extensionFilePath = "Windows-$version\$arch\php_${extension}_${noDotVersion}_${nts}.dll"
|
$noDotVersion = $version.replace('.', '')
|
||||||
Get-File -Url $zipUrl -OutFile $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip > $null 2>&1
|
$extensionFilePath = "Windows-$version\$arch\php_${extension}_${noDotVersion}_${nts}.dll"
|
||||||
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\sqlsrv -Force > $null 2>&1
|
Get-File -Url $zipUrl -OutFile $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip > $null 2>&1
|
||||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\sqlsrv\$extensionFilePath" -Destination "$ext_dir\php_$extension.dll"
|
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\sqlsrv.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\sqlsrv -Force > $null 2>&1
|
||||||
Enable-PhpExtension -Extension $extension -Path $php_dir
|
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\sqlsrv\$extensionFilePath" -Destination "$ext_dir\php_$extension.dll"
|
||||||
}
|
Enable-PhpExtension -Extension $extension -Path $php_dir
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add sqlsrv extension.
|
# Function to add sqlsrv extension.
|
||||||
@ -61,7 +63,12 @@ Function Add-Sqlsrv() {
|
|||||||
if (Test-Path $ext_dir\php_$extension.dll) {
|
if (Test-Path $ext_dir\php_$extension.dll) {
|
||||||
Enable-PhpExtension -Extension $extension -Path $php_dir
|
Enable-PhpExtension -Extension $extension -Path $php_dir
|
||||||
} else {
|
} else {
|
||||||
Add-SqlsrvFromGithub $extension >$null 2>&1
|
try {
|
||||||
|
Add-ExtensionFromGithub $extension > $null 2>&1
|
||||||
|
} catch {}
|
||||||
|
if (-not(Test-Extension $extension)) {
|
||||||
|
Add-SqlsrvFromMSGithub $extension >$null 2>&1
|
||||||
|
}
|
||||||
if (-not(Test-Extension $extension)) {
|
if (-not(Test-Extension $extension)) {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension >$null 2>&1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user