Skip to content

Commit

Permalink
Fix enable extension
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Mar 6, 2021
1 parent 113fcc6 commit 890ea4b
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/scripts/common.sh
Expand Up @@ -104,12 +104,34 @@ check_extension() {
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.
enable_extension() {
if [ -e /tmp/setup_php_dismod ] && grep -q "$1" /tmp/setup_php_dismod; then
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
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
fi
}
Expand Down

0 comments on commit 890ea4b

Please sign in to comment.