2020-07-26 17:18:19 +07:00
|
|
|
# Helper function to add phalcon.
|
|
|
|
add_phalcon_helper() {
|
|
|
|
status='Installed and enabled'
|
2021-10-09 07:56:16 +07:00
|
|
|
if [ "$(uname -s)" = "Darwin" ]; then
|
|
|
|
add_brew_extension "$extension" extension
|
2020-01-21 19:28:09 +07:00
|
|
|
else
|
2022-01-05 16:48:04 +07:00
|
|
|
packages=("php${version:?}-$extension")
|
|
|
|
[ "$extension" = "phalcon4" ] && packages+=("php${version:?}-psr")
|
|
|
|
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
|
|
|
check_package "${packages[0]}" && install_packages "${packages[@]}"
|
2020-01-21 19:28:09 +07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-07-26 17:18:19 +07:00
|
|
|
# Function to add phalcon3.
|
|
|
|
add_phalcon3() {
|
2021-08-26 17:24:09 +07:00
|
|
|
if shared_extension phalcon; then
|
2020-07-26 17:18:19 +07:00
|
|
|
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
|
|
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
|
|
|
add_phalcon_helper
|
|
|
|
else
|
2021-09-19 08:32:01 +07:00
|
|
|
enable_extension phalcon extension
|
2020-07-23 07:19:11 +07:00
|
|
|
fi
|
2020-07-26 17:18:19 +07:00
|
|
|
else
|
|
|
|
add_phalcon_helper
|
2020-12-02 07:20:56 +07:00
|
|
|
fi
|
2020-01-21 19:28:09 +07:00
|
|
|
}
|
|
|
|
|
2020-07-26 17:18:19 +07:00
|
|
|
# Function to add phalcon4.
|
|
|
|
add_phalcon4() {
|
2021-09-19 08:32:01 +07:00
|
|
|
enable_extension psr extension
|
2021-08-26 17:24:09 +07:00
|
|
|
if shared_extension phalcon; then
|
2021-09-19 08:32:01 +07:00
|
|
|
if check_extension psr; then
|
2020-02-02 16:53:02 +07:00
|
|
|
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
2020-01-21 19:28:09 +07:00
|
|
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
2020-07-26 17:18:19 +07:00
|
|
|
add_phalcon_helper
|
2020-01-21 19:28:09 +07:00
|
|
|
else
|
2021-09-19 08:32:01 +07:00
|
|
|
enable_extension phalcon extension
|
2020-01-21 19:28:09 +07:00
|
|
|
fi
|
|
|
|
else
|
2020-07-26 17:18:19 +07:00
|
|
|
add_phalcon_helper
|
2019-12-31 14:55:59 +07:00
|
|
|
fi
|
2020-01-21 19:28:09 +07:00
|
|
|
else
|
2020-07-26 17:18:19 +07:00
|
|
|
add_phalcon_helper
|
2020-12-02 07:20:56 +07:00
|
|
|
fi
|
2020-07-26 17:18:19 +07:00
|
|
|
}
|
2019-10-27 07:12:49 +07:00
|
|
|
|
2020-07-26 17:18:19 +07:00
|
|
|
# Function to add phalcon.
|
|
|
|
add_phalcon() {
|
|
|
|
extension=$1
|
|
|
|
status='Enabled'
|
|
|
|
extension_major_version=${extension: -1}
|
|
|
|
if [ "$extension_major_version" = "4" ]; then
|
|
|
|
add_phalcon4 >/dev/null 2>&1
|
|
|
|
elif [ "$extension_major_version" = "3" ]; then
|
|
|
|
add_phalcon3 >/dev/null 2>&1
|
2020-01-21 19:28:09 +07:00
|
|
|
fi
|
2020-07-26 17:18:19 +07:00
|
|
|
add_extension_log "phalcon" "$status"
|
|
|
|
}
|