refactor(2meet-data-optimizer): delete dead HivePress defaults and hardcoded partner list

- Remove never-called register_hivepress_defaults() and core boot probes for AddOn classes that load at plugins_loaded:3/:6 and self-register (8 partner list entries, WC orders interceptor, HP transient filter)
- Keep core-owned TMDO_Member_Fields / TMDO_Post_Fields registration unchanged
- Verify: CoreBoundaryTest guard added; core unit 606 / integration 432, HP 141/49, WC 10/22 OK
- PR: PR-016
This commit is contained in:
2026-09-25 23:19:22 +08:00
parent 9dc4516ca0
commit 07db7734cf
2 changed files with 38 additions and 246 deletions
+34
View File
@@ -114,6 +114,40 @@ class CoreBoundaryTest extends TestCase {
);
}
/**
* TMDO_Core::run() fires at plugins_loaded:4, but these AddOn classes load
* at plugins_loaded:6 and wire themselves up in their own bootstrap. Probing
* them from core boot can never hit, so core must not mention them at all.
* (The infocards AddOn loads at :3 and also calls its own register().)
*/
public function test_core_boot_does_not_probe_addons_that_self_register(): void {
$tokens = token_get_all( (string) file_get_contents( dirname( __DIR__, 2 ) . '/includes/class-tmdo-core.php' ) );
$code = '';
foreach ( $tokens as $token ) {
if ( is_array( $token ) && in_array( $token[0], array( T_COMMENT, T_DOC_COMMENT ), true ) ) {
continue;
}
$code .= is_array( $token ) ? $token[1] : $token;
}
$late_addon_names = array(
'TMDO_Infocards',
'TMDO_Bookings',
'TMDO_Quotation',
'TMDO_Mobile_Bridge',
'TMDO_Collab',
'TMDO_Playlist',
'TMDO_WooCommerce',
'TMDO_WC_Orders_Interceptor',
'TMDO_Hivepress_Term_Comment_Fields',
'TMDO_Hivepress_Transient_Filter',
'register_hivepress_defaults',
);
$found = array_values( array_filter( $late_addon_names, static fn( $name ) => str_contains( $code, $name ) ) );
$this->assertSame( array(), $found, 'Dead AddOn probes remain in TMDO_Core: ' . implode( ', ', $found ) );
}
/**
* Remove line comments and string literals so mentions inside them are ignored.
*/