From 496dbf4f17567892ba4f695c9f45de0be3e8d54d Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 20 Mar 2026 01:26:45 -0400 Subject: [PATCH] Fix: Remove 'local' keyword from global scope (CRITICAL) CRITICAL FIXES: - Line 164: Remove 'local' from memory_reduction variable (global scope) - Line 173: Remove 'local' from has_traffic variable (global scope) Issue: 'local' keyword can only be used inside function definitions. Using 'local' in global scope causes 'local: can only be used in a function' runtime error and script failure. RESULTS: - 2 CRITICAL issues fixed - Script now runs without global scope errors --- modules/performance/php-fpm-batch-analyzer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/performance/php-fpm-batch-analyzer.sh b/modules/performance/php-fpm-batch-analyzer.sh index bea6e57..3e9a34b 100755 --- a/modules/performance/php-fpm-batch-analyzer.sh +++ b/modules/performance/php-fpm-batch-analyzer.sh @@ -161,7 +161,7 @@ while IFS= read -r username; do # Determine if optimization needed # Flag as YES if: different from current (increase or decrease) # AND has meaningful traffic (>= 5 concurrent) OR memory efficiency gain (> 20% reduction) - local memory_reduction=0 + memory_reduction=0 if [ "$recommended" -lt "$current" ]; then memory_reduction=$(( (current - recommended) * 100 / current )) fi @@ -170,7 +170,7 @@ while IFS= read -r username; do # Check if change is meaningful: # 1. Has significant traffic (>= 5 concurrent requests) # 2. OR significant memory reduction (>= 20%) - local has_traffic=0 + has_traffic=0 [ "$peak" != "?" ] && [ "$peak" -ge 5 ] && has_traffic=1 if [ "$has_traffic" = "1" ] || [ "$memory_reduction" -ge 20 ]; then