From c2d005d74d68190a27c8d99974bd8c531e3905b5 Mon Sep 17 00:00:00 2001 From: cschantz Date: Wed, 3 Dec 2025 01:22:34 -0500 Subject: [PATCH] Enhance analyze_all_domains output to show passed checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users requested visibility into what was checked and found OK, not just failures. Changes: - Show issue breakdown by severity (CRITICAL, HIGH, MEDIUM, LOW) - Display which checks passed (max_children OK, memory OK, timeouts OK) - For domains with no issues: 'All checks passed (max_children, memory, timeouts, config)' - Color-coded summary for better readability Example output: [1] Analyzing: pickledperil.com ✗ Issues found: 1 HIGH [HIGH] PERFORMANCE: OPcache is disabled ✓ Checks passed: max_children OK, memory OK, timeouts OK --- modules/performance/php-optimizer.sh | 39 +++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/modules/performance/php-optimizer.sh b/modules/performance/php-optimizer.sh index 26cdacc..83edf51 100755 --- a/modules/performance/php-optimizer.sh +++ b/modules/performance/php-optimizer.sh @@ -210,15 +210,29 @@ analyze_all_domains() { local issues issues=$(detect_php_config_issues "$username" "$domain") - # Count critical/high severity issues - local critical_count - critical_count=$(echo "$issues" | grep -c "CRITICAL\|HIGH" || echo "0") + # Count issues by severity + local critical_count high_count medium_count low_count + critical_count=$(echo "$issues" | grep -c "^[^|]*|CRITICAL|" || echo "0") + high_count=$(echo "$issues" | grep -c "^[^|]*|HIGH|" || echo "0") + medium_count=$(echo "$issues" | grep -c "^[^|]*|MEDIUM|" || echo "0") + low_count=$(echo "$issues" | grep -c "^[^|]*|LOW|" || echo "0") - if [ "$critical_count" -gt 0 ]; then + local total_issues=$((critical_count + high_count + medium_count + low_count)) + + if [ "$total_issues" -gt 0 ]; then domains_with_issues=$((domains_with_issues + 1)) - cecho " ${RED}✗ $critical_count critical/high severity issues detected${NC}" - # Show issues + # Build issue summary + local issue_summary="" + [ "$critical_count" -gt 0 ] && issue_summary+="${RED}$critical_count CRITICAL${NC}, " + [ "$high_count" -gt 0 ] && issue_summary+="${YELLOW}$high_count HIGH${NC}, " + [ "$medium_count" -gt 0 ] && issue_summary+="$medium_count MEDIUM, " + [ "$low_count" -gt 0 ] && issue_summary+="$low_count LOW, " + issue_summary=${issue_summary%, } # Remove trailing comma + + cecho " ${RED}✗${NC} Issues found: $issue_summary" + + # Show critical/high issues while IFS='|' read -r issue_type severity message recommendation; do [ -z "$issue_type" ] && continue @@ -226,8 +240,19 @@ analyze_all_domains() { cecho " ${RED}[$severity]${NC} $issue_type: $message" fi done <<< "$issues" + + # Show what passed + local checks_passed="" + echo "$issues" | grep -q "max_children" || checks_passed+="max_children OK, " + echo "$issues" | grep -q "memory_exhausted" || checks_passed+="memory OK, " + echo "$issues" | grep -q "execution timeout" || checks_passed+="timeouts OK, " + + if [ -n "$checks_passed" ]; then + checks_passed=${checks_passed%, } + cecho " ${GREEN}✓${NC} Checks passed: $checks_passed" + fi else - cecho " ${GREEN}✓ No critical issues${NC}" + cecho " ${GREEN}✓ All checks passed${NC} (max_children, memory, timeouts, config)" fi echo ""