Release 0.1.8 — Start new healthcheck from the finished panel (hc-vt5)
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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__));
|
||||
|
||||
+49
-1
@@ -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 {
|
||||
<h2>Healthcheck finished</h2>
|
||||
<p>Started <?php echo esc_html(date('Y-m-d H:i', $session->started_at())); ?> · Finished <?php echo esc_html(date('Y-m-d H:i', (int) $session->finished_at())); ?></p>
|
||||
<?php att_hc_render_next_due_form($session); ?>
|
||||
<div class="att-hc-start-next">
|
||||
<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" style="display:inline">
|
||||
<?php wp_nonce_field('att_hc_start_next'); ?>
|
||||
<input type="hidden" name="action" value="att_hc_start_next">
|
||||
<input type="hidden" name="site_key" value="<?php echo esc_attr($session->site_key()); ?>">
|
||||
<button class="button button-primary">Start new healthcheck</button>
|
||||
</form>
|
||||
<span class="description">Begins a fresh session for <code><?php echo esc_html($session->site_key()); ?></code>. This finished report stays on the history server.</span>
|
||||
</div>
|
||||
<div class="att-hc-actions">
|
||||
<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" style="display:inline">
|
||||
<?php wp_nonce_field('att_hc_download_report'); ?>
|
||||
<input type="hidden" name="action" value="att_hc_download_report">
|
||||
<button class="button button-primary">Download Markdown</button>
|
||||
<button class="button">Download Markdown</button>
|
||||
</form>
|
||||
<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" style="display:inline">
|
||||
<?php wp_nonce_field('att_hc_download_html'); ?>
|
||||
@@ -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');
|
||||
|
||||
+2
-2
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user