mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Fix support for pre-release extensions
This commit is contained in:
parent
9d042b2683
commit
13a3d9d0a9
@ -60,10 +60,10 @@ check_extension() {
|
|||||||
# Fuction to get the PECL version.
|
# Fuction to get the PECL version.
|
||||||
get_pecl_version() {
|
get_pecl_version() {
|
||||||
extension=$1
|
extension=$1
|
||||||
stability=$2
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(curl -q -sSL "$pecl_rest$extension"/allreleases.xml)
|
response=$(curl -q -sSL "$pecl_rest$extension"/allreleases.xml)
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Eo "(\d*\.\d*\.\d*$stability\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Eio "(\d*\.\d*\.\d*$stability\d*)")
|
||||||
if [ ! "$pecl_version" ]; then
|
if [ ! "$pecl_version" ]; then
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Eo "(\d*\.\d*\.\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Eo "(\d*\.\d*\.\d*)")
|
||||||
fi
|
fi
|
||||||
@ -75,6 +75,9 @@ add_pecl_extension() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
pecl_version=$2
|
pecl_version=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
|
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot).* ]]; then
|
||||||
|
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
||||||
|
fi
|
||||||
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"
|
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"
|
||||||
fi
|
fi
|
||||||
|
@ -80,10 +80,10 @@ configure_pecl() {
|
|||||||
# Fuction to get the PECL version of an extension.
|
# Fuction to get the PECL version of an extension.
|
||||||
get_pecl_version() {
|
get_pecl_version() {
|
||||||
extension=$1
|
extension=$1
|
||||||
stability=$2
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(curl -q -sSL "$pecl_rest$extension"/allreleases.xml)
|
response=$(curl -q -sSL "$pecl_rest$extension"/allreleases.xml)
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*$stability\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)")
|
||||||
if [ ! "$pecl_version" ]; then
|
if [ ! "$pecl_version" ]; then
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*)")
|
||||||
fi
|
fi
|
||||||
@ -179,6 +179,9 @@ add_pecl_extension() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
pecl_version=$2
|
pecl_version=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
|
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot).* ]]; then
|
||||||
|
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
||||||
|
fi
|
||||||
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
echo "$prefix=$ext_dir/$extension.so" >>"$pecl_file"
|
echo "$prefix=$ext_dir/$extension.so" >>"$pecl_file"
|
||||||
fi
|
fi
|
||||||
|
@ -99,7 +99,7 @@ Function Add-Extension {
|
|||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[ValidateSet('stable', 'beta', 'alpha', 'devel', 'snapshot')]
|
[ValidateSet('stable', 'beta', 'alpha', 'devel', 'snapshot')]
|
||||||
[string]
|
[string]
|
||||||
$mininum_stability = 'stable',
|
$stability = 'stable',
|
||||||
[Parameter(Position = 2, Mandatory = $false)]
|
[Parameter(Position = 2, Mandatory = $false)]
|
||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[ValidatePattern('^\d+(\.\d+){0,2}$')]
|
[ValidatePattern('^\d+(\.\d+){0,2}$')]
|
||||||
@ -124,9 +124,9 @@ Function Add-Extension {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($extension_version -ne '') {
|
if($extension_version -ne '') {
|
||||||
Install-PhpExtension -Extension $extension -Version $extension_version -MinimumStability $mininum_stability -Path $php_dir
|
Install-PhpExtension -Extension $extension -Version $extension_version -MinimumStability $stability -MaximumStability $stability -Path $php_dir
|
||||||
} else {
|
} else {
|
||||||
Install-PhpExtension -Extension $extension -MinimumStability $mininum_stability -Path $php_dir
|
Install-PhpExtension -Extension $extension -MinimumStability $stability -MaximumStability $stability -Path $php_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
Add-Log $tick $extension "Installed and enabled"
|
Add-Log $tick $extension "Installed and enabled"
|
||||||
|
Loading…
Reference in New Issue
Block a user