Enhance analyze_all_domains output to show passed checks

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
This commit is contained in:
cschantz
2025-12-03 01:22:34 -05:00
parent 46803f52f7
commit b2e6af9f5e
+32 -7
View File
@@ -210,15 +210,29 @@ analyze_all_domains() {
local issues local issues
issues=$(detect_php_config_issues "$username" "$domain") issues=$(detect_php_config_issues "$username" "$domain")
# Count critical/high severity issues # Count issues by severity
local critical_count local critical_count high_count medium_count low_count
critical_count=$(echo "$issues" | grep -c "CRITICAL\|HIGH" || echo "0") 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)) 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 while IFS='|' read -r issue_type severity message recommendation; do
[ -z "$issue_type" ] && continue [ -z "$issue_type" ] && continue
@@ -226,8 +240,19 @@ analyze_all_domains() {
cecho " ${RED}[$severity]${NC} $issue_type: $message" cecho " ${RED}[$severity]${NC} $issue_type: $message"
fi fi
done <<< "$issues" 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 else
cecho " ${GREEN}No critical issues${NC}" cecho " ${GREEN}All checks passed${NC} (max_children, memory, timeouts, config)"
fi fi
echo "" echo ""