Skip to content

Commit

Permalink
Do not upgrade when version is pre-installed on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Dec 23, 2024
1 parent da72908 commit 775fa76
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/scripts/darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ get_scan_dir() {
setup_php() {
step_log "Setup PHP"
php_config="$(command -v php-config 2>/dev/null)"
update=true
check_pre_installed
existing_version=$(get_brewed_php)
if [[ "$version" =~ ${old_versions:?} ]]; then
Expand All @@ -221,12 +222,13 @@ setup_php() {
elif [ "$existing_version" != "$version" ]; then
add_php "install" "$existing_version" >/dev/null 2>&1
status="Installed"
elif [ "$existing_version" = "$version" ] && [ "${update:?}" = "true" ]; then
add_php "upgrade" "$existing_version" >/dev/null 2>&1
status="Updated to"
else
add_php "upgrade" "$existing_version" >/dev/null 2>&1
status="Updated to"
elif [ "$existing_version" = "$version" ]; then
if [ "${update:?}" = "true" ]; then
add_php "upgrade" "$existing_version" >/dev/null 2>&1
status="Updated to"
else
status="Found"
fi
fi
php_config="$(command -v php-config)"
ext_dir="$(sed -n "s/.*extension_dir=['\"]\(.*\)['\"].*/\1/p" "$php_config")"
Expand Down

0 comments on commit 775fa76

Please sign in to comment.