From 1e119b6d1a5d185211cfbc2bbc72606d5ac13f2b Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 5 Jan 2021 16:52:41 +0530 Subject: [PATCH] Fix add_pdo_extension in linux.sh --- src/scripts/linux.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index 2c397b76..a1e6c4be 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -45,12 +45,19 @@ install_packages() { $apt_install "${packages[@]}" >/dev/null 2>&1 || update_lists && $apt_install "${packages[@]}" >/dev/null 2>&1 } -# Function to delete extensions. -delete_extension() { +# Function to disable an extension. +disable_extension() { extension=$1 sudo sed -Ei "/=(.*\/)?\"?$extension/d" "${ini_file[@]}" sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file" - sudo rm -rf "$scan_dir"/*"$extension"* "$ext_dir"/"$extension".so >/dev/null 2>&1 + sudo find "$ini_dir"/.. -name "*$extension.ini" -delete >/dev/null 2>&1 || true +} + +# Function to delete an extension. +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 @@ -81,8 +88,8 @@ add_pdo_extension() { else ext=$1 ext_name=$1 - sudo rm -rf "$scan_dir"/*pdo.ini >/dev/null 2>&1 - if ! check_extension "pdo" 2>/dev/null; then echo "extension=pdo.so" | sudo tee -a "${ini_file[@]}" >/dev/null 2>&1; fi + disable_extension pdo + echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1 if [ "$ext" = "mysql" ]; then enable_extension "mysqlnd" "extension" ext_name="mysqli"