From 49cee3650b20825e83ec9bfa362a6e858ace0594 Mon Sep 17 00:00:00 2001 From: Patrick Lewis <4015312+locus313@users.noreply.github.com> Date: Fri, 28 Aug 2026 09:51:42 -0700 Subject: [PATCH] Render removed backups as a table in the HTML email report Matches the styling/columns of the existing "Backups found by domain" table (Domain, File, Date, Size) instead of a nested bullet list, for visual consistency across the report. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../remove-wordpress-backups.sh | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/remove-old-wordpress-backups/remove-wordpress-backups.sh b/remove-old-wordpress-backups/remove-wordpress-backups.sh index faeff91..3bc6f23 100644 --- a/remove-old-wordpress-backups/remove-wordpress-backups.sh +++ b/remove-old-wordpress-backups/remove-wordpress-backups.sh @@ -400,16 +400,24 @@ build_html_report() { counts_html+="${domain}${found}${size}${newest}${oldest}" if [ "${removed_count}" -gt 0 ]; then - local files_html="" + row_bg="#ffffff" + [ $(( i % 2 )) -eq 1 ] && row_bg="#fff3f3" + local f fname fdate fsize while IFS= read -r f; do - [ -n "${f}" ] && files_html+="
  • $(printf '%s' "${f}" | html_escape)
  • " + [ -n "${f}" ] || continue + # Split "filename (date, size)" back into its parts for the table columns + if [[ "${f}" =~ ^(.*)\ \(([^,]+),\ (.+)\)$ ]]; then + fname="${BASH_REMATCH[1]}" + fdate="${BASH_REMATCH[2]}" + fsize="${BASH_REMATCH[3]}" + else + fname="${f}"; fdate="-"; fsize="-" + fi + removed_html+="${domain}$(printf '%s' "${fname}" | html_escape)${fdate}${fsize}" done <<<"${removed_files}" - removed_html+="
  • ${domain} - ${action_title}: ${removed_count}
  • " fi done - [ -n "${removed_html}" ] || removed_html="
  • (none)
  • " - cat < @@ -423,8 +431,24 @@ build_html_report() {

    Backups ${action} by domain

    - +EOF + if [ -n "${removed_html}" ]; then + cat < + + Domain + File + Date + Size + + ${removed_html} + +EOF + else + echo '

    (none)

    ' + fi + cat <Backups found by domain