Compare commits

...

2 Commits

Author SHA1 Message Date
cschantz 9b0a145b53 CRITICAL BUG #3: SYS_USER_HOME_BASE reset to empty after detection
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 <noreply@anthropic.com>
2025-12-23 21:06:44 -05:00
cschantz 097bad22d8 CRITICAL FIX: launcher.sh never loaded domain-discovery.sh
Root Cause #2:
After fixing the $LIB_DIR bug in system-detect.sh, discovered launcher.sh
was missing domain-discovery.sh from its source list.

The Bug:
launcher.sh lines 20-23 sourced:
  - common-functions.sh
  - system-detect.sh
  - user-manager.sh
  - reference-db.sh

But NOT domain-discovery.sh!

Since launcher.sh sets TOOLKIT_BASE_DIR, reference-db.sh's conditional
sourcing (lines 10-16) was skipped:
  if [ -z "$TOOLKIT_BASE_DIR" ]; then
      source "$SCRIPT_DIR/domain-discovery.sh"  # NEVER RAN
  fi

Impact:
ALL unified discovery functions were unavailable:
- list_all_domains()
- get_domain_owner()
- get_domain_docroot()
- get_domain_logdir()
- get_domain_access_log()
- And 8 more...

Result: reference-db.sh build_domains_section() called list_all_domains()
which didn't exist → 0 domains on BOTH cPanel AND Plesk!

The Fix:
Added domain-discovery.sh to launcher.sh line 22:
  source "$LIB_DIR/domain-discovery.sh"

Now sourced BEFORE reference-db.sh so all unified functions available.

Verified on cPanel:
  ✓ list_all_domains available
  ✓ get_domain_owner available
  ✓ get_domain_docroot available
  ✓ list_all_domains() returns pickledperil.com

Status: CRITICAL BUG #2 FIXED - Ready for Plesk testing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-23 20:58:30 -05:00
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"
+1 -1
View File
@@ -23,13 +23,13 @@ if [ -z "$SYS_DETECTION_COMPLETE" ]; then
export SYS_DB_TYPE=""
export SYS_DB_VERSION=""
export SYS_LOG_DIR=""
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=""
fi
#############################################################################
# CONTROL PANEL DETECTION