Fix checking for existing php formula on macOS

This commit is contained in:
Shivam Mathur 2023-09-22 14:00:55 +05:30
parent 91026460e4
commit 10c12b9377
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -162,8 +162,11 @@ fix_dependencies() {
# Function to get PHP version if it is already installed using Homebrew. # Function to get PHP version if it is already installed using Homebrew.
get_brewed_php() { get_brewed_php() {
php_cellar="$brew_prefix"/Cellar/php cellar="$brew_prefix"/Cellar
if [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then php_cellar="$cellar"/php
if [ -d "$cellar" ] && ! [[ "$(find "$cellar" -maxdepth 1 -name "php@$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
php_semver | cut -c 1-3
elif [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
php_semver | cut -c 1-3 php_semver | cut -c 1-3
else else
echo 'false'; echo 'false';