From 9b0a145b531ff3aa4a22d8be2bbf796ce8ef4236 Mon Sep 17 00:00:00 2001 From: cschantz Date: Tue, 23 Dec 2025 21:06:44 -0500 Subject: [PATCH] CRITICAL BUG #3: SYS_USER_HOME_BASE reset to empty after detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root Cause: User reported SYS_USER_HOME_BASE was empty on Plesk server even though Plesk detection was working correctly. Found variable initialization happening AFTER detection completes, overwriting the value. The Bug (lines 15-32): if [ -z "$SYS_DETECTION_COMPLETE" ]; then export SYS_CONTROL_PANEL="" ... export SYS_LOG_DIR="" fi export SYS_USER_HOME_BASE="" # ← LINE 27 OUTSIDE CONDITIONAL! export SYS_PHP_VERSIONS=() ... Execution Flow: 1. Detection runs, sets SYS_USER_HOME_BASE="/var/www/vhosts" 2. Script continues, hits line 27 3. Line 27 UNCONDITIONALLY resets SYS_USER_HOME_BASE="" 4. Result: Variable is empty even though Plesk was detected Impact: - WordPress search used empty path instead of /var/www/vhosts - Reference DB couldn't find WordPress installations - Any code using SYS_USER_HOME_BASE got empty string The Fix: Moved lines 27-32 INSIDE the conditional block (lines 26-31): if [ -z "$SYS_DETECTION_COMPLETE" ]; then export SYS_CONTROL_PANEL="" ... export SYS_LOG_DIR="" export SYS_USER_HOME_BASE="" # Now only runs once export SYS_PHP_VERSIONS=() export SYS_CLOUDFLARE_ACTIVE="" export SYS_FIREWALL="" export SYS_FIREWALL_VERSION="" export SYS_FIREWALL_ACTIVE="" fi Now variables are only initialized once on first detection, not reset every time system-detect.sh is sourced. Verified: User's output showed SYS_CONTROL_PANEL="plesk" but SYS_USER_HOME_BASE was empty. This fix ensures both are set. Status: CRITICAL BUG #3 FIXED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- lib/system-detect.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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