mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 05:23:03 +07:00
Improve phalcon support
This commit is contained in:
parent
89f4f7e8be
commit
cae6d06e69
@ -6,16 +6,16 @@ Function Add-PhalconFromGitHub() {
|
|||||||
[string]
|
[string]
|
||||||
$Semver
|
$Semver
|
||||||
)
|
)
|
||||||
$domain = 'https://github.com'
|
$domain = 'https://api.github.com/repos'
|
||||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||||
$match = Invoke-WebRequest -Uri "$domain/phalcon/cphalcon/releases/v$Semver" | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
|
$match = $match = (Invoke-RestMethod -Uri "$domain/phalcon/cphalcon/releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=(.*phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
||||||
if($NULL -eq $match) {
|
if($NULL -eq $match) {
|
||||||
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
|
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
|
||||||
$match = Invoke-WebRequest -Uri "$domain/phalcon/cphalcon/releases/v$Semver" | Select-String -Pattern "href=`"(.*phalcon-php${version}${nts}-windows.*-x64.zip)`""
|
$match = (Invoke-RestMethod -Uri "$domain/phalcon/cphalcon/releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=(.*phalcon-php${version}${nts}-windows.*-x64.zip)"
|
||||||
}
|
}
|
||||||
if($NULL -ne $match) {
|
if($NULL -ne $match) {
|
||||||
$zip_file = $match.Matches[0].Groups[1].Value
|
$zip_url = $match.Matches[0].Groups[1].Value
|
||||||
Invoke-WebRequest -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
Invoke-WebRequest -Uri $zip_url -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
|
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
|
||||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
||||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||||
@ -23,16 +23,28 @@ Function Add-PhalconFromGitHub() {
|
|||||||
throw "Unable to get Phalcon release from the GitHub release"
|
throw "Unable to get Phalcon release from the GitHub release"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to get phalcon semver.
|
||||||
|
Function Get-PhalconSemver() {
|
||||||
|
if($extension_version -eq '3') {
|
||||||
|
return '3.4.5'
|
||||||
|
} elseif (($extension_version -eq '4') -and ($version -eq '7.2')) {
|
||||||
|
return '4.1.0'
|
||||||
|
}
|
||||||
|
return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
|
||||||
|
}
|
||||||
|
|
||||||
# Function to install phalcon
|
# Function to install phalcon
|
||||||
Function Add-PhalconHelper() {
|
Function Add-PhalconHelper() {
|
||||||
if (($extension_version -eq '4') -or ($extension_version -eq '5')) {
|
$semver = Get-PhalconSemver
|
||||||
$extension_semver=Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
|
if (($extension_version -eq '3') -or ($extension_version -eq '5')) {
|
||||||
Add-Extension -Extension phalcon -Stability stable -Extension_version $extension_semver
|
Add-PhalconFromGitHub $semver
|
||||||
} elseif ($extension_version -eq '3') {
|
} elseif ($extension_version -eq '4') {
|
||||||
Add-PhalconFromGitHub -Semver 3.4.5
|
Add-Extension -Extension phalcon -Stability stable -Extension_version $semver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to add phalcon
|
||||||
Function Add-Phalcon() {
|
Function Add-Phalcon() {
|
||||||
Param (
|
Param (
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
@ -3,7 +3,7 @@ get_phalcon_version() {
|
|||||||
if [ "$extension" = "phalcon5" ]; then
|
if [ "$extension" = "phalcon5" ]; then
|
||||||
get_pecl_version phalcon stable 5
|
get_pecl_version phalcon stable 5
|
||||||
elif [ "$extension" = "phalcon4" ]; then
|
elif [ "$extension" = "phalcon4" ]; then
|
||||||
echo '4.1.3'
|
echo '4.1.2'
|
||||||
elif [ "$extension" = "phalcon3" ]; then
|
elif [ "$extension" = "phalcon3" ]; then
|
||||||
echo '3.4.5'
|
echo '3.4.5'
|
||||||
fi
|
fi
|
||||||
@ -32,7 +32,7 @@ add_phalcon_helper() {
|
|||||||
package="php${version:?}-$extension"
|
package="php${version:?}-$extension"
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
||||||
[ "$extension" = "phalcon4" ] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
|
[ "$extension" = "phalcon4" ] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
|
||||||
(check_package "$package" && install_packages "$package") || add_phalcon_from_repo
|
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ add_phalcon5() {
|
|||||||
|
|
||||||
# Function to add phalcon.
|
# Function to add phalcon.
|
||||||
add_phalcon() {
|
add_phalcon() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
status='Enabled'
|
status='Enabled'
|
||||||
extension_major_version=${extension: -1}
|
extension_major_version=${extension: -1}
|
||||||
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user