mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Fix logs of disabled dependent extensions
Use shared_extension function on unix
This commit is contained in:
parent
8e80635955
commit
4beeea41b4
@ -102,6 +102,11 @@ check_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to check if extension is shared
|
||||||
|
shared_extension() {
|
||||||
|
[ -e "${ext_dir:?}/$1.so" ]
|
||||||
|
}
|
||||||
|
|
||||||
# Function to enable cached extensions.
|
# Function to enable cached extensions.
|
||||||
enable_cache_extension() {
|
enable_cache_extension() {
|
||||||
deps=()
|
deps=()
|
||||||
@ -129,7 +134,7 @@ enable_extension() {
|
|||||||
enable_extension_dependencies "$1" "$2"
|
enable_extension_dependencies "$1" "$2"
|
||||||
if [ -d /tmp/extcache/"$1" ]; then
|
if [ -d /tmp/extcache/"$1" ]; then
|
||||||
enable_cache_extension "$1" "$2"
|
enable_cache_extension "$1" "$2"
|
||||||
elif ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then
|
elif ! check_extension "$1" && shared_extension "$1"; then
|
||||||
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -164,13 +169,15 @@ disable_extension_dependents() {
|
|||||||
disable_extension() {
|
disable_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
if [ -e "${ext_dir:?}"/"$extension".so ]; then
|
if shared_extension "$extension"; then
|
||||||
disable_extension_helper "$extension" true
|
disable_extension_helper "$extension" true
|
||||||
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Disabled") ||
|
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Disabled") ||
|
||||||
add_log "${cross:?}" ":$extension" "Could not disable $extension on PHP ${semver:?}"
|
add_log "${cross:?}" ":$extension" "Could not disable $extension on PHP ${semver:?}"
|
||||||
else
|
else
|
||||||
add_log "${cross:?}" ":$extension" "Could not disable $extension on PHP $semver as it not a shared extension"
|
add_log "${cross:?}" ":$extension" "Could not disable $extension on PHP $semver as it not a shared extension"
|
||||||
fi
|
fi
|
||||||
|
elif shared_extension "$extension"; then
|
||||||
|
add_log "${tick:?}" ":$extension" "Disabled"
|
||||||
else
|
else
|
||||||
add_log "${tick:?}" ":$extension" "Could not find $extension on PHP $semver"
|
add_log "${tick:?}" ":$extension" "Could not find $extension on PHP $semver"
|
||||||
fi
|
fi
|
||||||
|
@ -6,7 +6,7 @@ add_blackfire() {
|
|||||||
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
|
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||||
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
||||||
blackfire_ini_file="${pecl_file:-${ini_file[@]}}"
|
blackfire_ini_file="${pecl_file:-${ini_file[@]}}"
|
||||||
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
if ! shared_extension blackfire; then
|
||||||
if [ "$extension_version" = "blackfire" ]; then
|
if [ "$extension_version" = "blackfire" ]; then
|
||||||
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
||||||
extension_version='1.50.0'
|
extension_version='1.50.0'
|
||||||
|
@ -7,11 +7,11 @@ add_license_log() {
|
|||||||
|
|
||||||
# Function to install ioncube.
|
# Function to install ioncube.
|
||||||
add_ioncube() {
|
add_ioncube() {
|
||||||
if [ ! -e "${ext_dir:?}/ioncube.so" ]; then
|
if ! shared_extension ioncube; then
|
||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
|
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
|
||||||
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
|
get -s -n "" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
|
||||||
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "$ext_dir/ioncube.so"
|
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "${ext_dir:?}/ioncube.so"
|
||||||
fi
|
fi
|
||||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
||||||
add_extension_log "ioncube" "$status"
|
add_extension_log "ioncube" "$status"
|
||||||
|
@ -35,7 +35,7 @@ add_client() {
|
|||||||
|
|
||||||
# Function to install oci8 and pdo_oci.
|
# Function to install oci8 and pdo_oci.
|
||||||
add_oci_helper() {
|
add_oci_helper() {
|
||||||
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
if ! shared_extension "$ext"; then
|
||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
read -r "${ext}_LINUX_LIBS" <<< "libaio-dev"
|
read -r "${ext}_LINUX_LIBS" <<< "libaio-dev"
|
||||||
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) --with-${ext/_/-}=instantclient,$oracle_client"
|
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) --with-${ext/_/-}=instantclient,$oracle_client"
|
||||||
|
@ -10,7 +10,7 @@ add_phalcon_helper() {
|
|||||||
|
|
||||||
# Function to add phalcon3.
|
# Function to add phalcon3.
|
||||||
add_phalcon3() {
|
add_phalcon3() {
|
||||||
if [ -e "${ext_dir:?}/phalcon.so" ]; then
|
if shared_extension phalcon; then
|
||||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
add_phalcon_helper
|
add_phalcon_helper
|
||||||
@ -24,10 +24,10 @@ add_phalcon3() {
|
|||||||
|
|
||||||
# Function to add phalcon4.
|
# Function to add phalcon4.
|
||||||
add_phalcon4() {
|
add_phalcon4() {
|
||||||
if [ -e "${ext_dir:?}/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
if shared_extension phalcon && ! php -m | grep -i -q -w psr; then
|
||||||
echo "extension=psr.so" | sudo tee -a "${ini_file:?}"
|
echo "extension=psr.so" | sudo tee -a "${ini_file:?}"
|
||||||
fi
|
fi
|
||||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
if shared_extension phalcon; then
|
||||||
if php -m | grep -i -q -w psr; then
|
if php -m | grep -i -q -w psr; then
|
||||||
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
|
@ -37,7 +37,7 @@ add_pdo_extension() {
|
|||||||
else
|
else
|
||||||
ext=$1
|
ext=$1
|
||||||
ext_name=$1
|
ext_name=$1
|
||||||
if [ -e "$ext_dir"/pdo.so ]; then
|
if shared_extension pdo; then
|
||||||
disable_extension_helper pdo
|
disable_extension_helper pdo
|
||||||
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
|
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -300,6 +300,8 @@ Function Disable-Extension() {
|
|||||||
} else {
|
} else {
|
||||||
Add-Log $cross ":$extension" "Could not disable $extension on PHP $($installed.FullVersion) as it not a shared extension"
|
Add-Log $cross ":$extension" "Could not disable $extension on PHP $($installed.FullVersion) as it not a shared extension"
|
||||||
}
|
}
|
||||||
|
} elseif(Test-Path $ext_dir\php_$extension.dll) {
|
||||||
|
Add-Log $tick ":$extension" "Disabled"
|
||||||
} else {
|
} else {
|
||||||
Add-Log $tick ":$extension" "Could not find $extension on PHP $($installed.FullVersion)"
|
Add-Log $tick ":$extension" "Could not find $extension on PHP $($installed.FullVersion)"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user