REFACTOR: Class D modules - Panel-specific conditionals
Completed Class D refactoring (panel-specific modules). MODULES REFACTORED: 1. enable-cphulk.sh (ALREADY COMPLIANT) - Already checks SYS_CONTROL_PANEL at startup (line 35) - Exits gracefully if not cPanel - Shows detected panel in error message - All whmapi1 calls only reachable after panel check - No changes needed ✅ 2. system-health-check.sh (ENHANCED) - Already had conditional checks for CPHulk (lines 606, 1706) - Enhanced control panel version detection (line 940-947) - Now uses SYS_CONTROL_PANEL_VERSION from system-detect.sh - Supports cPanel, Plesk, InterWorx version reporting - All panel-specific features properly gated ARCHITECTURE COMPLIANCE: ✅ Panel-specific features wrapped in conditionals ✅ Graceful degradation when feature unavailable ✅ Clear error messages mentioning panel requirements ✅ Uses system-detect.sh variables ✅ All syntax validated VERIFIED COMPLIANT: ✅ mysql-query-analyzer.sh - Already uses get_user_databases() TESTING: - Both modules passed `bash -n` syntax check - enable-cphulk.sh will exit gracefully on non-cPanel - system-health-check.sh will skip cPanel features on other panels PROGRESS UPDATE: - Class A: ✅ 7 modules (no changes needed) - Class B: ✅ 6/6 modules COMPLETE - Class C: ✅ 3/6 modules (bot-analyzer, malware-scanner, mysql-query) - Class D: ✅ 2/2 modules COMPLETE - Acronis: ✅ 13 modules (no changes needed) Total: 31/38 modules architecture-compliant! Remaining: 7 modules (website error analyzers + WordPress)
This commit is contained in:
@@ -937,12 +937,13 @@ System may be vulnerable" \
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for cPanel updates (if cPanel)
|
# Check for control panel version
|
||||||
if [ -f "/usr/local/cpanel/version" ]; then
|
if [ "$SYS_CONTROL_PANEL" = "cpanel" ] && [ -n "$SYS_CONTROL_PANEL_VERSION" ]; then
|
||||||
local cpanel_version=$(cat /usr/local/cpanel/version)
|
echo "cPanel version: $SYS_CONTROL_PANEL_VERSION" >> "$TEMP_DIR/system_info.txt"
|
||||||
# Note: We can't easily check if update is available without WHM API
|
elif [ "$SYS_CONTROL_PANEL" = "plesk" ] && [ -n "$SYS_CONTROL_PANEL_VERSION" ]; then
|
||||||
# Just record the version
|
echo "Plesk version: $SYS_CONTROL_PANEL_VERSION" >> "$TEMP_DIR/system_info.txt"
|
||||||
echo "cPanel version: $cpanel_version" >> "$TEMP_DIR/system_info.txt"
|
elif [ "$SYS_CONTROL_PANEL" = "interworx" ] && [ -n "$SYS_CONTROL_PANEL_VERSION" ]; then
|
||||||
|
echo "InterWorx version: $SYS_CONTROL_PANEL_VERSION" >> "$TEMP_DIR/system_info.txt"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user