Fix support for phalcon and gearman

This commit is contained in:
Shivam Mathur 2020-05-09 07:20:08 +05:30
parent 5c2618165a
commit 0135ee2ed1
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 14 additions and 10 deletions

6
dist/index.js vendored
View File

@ -2657,7 +2657,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4 // match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
add_script += add_script +=
'sh ' + '\nbash ' +
path.join(__dirname, '../src/scripts/ext/phalcon_darwin.sh') + path.join(__dirname, '../src/scripts/ext/phalcon_darwin.sh') +
' ' + ' ' +
extension + extension +
@ -2811,7 +2811,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
// match 5.6gearman..7.4gearman // match 5.6gearman..7.4gearman
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension): case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
command = command =
'sh ' + '\nbash ' +
path.join(__dirname, '../src/scripts/ext/gearman.sh') + path.join(__dirname, '../src/scripts/ext/gearman.sh') +
' ' + ' ' +
version + version +
@ -2820,7 +2820,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4 // match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
add_script += add_script +=
'\nsh ' + '\nbash ' +
path.join(__dirname, '../src/scripts/ext/phalcon.sh') + path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
' ' + ' ' +
extension + extension +

View File

@ -98,7 +98,7 @@ export async function addExtensionDarwin(
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4 // match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
add_script += add_script +=
'sh ' + '\nbash ' +
path.join(__dirname, '../src/scripts/ext/phalcon_darwin.sh') + path.join(__dirname, '../src/scripts/ext/phalcon_darwin.sh') +
' ' + ' ' +
extension + extension +
@ -267,7 +267,7 @@ export async function addExtensionLinux(
// match 5.6gearman..7.4gearman // match 5.6gearman..7.4gearman
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension): case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
command = command =
'sh ' + '\nbash ' +
path.join(__dirname, '../src/scripts/ext/gearman.sh') + path.join(__dirname, '../src/scripts/ext/gearman.sh') +
' ' + ' ' +
version + version +
@ -276,7 +276,7 @@ export async function addExtensionLinux(
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4 // match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
add_script += add_script +=
'\nsh ' + '\nbash ' +
path.join(__dirname, '../src/scripts/ext/phalcon.sh') + path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
' ' + ' ' +
extension + extension +

View File

@ -36,7 +36,7 @@ tick="✓"
cross="✗" cross="✗"
if [ "$extension_major_version" = "4" ]; then if [ "$extension_major_version" = "4" ]; then
if [ -e "$ext_dir/psr.so" ]; then if [ -e "$ext_dir/psr.so" ] && ! php -m | grep -i -q -w psr; then
echo "extension=psr.so" | sudo tee -a "$ini_file" >/dev/null 2>&1 echo "extension=psr.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
fi fi

View File

@ -13,6 +13,7 @@ add_log() {
# Function to install phalcon # Function to install phalcon
install_phalcon() { install_phalcon() {
( (
sed -i '' '/extension.*psr/d' "$ini_file"
brew tap shivammathur/homebrew-phalcon >/dev/null 2>&1 brew tap shivammathur/homebrew-phalcon >/dev/null 2>&1
brew install phalcon@"$php_version"_"$extension_major" >/dev/null 2>&1 brew install phalcon@"$php_version"_"$extension_major" >/dev/null 2>&1
sudo cp /usr/local/opt/psr@"$php_version"/psr.so "$ext_dir" >/dev/null 2>&1 sudo cp /usr/local/opt/psr@"$php_version"/psr.so "$ext_dir" >/dev/null 2>&1
@ -27,14 +28,17 @@ extension=$1
extension_major=${extension: -1} extension_major=${extension: -1}
php_version=$2 php_version=$2
semver=$(php -v | head -n 1 | cut -f 2 -d ' ') semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||") ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
if [ -e "$ext_dir/psr.so" ] && [ -e "$ext_dir/phalcon.so" ]; then if [ -e "$ext_dir/psr.so" ] && [ -e "$ext_dir/phalcon.so" ]; then
phalcon_version=$(php -d="extension=psr.so" -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1) phalcon_version=$(php -d="extension=psr.so" -d="extension=phalcon.so" -r "echo phpversion('phalcon');" 2>/dev/null | cut -d'.' -f 1)
if php -m | grep -i -q -w psr; then
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" 2>/dev/null | cut -d'.' -f 1)
fi
if [ "$phalcon_version" != "$extension_major" ]; then if [ "$phalcon_version" != "$extension_major" ]; then
install_phalcon install_phalcon
else else
echo "extension=psr.so" >>"$ini_file" if ! php -m | grep -i -q -w psr; then echo "extension=psr.so" >>"$ini_file"; fi
echo "extension=phalcon.so" >>"$ini_file" echo "extension=phalcon.so" >>"$ini_file"
add_log "$tick" "$extension" "Enabled" add_log "$tick" "$extension" "Enabled"
fi fi