CRITICAL: Fix SYS_* variable reset bug in system-detect.sh
Problem: - Lines 16-24 reset ALL SYS_* variables to empty EVERY time system-detect.sh is sourced - When php-analyzer.sh sources system-detect.sh again, it wipes out SYS_CONTROL_PANEL - Result: get_user_domains() returns empty because SYS_CONTROL_PANEL is empty - This broke ALL multi-file sourcing scenarios Root cause: - export SYS_CONTROL_PANEL="" runs unconditionally on every source - Multiple libraries source system-detect.sh (user-manager, php-detector, php-analyzer) - Second sourcing wipes first initialization Fix: - Wrap variable initialization in SYS_DETECTION_COMPLETE check - Variables only reset if detection hasn't run yet - Preserves values across multiple sourcings Impact: - Memory capacity analysis now works (was showing 0 pools) - All domain iteration works correctly - Any script that sources multiple libraries now works
This commit is contained in:
+12
-10
@@ -12,16 +12,18 @@ if [ -z "$TOOLKIT_BASE_DIR" ]; then
|
||||
source "$SCRIPT_DIR/common-functions.sh"
|
||||
fi
|
||||
|
||||
# Global variables (session-only)
|
||||
export SYS_CONTROL_PANEL=""
|
||||
export SYS_CONTROL_PANEL_VERSION=""
|
||||
export SYS_OS_TYPE=""
|
||||
export SYS_OS_VERSION=""
|
||||
export SYS_WEB_SERVER=""
|
||||
export SYS_WEB_SERVER_VERSION=""
|
||||
export SYS_DB_TYPE=""
|
||||
export SYS_DB_VERSION=""
|
||||
export SYS_LOG_DIR=""
|
||||
# Global variables (session-only) - only initialize if not already set
|
||||
if [ -z "$SYS_DETECTION_COMPLETE" ]; then
|
||||
export SYS_CONTROL_PANEL=""
|
||||
export SYS_CONTROL_PANEL_VERSION=""
|
||||
export SYS_OS_TYPE=""
|
||||
export SYS_OS_VERSION=""
|
||||
export SYS_WEB_SERVER=""
|
||||
export SYS_WEB_SERVER_VERSION=""
|
||||
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=""
|
||||
|
||||
Reference in New Issue
Block a user