Files
wp-healthcheck/site-healthcheck.php
Steve Hanlon 8ceb756404 Recovery plugin: folder-agnostic detection + one-click install from Gitea
Detection (recovery-bootstrap.php):
- Match on plugin Name + Author instead of hard-coded folder slug, so
  the recovery plugin is found regardless of whether it was unpacked
  as site-recovery/, wp-site-recovery/, or anything else.

One-click install (recovery-installer.php — new):
- Pulls site-recovery from a private Gitea repo via the standard archive
  endpoint with token auth.
- Ref resolution order: latest release → latest tag → main branch HEAD.
  Lets us tag pinned releases in Gitea later without changing code.
- upgrader_source_selection filter forces the unpacked folder name to
  'site-recovery' regardless of the gitea wrapper-folder suffix.
- Config from constants in wp-config.php (WPH_GITEA_HOST/OWNER/REPO/TOKEN)
  beats DB option storage. Constants are visually locked in the settings
  UI so admins can see they're inherited.

Settings page (hidden submenu, reachable at Tools → Site Healthcheck
→ 'Configure gitea source'):
- Host / Owner / Repo / Token fields
- Inline 'Install now' button when configured + plugin not installed

Bootstrap status panel:
- Shows the recovery plugin's actual file path when active
- 'Install from gitea (latest)' button when configured + missing
- 'Configure gitea source' button when not configured + missing

Install handler shows a success message via transient on the main
healthcheck page after a successful install + activate.
2026-06-12 09:43:55 +01:00

34 lines
1.2 KiB
PHP

<?php
/**
* Plugin Name: 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.0
* Author: Steve Hanlon
* License: GPL-2.0-or-later
* Requires PHP: 7.4
*
* Internal/agency tool — not distributed via WP.org. See beads decision hc-5ix.26.
*/
if (!defined('ABSPATH')) {
exit;
}
define('WPH_VERSION', '0.1.0');
define('WPH_PLUGIN_FILE', __FILE__);
define('WPH_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('WPH_PLUGIN_URL', plugin_dir_url(__FILE__));
define('WPH_OPT_SESSION', 'wph_session');
require_once WPH_PLUGIN_DIR . 'includes/class-wph-step.php';
require_once WPH_PLUGIN_DIR . 'includes/class-wph-steps.php';
require_once WPH_PLUGIN_DIR . 'includes/class-wph-session.php';
require_once WPH_PLUGIN_DIR . 'includes/recovery-bootstrap.php';
require_once WPH_PLUGIN_DIR . 'includes/recovery-installer.php';
require_once WPH_PLUGIN_DIR . 'includes/admin-page.php';
require_once WPH_PLUGIN_DIR . 'includes/report.php';
add_action('plugins_loaded', function () {
WPH_Steps::instance()->discover(WPH_PLUGIN_DIR . 'includes/steps/');
});