CORRECTED FIX: Properly handle SYS_USER_HOME_BASE initialization

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
This commit is contained in:
cschantz
2025-12-23 21:14:23 -05:00
parent 9046f56838
commit 65c523f005
2 changed files with 7 additions and 6 deletions
+1
View File
@@ -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"
+6 -6
View File
@@ -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