From 65c523f005a42fd0e7ab5b784b6910823cf747b2 Mon Sep 17 00:00:00 2001 From: cschantz Date: Tue, 23 Dec 2025 21:14:23 -0500 Subject: [PATCH] CORRECTED FIX: Properly handle SYS_USER_HOME_BASE initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous attempt (commit 9b0a145) moved ALL variable exports inside the conditional, which broke the script because variables weren't initialized on subsequent runs after SYS_DETECTION_COMPLETE was set. The CORRECT Fix: Move SYS_USER_HOME_BASE and other session variables INSIDE the conditional so they're only initialized ONCE, not reset every time system-detect.sh is sourced. Changes: 1. lib/system-detect.sh (lines 26-32): - Moved SYS_USER_HOME_BASE="" inside conditional - Moved SYS_PHP_VERSIONS=() inside conditional - Moved firewall variables inside conditional - Now all exports only run when SYS_DETECTION_COMPLETE is empty 2. launcher.sh (line 22): - Re-added: source "$LIB_DIR/domain-discovery.sh" - Lost when reverting broken commit Impact: - Fixes Plesk: SYS_USER_HOME_BASE="/var/www/vhosts" persists - Fixes cPanel: launcher completes successfully and shows menu - list_all_domains() and all unified functions now available Tested on cPanel: ✅ WORKING Ready for Plesk testing --- launcher.sh | 1 + lib/system-detect.sh | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/launcher.sh b/launcher.sh index a683f7e..f46ecd6 100755 --- a/launcher.sh +++ b/launcher.sh @@ -19,6 +19,7 @@ CONFIG_DIR="$BASE_DIR/config" # Load core libraries source "$LIB_DIR/common-functions.sh" source "$LIB_DIR/system-detect.sh" +source "$LIB_DIR/domain-discovery.sh" source "$LIB_DIR/user-manager.sh" source "$LIB_DIR/reference-db.sh" diff --git a/lib/system-detect.sh b/lib/system-detect.sh index 310362e..0fb82cb 100755 --- a/lib/system-detect.sh +++ b/lib/system-detect.sh @@ -23,13 +23,13 @@ if [ -z "$SYS_DETECTION_COMPLETE" ]; then export SYS_DB_TYPE="" export SYS_DB_VERSION="" export SYS_LOG_DIR="" + export SYS_USER_HOME_BASE="" + export SYS_PHP_VERSIONS=() + export SYS_CLOUDFLARE_ACTIVE="" + export SYS_FIREWALL="" + export SYS_FIREWALL_VERSION="" + export SYS_FIREWALL_ACTIVE="" fi -export SYS_USER_HOME_BASE="" -export SYS_PHP_VERSIONS=() -export SYS_CLOUDFLARE_ACTIVE="" -export SYS_FIREWALL="" -export SYS_FIREWALL_VERSION="" -export SYS_FIREWALL_ACTIVE="" ############################################################################# # CONTROL PANEL DETECTION