diff --git a/modules/performance/php-optimizer.sh b/modules/performance/php-optimizer.sh index 247f4a5..13cd099 100755 --- a/modules/performance/php-optimizer.sh +++ b/modules/performance/php-optimizer.sh @@ -2494,6 +2494,18 @@ optimize_level_5_everything() { local users users=$(list_all_users) + # CRITICAL FIX: Build list of ALL domains on server FIRST + # This is needed for accurate traffic percentage calculation (same as batch analyzer) + all_domains_string="" + while IFS= read -r u; do + [ -z "$u" ] && continue + u_domains=$(get_user_domains "$u") + while IFS= read -r d; do + [ -z "$d" ] && continue + all_domains_string="$all_domains_string$d"$'\n' + done <<< "$u_domains" + done <<< "$users" + while IFS= read -r username; do [ -z "$username" ] && continue local user_domains @@ -2527,7 +2539,8 @@ optimize_level_5_everything() { recommended_requests=$(get_max_requests_recommendation "$domain") else # Use intelligent three-constraint model - traffic_pct=$(get_domain_traffic_percentage "$username" "$domain" "$user_domains" 2>/dev/null | cut -d'|' -f1) + # CRITICAL FIX: Pass ALL server domains, not just user's domains! + traffic_pct=$(get_domain_traffic_percentage "$username" "$domain" "$all_domains_string" 2>/dev/null | cut -d'|' -f1) traffic_pct=${traffic_pct:-50} # Call intelligent three-constraint function