2020-07-26 17:18:19 +07:00
|
|
|
# Function to log license information.
|
|
|
|
Function Add-LicenseLog() {
|
2020-07-20 13:20:58 +07:00
|
|
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
|
|
|
|
printf "Oracle Instant Client package is required for %s extension.\n" $extension
|
|
|
|
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
|
|
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
|
|
|
Write-Output "::endgroup::"
|
|
|
|
}
|
|
|
|
|
2020-07-26 17:18:19 +07:00
|
|
|
# Function to get instantclinet.
|
|
|
|
Function Add-InstantClient() {
|
2020-07-20 13:20:58 +07:00
|
|
|
if (-not(Test-Path $php_dir\oci.dll)) {
|
|
|
|
$suffix = 'windows'
|
2020-07-26 17:18:19 +07:00
|
|
|
if ($arch -eq 'x86') {
|
2020-07-20 13:20:58 +07:00
|
|
|
$suffix = 'nt'
|
|
|
|
}
|
2020-11-11 03:53:45 +07:00
|
|
|
Invoke-WebRequest -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
2020-07-20 13:20:58 +07:00
|
|
|
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
|
|
|
|
Copy-Item $php_dir\instantclient*\* $php_dir
|
2020-07-15 11:15:40 +07:00
|
|
|
}
|
2020-07-26 17:18:19 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
# Function to install oci8 and pdo_oci.
|
2020-08-06 17:03:58 +07:00
|
|
|
Function Add-Oci() {
|
2020-07-26 17:18:19 +07:00
|
|
|
Param (
|
|
|
|
[Parameter(Position = 0, Mandatory = $true)]
|
|
|
|
[ValidateNotNull()]
|
|
|
|
[ValidateSet('oci8', 'pdo_oci')]
|
|
|
|
[string]
|
|
|
|
$extension
|
|
|
|
)
|
|
|
|
try {
|
|
|
|
$status = 'Enabled'
|
|
|
|
Add-InstantClient
|
|
|
|
if ($extension -eq "pdo_oci") {
|
|
|
|
Enable-PhpExtension pdo_oci -Path $php_dir
|
|
|
|
} else {
|
2020-08-10 02:02:30 +07:00
|
|
|
if(-not(Test-Path $ext_dir\php_oci8.dll)) {
|
|
|
|
$status = 'Installed and enabled'
|
2021-02-22 20:10:19 +07:00
|
|
|
$ociVersion = Get-PeclPackageVersion oci8 -MinimumStability stable -MaximumStability stable | Select-Object -First 1
|
2020-08-10 02:02:30 +07:00
|
|
|
if ($version -eq '7.0') {
|
|
|
|
$ociVersion = '2.1.8'
|
|
|
|
} elseif ($version -lt '7.0') {
|
|
|
|
$ociVersion = '2.0.12'
|
2021-02-22 20:10:19 +07:00
|
|
|
} elseif ($version -lt '8.0') {
|
|
|
|
$ociVersion = '2.2.0'
|
2020-08-10 02:02:30 +07:00
|
|
|
}
|
|
|
|
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
2020-11-11 03:53:45 +07:00
|
|
|
Invoke-WebRequest -Uri $ociUrl -OutFile $php_dir\oci8.zip
|
2020-08-10 02:02:30 +07:00
|
|
|
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
|
|
|
|
|
2020-07-26 17:18:19 +07:00
|
|
|
}
|
|
|
|
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
|
2020-07-20 13:20:58 +07:00
|
|
|
}
|
2020-07-26 17:18:19 +07:00
|
|
|
Add-Log $tick $extension $status
|
|
|
|
Add-LicenseLog
|
|
|
|
} catch {
|
|
|
|
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
|
2020-07-15 11:15:40 +07:00
|
|
|
}
|
|
|
|
}
|