Rename to ATT Site Healthcheck (private prefix)
Wholesale rename to avoid clashes with generic 'site healthcheck' plugin names on a target site: - Plugin Name: 'Site Healthcheck' → 'ATT Site Healthcheck' - Main file: site-healthcheck.php → att-site-healthcheck.php - Plugin folder: site-healthcheck → att-site-healthcheck - Admin menu slug: site-healthcheck → att-site-healthcheck - Settings slug: site-healthcheck-settings → att-site-healthcheck-settings - PHP class prefix: WPH_ → ATT_HC_ - Function prefix: wph_ → att_hc_ - Option / transient: wph_* → att_hc_* - Action/filter: wph_* → att_hc_* - CSS class prefix: wph- → att-hc- - Constants: WPH_GITEA_* → ATT_HC_GITEA_* - Class file names: class-wph-*.php → class-att-hc-*.php - Dev folder: ~/dev/wp-healthcheck → ~/dev/att-site-healthcheck Existing in-progress sessions on installs that had the old wph_session option will not migrate — they were intended for dev use only and the user has confirmed this is OK for the rename window. Smoke-tested on testsite: classes load, 14 steps discovered, save/load round-trip works, admin page renders with new att-hc- CSS classes. Recovery plugin detection unchanged — that lives in wp-site-recovery and continues to be detected by Name + Author header.
This commit is contained in:
@@ -5,10 +5,10 @@ if (!defined('ABSPATH')) exit;
|
||||
* One-click install of wp-site-recovery from a private Gitea repo.
|
||||
*
|
||||
* Config sources (in order — constants beat options):
|
||||
* define('WPH_GITEA_HOST', 'https://git.example.com');
|
||||
* define('WPH_GITEA_OWNER', 'steve');
|
||||
* define('WPH_GITEA_REPO', 'site-recovery');
|
||||
* define('WPH_GITEA_TOKEN', 'xxx'); // read-only PAT, scoped to this repo
|
||||
* define('ATT_HC_GITEA_HOST', 'https://git.example.com');
|
||||
* define('ATT_HC_GITEA_OWNER', 'steve');
|
||||
* define('ATT_HC_GITEA_REPO', 'site-recovery');
|
||||
* define('ATT_HC_GITEA_TOKEN', 'xxx'); // read-only PAT, scoped to this repo
|
||||
*
|
||||
* …or set the same values via the settings panel (stored in WP options).
|
||||
*
|
||||
@@ -23,29 +23,29 @@ if (!defined('ABSPATH')) exit;
|
||||
* the unpacked folder to 'site-recovery' so the destination is consistent.
|
||||
* → activate_plugin() against the freshly-installed plugin file.
|
||||
*/
|
||||
final class WPH_Recovery_Installer {
|
||||
final class ATT_HC_Recovery_Installer {
|
||||
|
||||
private const OPT_HOST = 'wph_gitea_host';
|
||||
private const OPT_OWNER = 'wph_gitea_owner';
|
||||
private const OPT_REPO = 'wph_gitea_repo';
|
||||
private const OPT_TOKEN = 'wph_gitea_token';
|
||||
private const OPT_HOST = 'att_hc_gitea_host';
|
||||
private const OPT_OWNER = 'att_hc_gitea_owner';
|
||||
private const OPT_REPO = 'att_hc_gitea_repo';
|
||||
private const OPT_TOKEN = 'att_hc_gitea_token';
|
||||
|
||||
public static function config(): array {
|
||||
return [
|
||||
'host' => defined('WPH_GITEA_HOST') ? (string) WPH_GITEA_HOST : (string) get_option(self::OPT_HOST, ''),
|
||||
'owner' => defined('WPH_GITEA_OWNER') ? (string) WPH_GITEA_OWNER : (string) get_option(self::OPT_OWNER, ''),
|
||||
'repo' => defined('WPH_GITEA_REPO') ? (string) WPH_GITEA_REPO : (string) get_option(self::OPT_REPO, ''),
|
||||
'token' => defined('WPH_GITEA_TOKEN') ? (string) WPH_GITEA_TOKEN : (string) get_option(self::OPT_TOKEN, ''),
|
||||
'host' => defined('ATT_HC_GITEA_HOST') ? (string) ATT_HC_GITEA_HOST : (string) get_option(self::OPT_HOST, ''),
|
||||
'owner' => defined('ATT_HC_GITEA_OWNER') ? (string) ATT_HC_GITEA_OWNER : (string) get_option(self::OPT_OWNER, ''),
|
||||
'repo' => defined('ATT_HC_GITEA_REPO') ? (string) ATT_HC_GITEA_REPO : (string) get_option(self::OPT_REPO, ''),
|
||||
'token' => defined('ATT_HC_GITEA_TOKEN') ? (string) ATT_HC_GITEA_TOKEN : (string) get_option(self::OPT_TOKEN, ''),
|
||||
];
|
||||
}
|
||||
|
||||
/** Returns whether each config field comes from a constant (true) or an option (false). */
|
||||
public static function config_origin(): array {
|
||||
return [
|
||||
'host' => defined('WPH_GITEA_HOST'),
|
||||
'owner' => defined('WPH_GITEA_OWNER'),
|
||||
'repo' => defined('WPH_GITEA_REPO'),
|
||||
'token' => defined('WPH_GITEA_TOKEN'),
|
||||
'host' => defined('ATT_HC_GITEA_HOST'),
|
||||
'owner' => defined('ATT_HC_GITEA_OWNER'),
|
||||
'repo' => defined('ATT_HC_GITEA_REPO'),
|
||||
'token' => defined('ATT_HC_GITEA_TOKEN'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -157,9 +157,9 @@ final class WPH_Recovery_Installer {
|
||||
}
|
||||
|
||||
// Find the freshly-installed plugin and activate it.
|
||||
if (method_exists('WPH_Recovery_Bootstrap', 'plugin_file')) {
|
||||
if (method_exists('ATT_HC_Recovery_Bootstrap', 'plugin_file')) {
|
||||
// Bust the static cache so we re-scan get_plugins().
|
||||
$rc = new ReflectionClass('WPH_Recovery_Bootstrap');
|
||||
$rc = new ReflectionClass('ATT_HC_Recovery_Bootstrap');
|
||||
// No public reset; just call get_plugins() in our context — Bootstrap will re-scan
|
||||
// because get_plugins() builds a fresh array on each call.
|
||||
wp_cache_delete('plugins', 'plugins');
|
||||
|
||||
Reference in New Issue
Block a user