mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Fix enable extension
This commit is contained in:
parent
113fcc64e3
commit
890ea4bca9
@ -104,12 +104,34 @@ check_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to enable cached extensions.
|
||||||
|
enable_cache_extension() {
|
||||||
|
deps=()
|
||||||
|
for ext in /tmp/extcache/"$1"/*; do
|
||||||
|
deps+=("$(basename "$ext")")
|
||||||
|
done
|
||||||
|
if [ "x${deps[*]}" = "x" ]; then
|
||||||
|
sudo rm -rf /tmp/extcache/"$1"
|
||||||
|
enable_extension "$1" "$2"
|
||||||
|
else
|
||||||
|
deps+=("$1")
|
||||||
|
if php "${deps[@]/#/-d ${2}=}" -m 2>/dev/null | grep -i -q "$1"; then
|
||||||
|
for ext in "${deps[@]}"; do
|
||||||
|
sudo rm -rf /tmp/extcache/"$ext"
|
||||||
|
enable_extension "$ext" "$2"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to enable existing extensions.
|
# Function to enable existing extensions.
|
||||||
enable_extension() {
|
enable_extension() {
|
||||||
if [ -e /tmp/setup_php_dismod ] && grep -q "$1" /tmp/setup_php_dismod; then
|
if [ -e /tmp/setup_php_dismod ] && grep -q "$1" /tmp/setup_php_dismod; then
|
||||||
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
|
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
if ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then
|
if [ -d /tmp/extcache/"$1" ]; then
|
||||||
|
enable_cache_extension "$1" "$2"
|
||||||
|
elif ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; 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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user