Improve diagnostics display: group by issue pattern, not by domain
Problem: Showing 86 "unique issues" when actually many domains have the same .htaccess error was overwhelming and hard to read. For example, 14 airmarkoverhaul.com subdomains all had identical .htaccess issues. Solution: Reorganize to group by issue pattern, showing affected domains: New format: Issue: PHP directives incompatible with FPM; Malformed RewriteRule... Affected (14): airmarkengines.com, airmarkinc.com, airmarkoh.com, ... Benefits: - Shows actual unique issue patterns (not domain+issue combos) - Lists up to 5 affected domains per issue - Shows domain count for each issue pattern - Limits to 10 issue patterns per cause type - Much more readable and actionable Instead of scrolling through 86 nearly-identical lines, you now see the unique problems and which domains are affected by each. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -743,28 +743,60 @@ echo " SPECIFIC DIAGNOSTICS (per URL/file)"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
|
||||
# Show detailed diagnostics grouped by cause - deduplicate by domain+url+issue
|
||||
# Show detailed diagnostics grouped by cause and issue pattern
|
||||
if [ -f "$DETAILED_DIAGNOSIS" ] && [ -s "$DETAILED_DIAGNOSIS" ]; then
|
||||
for cause_type in PHP_MEMORY_EXHAUSTED PERMISSION_ERROR HTACCESS_ERROR PHP_FATAL_ERROR PHP_SYNTAX_ERROR MISSING_PHP_FUNCTION DATABASE_CONNECTION FILE_NOT_FOUND PHP_HANDLER_ERROR WP_DEBUG_ERROR DOCROOT_MISSING; do
|
||||
# Get unique diagnostics (deduplicate identical domain+issue combinations)
|
||||
unique_diags=$(grep "^${cause_type}|" "$DETAILED_DIAGNOSIS" 2>/dev/null | cut -d'|' -f2 | sort -u)
|
||||
cause_count=$(echo "$unique_diags" | grep -c "^" 2>/dev/null || echo "0")
|
||||
|
||||
if [ "$cause_count" -gt 0 ] && [ -n "$unique_diags" ]; then
|
||||
cause_count=$(grep -c "^${cause_type}|" "$DETAILED_DIAGNOSIS" 2>/dev/null || echo "0")
|
||||
|
||||
if [ "$cause_count" -gt 0 ]; then
|
||||
cause_display=$(echo "$cause_type" | tr '_' ' ')
|
||||
echo -e "${RED}${BOLD}$cause_display ($cause_count unique issues)${NC}"
|
||||
echo -e "${RED}${BOLD}$cause_display ($cause_count occurrences)${NC}"
|
||||
echo ""
|
||||
|
||||
echo "$unique_diags" | head -20 | while read -r diag_line; do
|
||||
[ -z "$diag_line" ] && continue
|
||||
echo -e " ${YELLOW}•${NC} $diag_line"
|
||||
# Group by unique error pattern (not domain)
|
||||
declare -A issue_domains
|
||||
|
||||
while IFS='|' read -r ctype full_diag; do
|
||||
# Extract just the error part (after domain/)
|
||||
issue_pattern=$(echo "$full_diag" | sed 's/^[^ ]* - //')
|
||||
domain_part=$(echo "$full_diag" | grep -oP '^[^/]+')
|
||||
|
||||
# Group domains with same issue
|
||||
if [ -z "${issue_domains[$issue_pattern]}" ]; then
|
||||
issue_domains[$issue_pattern]="$domain_part"
|
||||
else
|
||||
# Count how many domains (limit to first 5)
|
||||
count=$(echo "${issue_domains[$issue_pattern]}" | tr ',' '\n' | wc -l)
|
||||
if [ "$count" -lt 5 ]; then
|
||||
issue_domains[$issue_pattern]="${issue_domains[$issue_pattern]},$domain_part"
|
||||
elif [ "$count" -eq 5 ]; then
|
||||
issue_domains[$issue_pattern]="${issue_domains[$issue_pattern]},..."
|
||||
fi
|
||||
fi
|
||||
done < <(grep "^${cause_type}|" "$DETAILED_DIAGNOSIS" 2>/dev/null)
|
||||
|
||||
# Display grouped issues
|
||||
shown=0
|
||||
for pattern in "${!issue_domains[@]}"; do
|
||||
[ $shown -ge 10 ] && break
|
||||
((shown++))
|
||||
|
||||
domains="${issue_domains[$pattern]}"
|
||||
domain_count=$(echo "$domains" | tr ',' '\n' | grep -v '^\.\.\.$' | wc -l)
|
||||
|
||||
echo -e " ${YELLOW}Issue:${NC} $pattern"
|
||||
echo -e " ${DIM}Affected ($domain_count):${NC} ${domains//,/, }"
|
||||
echo ""
|
||||
done
|
||||
|
||||
if [ "$cause_count" -gt 20 ]; then
|
||||
remaining=$((cause_count - 20))
|
||||
echo -e " ${DIM}... and $remaining more${NC}"
|
||||
if [ "${#issue_domains[@]}" -gt 10 ]; then
|
||||
remaining=$((${#issue_domains[@]} - 10))
|
||||
echo -e " ${DIM}... and $remaining more issue patterns${NC}"
|
||||
echo ""
|
||||
fi
|
||||
echo ""
|
||||
|
||||
unset issue_domains
|
||||
fi
|
||||
done
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user