FIX: Remove all debug messages from php-analyzer functions
Removed echo statements to stderr that could interfere with function return values if captured together with stdout: - calculate_balanced_memory_allocation() - calculate_balanced_memory_allocation_per_domain() - Domain traffic analysis messages These could cause similar 'integer expression expected' errors if called with stderr capture (2>&1)
This commit is contained in:
@@ -1030,8 +1030,6 @@ calculate_server_memory_capacity() {
|
|||||||
# Usage: calculate_balanced_memory_allocation
|
# Usage: calculate_balanced_memory_allocation
|
||||||
# Returns: recommendations for each user to fit within system limits
|
# Returns: recommendations for each user to fit within system limits
|
||||||
calculate_balanced_memory_allocation() {
|
calculate_balanced_memory_allocation() {
|
||||||
echo "Calculating balanced memory allocation..." >&2
|
|
||||||
|
|
||||||
# Get total system memory
|
# Get total system memory
|
||||||
local total_ram_mb
|
local total_ram_mb
|
||||||
total_ram_mb=$(free -m | awk '/^Mem:/ {print $2}')
|
total_ram_mb=$(free -m | awk '/^Mem:/ {print $2}')
|
||||||
@@ -1167,8 +1165,6 @@ calculate_balanced_memory_allocation() {
|
|||||||
# Usage: calculate_balanced_memory_allocation_per_domain
|
# Usage: calculate_balanced_memory_allocation_per_domain
|
||||||
# Returns: recommendations for each domain to fit within system limits
|
# Returns: recommendations for each domain to fit within system limits
|
||||||
calculate_balanced_memory_allocation_per_domain() {
|
calculate_balanced_memory_allocation_per_domain() {
|
||||||
echo "Calculating per-domain balanced memory allocation (cPanel)..." >&2
|
|
||||||
|
|
||||||
# Verify this is cPanel
|
# Verify this is cPanel
|
||||||
if [ "$SYS_CONTROL_PANEL" != "cpanel" ]; then
|
if [ "$SYS_CONTROL_PANEL" != "cpanel" ]; then
|
||||||
echo "ERROR|This function only supports cPanel. Use calculate_balanced_memory_allocation for other panels."
|
echo "ERROR|This function only supports cPanel. Use calculate_balanced_memory_allocation for other panels."
|
||||||
@@ -1268,8 +1264,6 @@ calculate_balanced_memory_allocation_per_domain() {
|
|||||||
domain_memory[$domain]=$((avg_kb / 1024))
|
domain_memory[$domain]=$((avg_kb / 1024))
|
||||||
|
|
||||||
# Get advanced traffic stats for this domain (7-day, bot-filtered, 95th percentile)
|
# Get advanced traffic stats for this domain (7-day, bot-filtered, 95th percentile)
|
||||||
echo " Analyzing traffic for $domain..." >&2
|
|
||||||
|
|
||||||
local traffic
|
local traffic
|
||||||
# Try fast method first (current process count)
|
# Try fast method first (current process count)
|
||||||
local current_processes
|
local current_processes
|
||||||
@@ -1278,7 +1272,6 @@ calculate_balanced_memory_allocation_per_domain() {
|
|||||||
if [ "$current_processes" -gt 0 ]; then
|
if [ "$current_processes" -gt 0 ]; then
|
||||||
# Use current process count as baseline (fast, no log parsing)
|
# Use current process count as baseline (fast, no log parsing)
|
||||||
traffic=$((current_processes * 2)) # Assume processes can handle ~2 req/min each
|
traffic=$((current_processes * 2)) # Assume processes can handle ~2 req/min each
|
||||||
echo " Using current process count: $current_processes processes" >&2
|
|
||||||
else
|
else
|
||||||
# Fallback to traffic analysis only if no processes found
|
# Fallback to traffic analysis only if no processes found
|
||||||
local traffic_stats
|
local traffic_stats
|
||||||
|
|||||||
Reference in New Issue
Block a user