fix: Remove 'local' keyword from script-level variable declaration

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)
This commit is contained in:
Developer
2026-04-20 18:11:57 -04:00
parent 2ab02fdc50
commit ef993c1bc6
@@ -93,8 +93,7 @@ users=$(list_all_users)
# CRITICAL FIX: Build list of ALL domains on server FIRST # CRITICAL FIX: Build list of ALL domains on server FIRST
# This is needed for accurate traffic percentage calculation # This is needed for accurate traffic percentage calculation
declare -a all_server_domains all_domains_string="" # Note: NOT local (function scope only), this is script-level
local all_domains_string=""
while IFS= read -r username; do while IFS= read -r username; do
[ -z "$username" ] && continue [ -z "$username" ] && continue
user_domains=$(get_user_domains "$username") user_domains=$(get_user_domains "$username")