FIX: Correct undefined TOTAL_RAM_MB variable in optimize_level_5_everything

In the optimize_level_5_everything() function, two instances of
$TOTAL_RAM_MB (uppercase, undefined) were being passed to functions
instead of $total_ram_mb (lowercase, locally defined from server capacity).

This would cause the functions to receive empty values, leading to
calculation failures or hangs.

Fixed:
- Line 2675: calculate_server_capacity call
- Line 2756: calculate_optimal_php_settings_intelligent call

The variable $total_ram_mb is correctly defined on line 2650 and should
be used throughout the function.
This commit is contained in:
Developer
2026-04-20 21:32:47 -04:00
parent cf391147bf
commit 729583581c
+2 -2
View File
@@ -2672,7 +2672,7 @@ optimize_level_5_everything() {
# Calculate server capacity for fair share allocation # Calculate server capacity for fair share allocation
local server_capacity_result local server_capacity_result
server_capacity_result=$(calculate_server_capacity "$TOTAL_RAM_MB") server_capacity_result=$(calculate_server_capacity "$total_ram_mb")
local server_capacity local server_capacity
server_capacity=$(echo "$server_capacity_result" | cut -d'|' -f1) server_capacity=$(echo "$server_capacity_result" | cut -d'|' -f1)
local server_memory_per_process local server_memory_per_process
@@ -2753,7 +2753,7 @@ optimize_level_5_everything() {
# Call intelligent three-constraint function # Call intelligent three-constraint function
local intel_result local intel_result
intel_result=$(calculate_optimal_php_settings_intelligent "$username" "$TOTAL_RAM_MB" "$server_capacity" "$traffic_pct" 2>/dev/null || echo "20|dynamic|1|5|ERROR|Failed") intel_result=$(calculate_optimal_php_settings_intelligent "$username" "$total_ram_mb" "$server_capacity" "$traffic_pct" 2>/dev/null || echo "20|dynamic|1|5|ERROR|Failed")
recommended_max=$(echo "$intel_result" | cut -d'|' -f1) recommended_max=$(echo "$intel_result" | cut -d'|' -f1)
recommended_memory=$(calculate_optimal_memory_limit "$username" "$domain" "$recommended_max" 2>/dev/null || echo "128M") recommended_memory=$(calculate_optimal_memory_limit "$username" "$domain" "$recommended_max" 2>/dev/null || echo "128M")