Add support for old PHP versions on windows

This commit is contained in:
Shivam Mathur 2020-02-06 05:24:45 +05:30
parent 326dfd1e76
commit 3c6644f237
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -91,10 +91,7 @@ Function Add-Tool() {
if (Test-Path $php_dir\$tool) {
Remove-Item $php_dir\$tool
}
if ($tool -eq "composer") {
Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir
composer -q global config process-timeout 0
} elseif ($tool -eq "symfony") {
if ($tool -eq "symfony") {
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.exe" > $null 2>&1
} else {
@ -113,9 +110,10 @@ Function Add-Tool() {
Add-Extension curl >$null 2>&1
Add-Extension mbstring >$null 2>&1
Add-Extension xml >$null 2>&1
}
if($tool -eq "cs2pr") {
} elseif($tool -eq "cs2pr") {
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
} elseif($tool -eq "composer") {
composer -q global config process-timeout 0
}
if (((Get-ChildItem -Path $php_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
Add-Log $tick $tool "Added"
@ -202,7 +200,12 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
$installed = Get-Php -Path $php_dir
Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir
if($version -lt "5.5") {
Add-Extension openssl >$null 2>&1
Add-Extension curl >$null 2>&1
} else {
Enable-PhpExtension -Extension openssl, curl, opcache -Path $php_dir
}
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
if ($version -eq 'master') {
if($installed.ThreadSafe) {