setup-php/src/scripts/extensions/ioncube.ps1

34 lines
1.3 KiB
PowerShell
Raw Normal View History

2020-07-19 12:39:45 +07:00
# Function to log result of a operation.
2020-07-26 17:18:19 +07:00
Function Add-LicenseLog() {
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
2020-07-26 17:18:19 +07:00
Get-Content $ext_dir\ioncube\LICENSE.txt
Write-Output "$env:END_GROUP"
2020-07-19 12:39:45 +07:00
}
2020-07-26 17:18:19 +07:00
# Function to add ioncube extension.
Function Add-Ioncube() {
try {
2021-09-19 11:02:31 +07:00
$status = 'Enabled'
2020-07-26 17:18:19 +07:00
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
$status = 'Installed and enabled'
$arch_part = $arch
if ($arch -eq 'x64') {
$arch_part = 'x86-64'
}
$vc = $installed.VCVersion
$ts_part = ""
if (-not($installed.ThreadSafe)) {
$ts_part = "_nonts"
}
2020-11-11 03:53:45 +07:00
Invoke-WebRequest -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
2020-07-26 17:18:19 +07:00
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
2020-07-19 12:39:45 +07:00
}
2020-07-26 17:18:19 +07:00
"zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini
Add-Log $tick "ioncube" $status
Add-LicenseLog
} catch {
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
2020-07-19 12:39:45 +07:00
}
2020-07-26 17:18:19 +07:00
}