refactor(2meet-data-optimizer): remove HPCT legacy from core

- Feature flags keep only the live AddOn modules (wc_orders, latepoint) as ADDON_MODULES / addon_modules(); drop map_hpct_status() and the 7 HivePress HPCT modules whose interceptors were removed in PR-014
- Remove HPCT detection/notice (Compatibility, core), the admin HPCT import tab and status row, CLI import-hpct, the 7 advisor rules for dead modules, and the removed interceptors from COEXIST_WHITELIST
- Verify: NoHpctLegacyTest guard; core unit 635 / integration 449, HP 145/49, WC 10/22 OK; all sites have every module idle and never imported HPCT
- PR: PR-020c
This commit is contained in:
2026-09-26 00:14:18 +08:00
parent 1eedaa9b3c
commit 8a1c9c0353
13 changed files with 110 additions and 378 deletions
+4 -66
View File
@@ -42,7 +42,6 @@ class TMDO_CLI {
$compat = TMDO_Compatibility::check();
WP_CLI::log( 'HivePress: ' . ( $compat['hivepress'] ? 'Active' : 'Not found' ) );
WP_CLI::log( 'HP Custom Tables: ' . self::format_hpct_status( $compat ) );
WP_CLI::log( 'Object Cache: ' . ( wp_using_ext_object_cache() ? 'External' : 'Built-in' ) );
WP_CLI::log( '' );
@@ -57,10 +56,10 @@ class TMDO_CLI {
WP_CLI::log( 'Module States:' );
$hpct_flags = TMDO_Feature_Flags::hpct_modules();
if ( ! empty( $hpct_flags ) ) {
WP_CLI::log( ' [HPCT Modules]' );
foreach ( $hpct_flags as $module => $state ) {
$addon_flags = TMDO_Feature_Flags::addon_modules();
if ( ! empty( $addon_flags ) ) {
WP_CLI::log( ' [AddOn Modules]' );
foreach ( $addon_flags as $module => $state ) {
WP_CLI::log( " {$module}: {$state}" );
}
}
@@ -668,51 +667,6 @@ class TMDO_CLI {
WP_CLI::success( "Module {$module} disabled (idle)." );
}
/**
* Import settings from HP Custom Tables.
*
* ## EXAMPLES
*
* wp wpdo import-hpct
*
* @param array $args Positional arguments.
* @param array $assoc_args Associative arguments.
* @return void
*
* @subcommand import-hpct
*/
public function import_hpct( $args, $assoc_args ): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
// HPCT is a HivePress-family plugin; the importer ships in that AddOn.
if ( ! class_exists( 'TMDO_HPCT_Import' ) ) {
WP_CLI::error( 'import-hpct needs 2meet-data-optimizer-hivepress-addon to be active.' );
}
if ( TMDO_HPCT_Import::is_imported() ) {
WP_CLI::warning( 'HPCT settings have already been imported.' );
return;
}
if ( ! TMDO_HPCT_Import::can_import() ) {
WP_CLI::error( 'HP Custom Tables plugin not detected or already imported.' );
}
// Show preview.
$preview_data = TMDO_HPCT_Import::preview();
if ( ! empty( $preview_data['modules'] ) ) {
WP_CLI::log( 'Import preview:' );
WP_CLI\Utils\format_items( 'table', $preview_data['modules'], array( 'module', 'hpct_status', 'wpdo_state' ) );
}
WP_CLI::confirm( 'Proceed with import?' );
$result = TMDO_HPCT_Import::run();
if ( is_wp_error( $result ) ) {
WP_CLI::error( $result->get_error_message() );
}
WP_CLI::success( 'HPCT settings imported successfully. You can now deactivate HP Custom Tables.' );
}
/**
* Run performance benchmark.
*
@@ -1430,22 +1384,6 @@ class TMDO_CLI {
}
}
/**
* Format the HPCT status string for display.
*
* @param array $compat Compatibility check result array.
* @return string Human-readable HPCT status.
*/
private static function format_hpct_status( array $compat ): string {
if ( $compat['hpct_active'] && $compat['hpct_imported'] ) {
return 'Active (Imported)';
}
if ( $compat['hpct_active'] ) {
return 'Active (Not imported — run `wp wpdo import-hpct`)';
}
return 'Not found';
}
/**
* Create the appropriate migration instance for a module name.
*