Merge pull request #121 from shivammathur/develop

Fix add_extension on linux and macOS
This commit is contained in:
Shivam Mathur 2019-12-17 04:28:05 +05:30 committed by GitHub
commit 51c7527bd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -37,11 +37,11 @@ add_extension() {
extension=$1 extension=$1
install_command=$2 install_command=$2
prefix=$3 prefix=$3
if ! php -m | grep -i -q "$extension" && [ -e "$ext_dir/$extension.so" ]; then if ! php -m | grep -i -q ^"$extension"$ && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$extension" >>"$ini_file" && add_log $tick "$extension" "Enabled" echo "$prefix=$extension" >>"$ini_file" && add_log $tick "$extension" "Enabled"
elif php -m | grep -i -q "$extension"; then elif php -m | grep -i -q ^"$extension"$; then
add_log "$tick" "$extension" "Enabled" add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q "$extension"; then elif ! php -m | grep -i -q ^"$extension"$; then
exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null) exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null)
if [ "$exists" = "200" ]; then if [ "$exists" = "200" ]; then
( (
@ -49,7 +49,7 @@ add_extension() {
add_log "$tick" "$extension" "Installed and enabled" add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver" ) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
else else
if ! php -m | grep -i -q "$extension"; then if ! php -m | grep -i -q ^"$extension"$; then
add_log "$cross" "$extension" "Could not find $extension for PHP $semver on PECL" add_log "$cross" "$extension" "Could not find $extension for PHP $semver on PECL"
fi fi
fi fi

View File

@ -96,11 +96,11 @@ add_extension()
extension=$1 extension=$1
install_command=$2 install_command=$2
prefix=$3 prefix=$3
if ! php -m | grep -i -q "$extension" && [ -e "$ext_dir/$extension.so" ]; then if ! php -m | grep -i -q ^"$extension"$ && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$extension" >> "$ini_file" && add_log "$tick" "$extension" "Enabled" echo "$prefix=$extension" >> "$ini_file" && add_log "$tick" "$extension" "Enabled"
elif php -m | grep -i -q "$extension"; then elif php -m | grep -i -q ^"$extension"$; then
add_log "$tick" "$extension" "Enabled" add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q "$extension"; then elif ! php -m | grep -i -q ^"$extension"$; then
( (
eval "$install_command" && \ eval "$install_command" && \
add_log "$tick" "$extension" "Installed and enabled" add_log "$tick" "$extension" "Installed and enabled"