Fix extension setup

This commit is contained in:
Shivam Mathur 2021-06-04 21:28:54 +05:30
parent e9a7adef28
commit 6dba529f13
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 3 additions and 7 deletions

View File

@ -126,9 +126,8 @@ enable_cache_extension() {
# 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
modules_dir="/var/lib/php/modules/$version"
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
if [ -d /tmp/extcache/"$1" ]; then
enable_cache_extension "$1" "$2"
elif ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then

View File

@ -57,9 +57,7 @@ delete_extension() {
extension=$1
disable_extension "$extension"
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
if [ "${runner:?}" = "self-hosted" ]; then
$apt_remove "php-$extension" "php$version-$extension" >/dev/null 2>&1 || true
fi
sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
}
# Function to disable and delete extensions.
@ -68,7 +66,6 @@ remove_extension() {
if check_extension "$extension"; then
if [[ ! "$version" =~ ${old_versions:?} ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
sudo phpdismod -v "$version" "$extension" >/dev/null 2>&1
echo "$extension" | sudo tee -a /tmp/setup_php_dismod >/dev/null 2>&1
fi
delete_extension "$extension"
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||