From 9f21c80d24a639578870aacdabba1876f3fb1355 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Thu, 16 Jan 2020 09:04:43 +0530 Subject: [PATCH] Install phalcon v4 from PECL on windows --- src/scripts/ext/phalcon.ps1 | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/scripts/ext/phalcon.ps1 b/src/scripts/ext/phalcon.ps1 index 977a7005..0d36834e 100644 --- a/src/scripts/ext/phalcon.ps1 +++ b/src/scripts/ext/phalcon.ps1 @@ -14,14 +14,18 @@ $tick = ([char]8730) $domain = 'https://github.com' $php_dir = 'C:\tools\php' $ext_dir = $php_dir + '\ext' -$installed = Get-Php -Path $php_dir -$extension_version = $extension.substring($extension.Length - 1) -$nts = if(! $installed.ThreadSafe ) { "_nts" } else { "" } -$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`"" -$zip_file = $match.Matches[0].Groups[1].Value -Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip >$null 2>&1 -Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force >$null 2>&1 -New-Item -ItemType SymbolicLink -Path $ext_dir\php_phalcon.dll -Target $ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll >$null 2>&1 -Install-Phpextension psr -MinimumStability stable -Path $php_dir -Enable-PhpExtension -Extension phalcon -Path $php_dir +if($extension -eq "phalcon4") { + Install-Phpextension psr -MinimumStability stable -Path $php_dir + Install-Phpextension phalcon -MinimumStability stable -Path $php_dir +} else { + $installed = Get-Php -Path $php_dir + $extension_version = $extension.substring($extension.Length - 1) + $nts = if(! $installed.ThreadSafe ) { "_nts" } else { "" } + $match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`"" + $zip_file = $match.Matches[0].Groups[1].Value + Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip >$null 2>&1 + Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force >$null 2>&1 + New-Item -ItemType SymbolicLink -Path $ext_dir\php_phalcon.dll -Target $ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll >$null 2>&1 + Enable-PhpExtension -Extension phalcon -Path $php_dir +} printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled" \ No newline at end of file