From c74a083eb9f6e13e6b0835606ae5c91d933e3df0 Mon Sep 17 00:00:00 2001 From: Steve Hanlon Date: Mon, 24 Aug 2026 12:14:26 +0100 Subject: [PATCH] =?UTF-8?q?Release=200.1.8=20=E2=80=94=20Start=20new=20hea?= =?UTF-8?q?lthcheck=20from=20the=20finished=20panel=20(hc-vt5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A finished session showed only the next-due prompt and download/discard buttons — the only way onward was Discard, which reads as destructive even though it just clears the local cache. Add a prominent "Start new healthcheck" button that clears the finished session from the cache and starts a fresh one for the same site_key (so history links up and the prior handover notes seed the new session). The finished record stays on the history server. Bumps plugin header, ATT_HC_VERSION and updates.json so PUC offers it. Co-Authored-By: Claude Opus 4.8 (1M context) --- att-site-healthcheck.php | 4 ++-- includes/admin-page.php | 50 +++++++++++++++++++++++++++++++++++++++- updates.json | 4 ++-- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/att-site-healthcheck.php b/att-site-healthcheck.php index 9dba3ec..456ce8a 100644 --- a/att-site-healthcheck.php +++ b/att-site-healthcheck.php @@ -2,7 +2,7 @@ /** * Plugin Name: ATT Site Healthcheck * Description: Walks a technician through a structured WordPress site healthcheck. Steps are drop-in PHP files so adding/removing one is a single file change. - * Version: 0.1.7 + * Version: 0.1.8 * Author: Steve Hanlon * License: Proprietary * License URI: https://git.h12e.com/steve/wp-healthcheck/raw/branch/main/LICENSE @@ -15,7 +15,7 @@ if (!defined('ABSPATH')) { exit; } -define('ATT_HC_VERSION', '0.1.7'); +define('ATT_HC_VERSION', '0.1.8'); define('ATT_HC_PLUGIN_FILE', __FILE__); define('ATT_HC_PLUGIN_DIR', plugin_dir_path(__FILE__)); define('ATT_HC_PLUGIN_URL', plugin_dir_url(__FILE__)); diff --git a/includes/admin-page.php b/includes/admin-page.php index 958382a..dbd1b20 100644 --- a/includes/admin-page.php +++ b/includes/admin-page.php @@ -3,6 +3,7 @@ if (!defined('ABSPATH')) exit; add_action('admin_menu', 'att_hc_register_menu'); add_action('admin_post_att_hc_start', 'att_hc_handle_start'); +add_action('admin_post_att_hc_start_next', 'att_hc_handle_start_next'); add_action('admin_post_att_hc_resume', 'att_hc_handle_resume'); add_action('wp_ajax_att_hc_step_history', 'att_hc_handle_step_history_ajax'); add_action('wp_ajax_att_hc_save_step_ajax', 'att_hc_handle_save_step_ajax'); @@ -55,6 +56,7 @@ function att_hc_inline_css(): string { .att-hc-status-skipped { background:#fff3cd; color:#856404; } .att-hc-status-blocked { background:#fbeae8; color:#721c24; } .att-hc-status-n_a { background:#e2e3e5; color:#41464b; } + .att-hc-start-next { margin:.5rem 0 1rem; display:flex; flex-wrap:wrap; align-items:center; gap:.6rem; } .att-hc-next-due { margin:.5rem 0 .75rem; padding:.5rem .75rem; background:#f6f7f7; border:1px solid #dcdcde; border-radius:4px; } .att-hc-next-due form { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; } .att-hc-next-due .description { flex-basis:100%; } @@ -714,11 +716,20 @@ function att_hc_render_finished_panel(ATT_HC_Session $session): void {

Healthcheck finished

Started started_at())); ?> · Finished finished_at())); ?>

+
+
+ + + + +
+ Begins a fresh session for site_key()); ?>. This finished report stays on the history server. +
- +
@@ -769,6 +780,43 @@ function att_hc_handle_start(): void { exit; } +/** + * Start a fresh healthcheck straight from the finished panel, without making the + * technician Discard first (Discard reads as destructive, though it only clears + * the local cache). Only acts on a finished session; the finished record stays + * on the history server. + */ +function att_hc_handle_start_next(): void { + if (!current_user_can('manage_options')) wp_die('Forbidden'); + check_admin_referer('att_hc_start_next'); + + $current = ATT_HC_Session::current(); + // Guard: only from a finished session. If an active one is somehow current, + // don't clobber it — just send the technician back to it. + if ($current && !$current->is_finished()) { + wp_safe_redirect(admin_url('tools.php?page=att-site-healthcheck')); + exit; + } + + // Keep the engagement's site_key so history links up and the just-finished + // session's handover notes seed the new "before" notes (see start()). + $site_key = isset($_POST['site_key']) && $_POST['site_key'] !== '' + ? sanitize_text_field(wp_unslash((string) $_POST['site_key'])) + : ($current ? $current->site_key() : null); + + // Drop the finished session from the local cache so start() creates a new one. + // The finished record remains on the server. + ATT_HC_Session::discard(); + + try { + ATT_HC_Session::start(get_current_user_id(), $site_key); + } catch (ATT_HC_Api_Exception $e) { + set_transient('att_hc_api_error', 'Could not start a new healthcheck: ' . $e->getMessage(), 60); + } + wp_safe_redirect(admin_url('tools.php?page=att-site-healthcheck')); + exit; +} + function att_hc_handle_save_next_due(): void { if (!current_user_can('manage_options')) wp_die('Forbidden'); check_admin_referer('att_hc_save_next_due'); diff --git a/updates.json b/updates.json index 1de4cb2..d3fd943 100644 --- a/updates.json +++ b/updates.json @@ -1,12 +1,12 @@ { "name": "ATT Site Healthcheck", "slug": "att-site-healthcheck", - "version": "0.1.7", + "version": "0.1.8", "author": "Steve Hanlon", "requires": "6.0", "tested": "6.6", "requires_php": "7.4", - "last_updated": "2026-07-27 08:42:03", + "last_updated": "2026-08-24 12:13:39", "download_url": "https://git.h12e.com/steve/wp-healthcheck/archive/main.zip", "sections": { "description": "Walks a technician through a structured WordPress site healthcheck. Steps are drop-in PHP files so adding/removing one is a single file change.",