Skip to content

Commit

Permalink
Merge pull request #121 from shivammathur/develop
Browse files Browse the repository at this point in the history
Fix add_extension on linux and macOS
  • Loading branch information
shivammathur authored Dec 16, 2019
2 parents b3a84fc + 2bf7ab0 commit 51c7527
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/scripts/darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ add_extension() {
extension=$1
install_command=$2
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"
elif php -m | grep -i -q "$extension"; then
elif php -m | grep -i -q ^"$extension"$; then
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)
if [ "$exists" = "200" ]; then
(
eval "$install_command" && \
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
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"
fi
fi
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ add_extension()
extension=$1
install_command=$2
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"
elif php -m | grep -i -q "$extension"; then
elif php -m | grep -i -q ^"$extension"$; then
add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q "$extension"; then
elif ! php -m | grep -i -q ^"$extension"$; then
(
eval "$install_command" && \
add_log "$tick" "$extension" "Installed and enabled"
Expand Down

0 comments on commit 51c7527

Please sign in to comment.