mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Add support for phalcon5 on Linux and macOS
Fix get_pecl_version
This commit is contained in:
parent
3ede7656cb
commit
0d9a1ba5ae
@ -117,7 +117,7 @@ describe('Extension tests', () => {
|
|||||||
)
|
)
|
||||||
? `add_${extension}`
|
? `add_${extension}`
|
||||||
: `add_brew_extension ${formula} ${prefix}`;
|
: `add_brew_extension ${formula} ${prefix}`;
|
||||||
return [formula, '7.3', output];
|
return [formula, formula === 'phalcon3' ? '7.3' : '7.4', output];
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each(data)(
|
it.each(data)(
|
||||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -247,7 +247,7 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^couchbase|^event|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
case /^couchbase|^event|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4/.test(version_extension):
|
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-2])phalcon5/.test(version_extension):
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(ext_name, 'extensions', extension, 'darwin');
|
add_script += await utils.customPackage(ext_name, 'extensions', extension, 'darwin');
|
||||||
return;
|
return;
|
||||||
@ -362,7 +362,7 @@ async function addExtensionLinux(extension_csv, version) {
|
|||||||
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
||||||
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(version_extension):
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(ext_name, 'extensions', extension, 'linux');
|
add_script += await utils.customPackage(ext_name, 'extensions', extension, 'linux');
|
||||||
return;
|
return;
|
||||||
|
@ -18,6 +18,7 @@ pcov=pcov
|
|||||||
pecl_http=http
|
pecl_http=http
|
||||||
phalcon3=phalcon
|
phalcon3=phalcon
|
||||||
phalcon4=phalcon
|
phalcon4=phalcon
|
||||||
|
phalcon5=phalcon
|
||||||
propro=propro
|
propro=propro
|
||||||
protobuf=protobuf
|
protobuf=protobuf
|
||||||
psr=psr
|
psr=psr
|
||||||
|
@ -35,7 +35,7 @@ export async function addExtensionDarwin(
|
|||||||
// match 5.3blackfire-(semver)...8.1blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.1blackfire-(semver)
|
||||||
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
|
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...7.4ioncube
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
@ -43,7 +43,9 @@ export async function addExtensionDarwin(
|
|||||||
extension
|
extension
|
||||||
):
|
):
|
||||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4/.test(version_extension):
|
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-2])phalcon5/.test(
|
||||||
|
version_extension
|
||||||
|
):
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -255,7 +257,7 @@ export async function addExtensionLinux(
|
|||||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||||
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...7.4ioncube
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.2phalcon5
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
@ -267,7 +269,9 @@ export async function addExtensionLinux(
|
|||||||
):
|
):
|
||||||
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(
|
||||||
|
version_extension
|
||||||
|
):
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
|
@ -145,11 +145,12 @@ add_extension() {
|
|||||||
get_pecl_version() {
|
get_pecl_version() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
|
||||||
|
major_version=${3:-'[0-9]+'}
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
|
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Eio "([0-9]+\.[0-9]+\.[0-9]+${stability}[0-9]+)")
|
pecl_version=$(echo "$response" | grep -m 1 -Eio "($major_version\.[0-9]+\.[0-9]+${stability}[0-9]+<)" | cut -d '<' -f 1)
|
||||||
if [ ! "$pecl_version" ]; then
|
if [ ! "$pecl_version" ]; then
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Eo "([0-9]+\.[0-9]+\.[0-9]+)")
|
pecl_version=$(echo "$response" | grep -m 1 -Eo "($major_version\.[0-9]+\.[0-9]+)<" | cut -d '<' -f 1)
|
||||||
fi
|
fi
|
||||||
echo "$pecl_version"
|
echo "$pecl_version"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
# Helper function to get phalcon version
|
||||||
|
get_phalcon_version() {
|
||||||
|
if [ "$extension" = "phalcon5" ]; then
|
||||||
|
semver="$(get_pecl_version phalcon stable 5)"
|
||||||
|
([ -n "$semver" ] && echo "$semver") || get_pecl_version phalcon rc 5
|
||||||
|
elif [ "$extension" = "phalcon4" ]; then
|
||||||
|
echo '4.1.2'
|
||||||
|
elif [ "$extension" = "phalcon3" ]; then
|
||||||
|
echo '3.4.5'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Helper function to add phalcon.
|
# Helper function to add phalcon.
|
||||||
add_phalcon_helper() {
|
add_phalcon_helper() {
|
||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
@ -7,7 +19,7 @@ add_phalcon_helper() {
|
|||||||
packages=("php${version:?}-$extension")
|
packages=("php${version:?}-$extension")
|
||||||
[ "$extension" = "phalcon4" ] && packages+=("php${version:?}-psr")
|
[ "$extension" = "phalcon4" ] && packages+=("php${version:?}-psr")
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
||||||
check_package "${packages[0]}" && install_packages "${packages[@]}"
|
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "phalcon-$(get_phalcon_version)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,15 +56,27 @@ add_phalcon4() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to add phalcon3.
|
||||||
|
add_phalcon5() {
|
||||||
|
if shared_extension phalcon; then
|
||||||
|
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
|
add_phalcon_helper
|
||||||
|
else
|
||||||
|
enable_extension phalcon extension
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
add_phalcon_helper
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to add phalcon.
|
# Function to add phalcon.
|
||||||
add_phalcon() {
|
add_phalcon() {
|
||||||
extension=$1
|
extension=$1
|
||||||
status='Enabled'
|
status='Enabled'
|
||||||
extension_major_version=${extension: -1}
|
extension_major_version=${extension: -1}
|
||||||
if [ "$extension_major_version" = "4" ]; then
|
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
||||||
add_phalcon4 >/dev/null 2>&1
|
add_phalcon"$extension_major_version" >/dev/null 2>&1
|
||||||
elif [ "$extension_major_version" = "3" ]; then
|
|
||||||
add_phalcon3 >/dev/null 2>&1
|
|
||||||
fi
|
fi
|
||||||
add_extension_log "phalcon" "$status"
|
add_extension_log "phalcon" "$status"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user