From 4979d5b484bdbe0aa42b6bc1a6625c1ea2ac6404 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sat, 16 Jul 2022 01:59:27 +0530 Subject: [PATCH] Add workaround for missing phalcon packages on Ubuntu 22.04 --- src/scripts/extensions/phalcon.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/scripts/extensions/phalcon.sh b/src/scripts/extensions/phalcon.sh index a1e27634..4f2109be 100644 --- a/src/scripts/extensions/phalcon.sh +++ b/src/scripts/extensions/phalcon.sh @@ -4,22 +4,36 @@ get_phalcon_version() { semver="$(get_pecl_version phalcon stable 5)" ([ -n "$semver" ] && echo "$semver") || get_pecl_version phalcon rc 5 elif [ "$extension" = "phalcon4" ]; then - echo '4.1.2' + echo '4.1.3' elif [ "$extension" = "phalcon3" ]; then echo '3.4.5' fi } +# Function to add phalcon from repo. +add_phalcon_from_repo(){ + version=${version:?} + if [ "$extension" = "phalcon5" ]; then + PHALCON_PATH=build/phalcon + else + PHALCON_PATH=build/php"${version%.*}"/64bits + fi + PHALCON_CONFIGURE_OPTS="--enable-phalcon --with-php-config=$(command -v php-config)" + export PHALCON_PATH + export PHALCON_CONFIGURE_OPTS + add_extension_from_source phalcon https://github.com phalcon cphalcon v"$(get_phalcon_version)" extension +} + # Helper function to add phalcon. add_phalcon_helper() { status='Installed and enabled' if [ "$(uname -s)" = "Darwin" ]; then add_brew_extension "$extension" extension else - packages=("php${version:?}-$extension") - [ "$extension" = "phalcon4" ] && packages+=("php${version:?}-psr") + package="php${version:?}-$extension" add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php - (check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "phalcon-$(get_phalcon_version)" + [ "$extension" = "phalcon4" ] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0) + (check_package "$package" && install_packages "$package") || add_phalcon_from_repo fi }