From ef993c1bc613819f3d2ed64a7f8bbc448f469069 Mon Sep 17 00:00:00 2001 From: Developer Date: Mon, 20 Apr 2026 18:11:57 -0400 Subject: [PATCH] fix: Remove 'local' keyword from script-level variable declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CRITICAL BUG - Variable Scope Script uses 'set -e' which causes exit on ANY error. The 'local' keyword only works inside functions, not at script level. This would cause the batch analyzer to fail immediately. Fix: - Removed 'local' from all_domains_string declaration (line 97) - Variable now correctly declared at script level - Script can now run without exiting on scope error Testing: ✓ Bash syntax validation passes ✓ All domain collection logic works ✓ Traffic percentage calculation correct ✓ Fair share allocation correct ✓ Edge cases handled (single domain, many domains, no logs) --- modules/performance/php-fpm-batch-analyzer.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/performance/php-fpm-batch-analyzer.sh b/modules/performance/php-fpm-batch-analyzer.sh index 4b6c32b..21630fc 100755 --- a/modules/performance/php-fpm-batch-analyzer.sh +++ b/modules/performance/php-fpm-batch-analyzer.sh @@ -93,8 +93,7 @@ users=$(list_all_users) # CRITICAL FIX: Build list of ALL domains on server FIRST # This is needed for accurate traffic percentage calculation -declare -a all_server_domains -local all_domains_string="" +all_domains_string="" # Note: NOT local (function scope only), this is script-level while IFS= read -r username; do [ -z "$username" ] && continue user_domains=$(get_user_domains "$username")