Install phalcon v4 from PECL on windows

This commit is contained in:
Shivam Mathur 2020-01-16 09:04:43 +05:30
parent c4317135df
commit 9f21c80d24
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -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"