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 -99
View File
@@ -783,11 +783,6 @@ class TMDO_Admin {
$tab = 'dashboard';
}
// Show HPCT Import tab only when HPCT is detected.
if ( TMDO_Compatibility::should_show_hpct_notice() ) {
$tabs['hpct-import'] = __( 'HPCT 匯入', '2meet-data-optimizer' );
}
// v2.8.1: red-dot badge on tabs that need operator attention.
$needs_dot = array();
if ( class_exists( 'TMDO_Migration_Orchestrator' ) ) {
@@ -811,7 +806,7 @@ class TMDO_Admin {
),
'wizards' => array(
'label' => esc_html__( '🧙 遷移精靈', '2meet-data-optimizer' ),
'tabs' => array( 'migration-wizard', 'post-migration-wizard', 'hpct-import' ),
'tabs' => array( 'migration-wizard', 'post-migration-wizard' ),
),
'stress' => array(
'label' => esc_html__( '⚡ 壓力測試', '2meet-data-optimizer' ),
@@ -939,9 +934,6 @@ class TMDO_Admin {
case 'rest-api':
self::render_rest_api();
break;
case 'hpct-import':
self::render_hpct_import();
break;
case 'hivepress':
if ( class_exists( 'TMDO_Admin_HivePress' ) ) {
TMDO_Admin_HivePress::render();
@@ -1121,20 +1113,6 @@ class TMDO_Admin {
<th><?php esc_html_e( 'HivePress', '2meet-data-optimizer' ); ?></th>
<td><?php echo wp_kses_post( $compat['hivepress'] ? '<span class="wpdo-badge wpdo-badge-ok">Active</span>' : '<span class="wpdo-badge">N/A</span>' ); ?></td>
</tr>
<tr>
<th><?php esc_html_e( 'HP Custom Tables', '2meet-data-optimizer' ); ?></th>
<td>
<?php
if ( $compat['hpct_active'] && $compat['hpct_imported'] ) {
echo '<span class="wpdo-badge wpdo-badge-ok">Imported</span>';
} elseif ( $compat['hpct_active'] ) {
echo '<span class="wpdo-badge wpdo-badge-warn">Needs Import</span>';
} else {
echo '<span class="wpdo-badge">N/A</span>';
}
?>
</td>
</tr>
<tr>
<th><?php esc_html_e( 'Object Cache', '2meet-data-optimizer' ); ?></th>
<td>
@@ -1169,11 +1147,11 @@ class TMDO_Admin {
<h2><?php esc_html_e( '模組狀態', '2meet-data-optimizer' ); ?></h2>
<div class="wpdo-grid">
<div>
<h3>HPCT Modules</h3>
<h3>AddOn Modules</h3>
<table class="widefat striped">
<thead><tr><th><?php esc_html_e( '模組', '2meet-data-optimizer' ); ?></th><th><?php esc_html_e( '狀態', '2meet-data-optimizer' ); ?></th></tr></thead>
<tbody>
<?php foreach ( TMDO_Feature_Flags::hpct_modules() as $module => $state ) : ?>
<?php foreach ( TMDO_Feature_Flags::addon_modules() as $module => $state ) : ?>
<tr>
<td><code><?php echo esc_html( $module ); ?></code></td>
<td><span class="wpdo-state wpdo-state-<?php echo esc_attr( $state ); ?>"><?php echo esc_html( $state ); ?></span></td>
@@ -2717,79 +2695,6 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
<?php
}
/**
* HPCT Import tab: preview and execute import.
*/
private static function render_hpct_import(): void {
// HPCT is a HivePress-family plugin; the importer ships in that AddOn.
if ( ! class_exists( 'TMDO_HPCT_Import' ) ) {
echo '<div class="notice notice-warning"><p>'
. esc_html__( 'HPCT 匯入需要啟用 2meet-data-optimizer-hivepress-addon。', '2meet-data-optimizer' )
. '</p></div>';
return;
}
// Handle import action.
if ( isset( $_POST['wpdo_run_import'] ) && check_admin_referer( 'wpdo_hpct_import' ) ) {
$result = TMDO_HPCT_Import::run();
if ( is_wp_error( $result ) ) {
echo '<div class="notice notice-error"><p>' . esc_html( $result->get_error_message() ) . '</p></div>';
} else {
echo '<div class="notice notice-success"><p>' . esc_html__( 'HPCT 匯入成功!建議停用 HP Custom Tables 外掛。', '2meet-data-optimizer' ) . '</p></div>';
}
}
$can_import = TMDO_HPCT_Import::can_import();
$is_imported = TMDO_HPCT_Import::is_imported();
?>
<h2><?php esc_html_e( 'HP Custom Tables 匯入', '2meet-data-optimizer' ); ?></h2>
<?php if ( $is_imported ) : ?>
<div class="notice notice-success inline">
<p><?php esc_html_e( 'HPCT 設定已匯入完成。如果 HP Custom Tables 外掛仍然啟用,建議停用它。', '2meet-data-optimizer' ); ?></p>
</div>
<?php elseif ( $can_import ) : ?>
<p class="description"><?php esc_html_e( '偵測到 HP Custom Tables 外掛。匯入會將 HPCT 的模組狀態和遷移記錄複製到 WPDO,然後由 WPDO 接管所有攔截器。', '2meet-data-optimizer' ); ?></p>
<?php
$preview_data = TMDO_HPCT_Import::preview();
if ( ! empty( $preview_data['modules'] ) ) :
$preview = $preview_data['modules'];
?>
<h3><?php esc_html_e( '匯入預覽', '2meet-data-optimizer' ); ?></h3>
<table class="widefat striped wpdo-table--narrow">
<thead>
<tr>
<th><?php esc_html_e( 'HPCT 模組', '2meet-data-optimizer' ); ?></th>
<th><?php esc_html_e( 'HPCT 狀態', '2meet-data-optimizer' ); ?></th>
<th><?php esc_html_e( 'WPDO 狀態', '2meet-data-optimizer' ); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ( $preview as $item ) : ?>
<tr>
<td><code><?php echo esc_html( $item['module'] ); ?></code></td>
<td><?php echo esc_html( $item['hpct_status'] ); ?></td>
<td><span class="wpdo-state wpdo-state-<?php echo esc_attr( $item['wpdo_state'] ); ?>"><?php echo esc_html( $item['wpdo_state'] ); ?></span></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<form method="post" class="wpdo-mt-3">
<?php wp_nonce_field( 'wpdo_hpct_import' ); ?>
<?php submit_button( __( '執行匯入', '2meet-data-optimizer' ), 'primary', 'wpdo_run_import', false ); ?>
</form>
<?php endif; ?>
<?php else : ?>
<div class="notice notice-info inline">
<p><?php esc_html_e( '未偵測到 HP Custom Tables 外掛,或已完成匯入。', '2meet-data-optimizer' ); ?></p>
</div>
<?php endif; ?>
<?php
}
// ── AJAX handler ──────────────────────────────────────────────────────
/**
@@ -3740,7 +3645,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
<?php
$blacklist = class_exists( 'TMDO_FSM_Automator' ) ? TMDO_FSM_Automator::blacklist() : array();
if ( class_exists( 'TMDO_Feature_Flags' ) ) {
$all = array_merge( TMDO_Feature_Flags::HPCT_MODULES, TMDO_Feature_Flags::ZONE_MODULES );
$all = array_merge( TMDO_Feature_Flags::ADDON_MODULES, TMDO_Feature_Flags::ZONE_MODULES );
echo '<div class="wpdo-details-section">';
foreach ( $all as $m ) {
printf(
+1 -2
View File
@@ -107,7 +107,7 @@ class TMDO_Help_Tabs {
private static function content_dashboard(): string {
return '<p>' . esc_html__( '儀表板顯示:', '2meet-data-optimizer' ) . '</p>'
. '<ul class="wpdo-list-disc">'
. '<li>' . esc_html__( 'System Overview — DB 引擎、HivePress、HPCT、Object Cache 是否啟用', '2meet-data-optimizer' ) . '</li>'
. '<li>' . esc_html__( 'System Overview — DB 引擎、HivePress、Object Cache 是否啟用', '2meet-data-optimizer' ) . '</li>'
. '<li>' . esc_html__( 'Zone 行數統計 — Hot/Warm/Cold/Archive 各自累積多少資料', '2meet-data-optimizer' ) . '</li>'
. '<li>' . esc_html__( 'Module 狀態 — 每個 module 在 7-state FSM 哪一格', '2meet-data-optimizer' ) . '</li>'
. '<li>' . esc_html__( 'Warm zone live view — 哪些 view counts / TTL 進來、24h 快過期數', '2meet-data-optimizer' ) . '</li>'
@@ -173,7 +173,6 @@ class TMDO_Help_Tabs {
. '<p>' . esc_html__( '常見原因:', '2meet-data-optimizer' ) . '</p>'
. '<ul class="wpdo-list-disc">'
. '<li>' . esc_html__( 'Hook Bus 啟用(wpdo_hook_bus_enabled = 1)+ legacy interceptors 還沒卸載', '2meet-data-optimizer' ) . '</li>'
. '<li>' . esc_html__( 'HPCT (HP Custom Tables) plugin 還沒移除 — 與 WPDO 同時攔截', '2meet-data-optimizer' ) . '</li>'
. '</ul>'
. '<p>' . esc_html__( '解法:先看 conflict-scan 詳情,必要時用 wp wpdo bridge-set off 暫停 Hook Bus 直到清理完。', '2meet-data-optimizer' ) . '</p>';
}