fix(2meet-data-optimizer): stop false alarms in doctor, term-comment-diagnose and bridge-status
- doctor: entity flat tables come from the registry (TMDO_CLI::check_entity_tables()) instead of a hard-coded user list naming the never-registered sso group, which failed doctor on every site; it also reports Promotion Guard violations and the recorded drift status per entity (report_guard_and_drift()). - term-comment-diagnose: filter status comes from each filter's is_enabled() (the garbage filter and misc bucket default to off but were shown enabled); a filter whose add-on is not active shows "not installed". - bridge-status: flat_rows counts rows holding a value (wp_core keeps an all-NULL row per post: 15306% on dev36) and eav_ids of a post-type group counts only its post types. - Tests: the WP_CLI stubs record their output in $GLOBALS['_wp_cli_output']. - Verify: DoctorTest, CliFilterStatusTest, CliBridgeStatusTest (RED before); dev36 doctor exit 1 → 0, wp_core 15306% → 100%. - PR: PR-076
This commit is contained in:
@@ -442,9 +442,9 @@ class TMDO_CLI_Term_Comment {
|
||||
|
||||
WP_CLI::log( '' );
|
||||
WP_CLI::log( '── Filter chain status ──' );
|
||||
self::print_filter_status( 'wpdo_term_comment_garbage_filter_enabled', 'Garbage filter (Phase 1)' );
|
||||
self::print_filter_status( 'wpdo_wc_term_count_filter_enabled', 'WC term count filter (Phase 3)' );
|
||||
self::print_filter_status( 'wpdo_term_comment_misc_bucket_enabled', 'Misc bucket (Phase 4)' );
|
||||
self::print_filter_status( 'TMDO_Term_Comment_Garbage_Filter', 'Garbage filter (Phase 1)' );
|
||||
self::print_filter_status( 'TMDO_WC_Term_Count_Filter', 'WC term count filter (Phase 3)' );
|
||||
self::print_filter_status( 'TMDO_Term_Comment_Misc_Bucket', 'Misc bucket (Phase 4)' );
|
||||
|
||||
WP_CLI::log( '' );
|
||||
WP_CLI::log( 'Recommendation: ' . self::recommend_next_action( $term_mode, $comment_mode ) );
|
||||
@@ -504,15 +504,19 @@ class TMDO_CLI_Term_Comment {
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a filter's enabled/disabled status.
|
||||
* Print a filter's enabled/disabled status, as the filter itself decides it
|
||||
* (each has its own default).
|
||||
*
|
||||
* @param string $option_key Option storing the toggle value.
|
||||
* @param string $label Human-readable name.
|
||||
* @param string $filter_class Filter class with a static is_enabled().
|
||||
* @param string $label Human-readable name.
|
||||
* @return void
|
||||
*/
|
||||
private static function print_filter_status( string $option_key, string $label ): void {
|
||||
$enabled = (bool) get_option( $option_key, '1' );
|
||||
WP_CLI::log( sprintf( '%-32s%s', $label . ':', $enabled ? '✓ enabled' : '✗ disabled' ) );
|
||||
private static function print_filter_status( string $filter_class, string $label ): void {
|
||||
if ( ! class_exists( $filter_class ) ) {
|
||||
WP_CLI::log( sprintf( '%-32s%s', $label . ':', '— not installed' ) );
|
||||
return;
|
||||
}
|
||||
WP_CLI::log( sprintf( '%-32s%s', $label . ':', $filter_class::is_enabled() ? '✓ enabled' : '✗ disabled' ) );
|
||||
}
|
||||
|
||||
// ── term-comment-shadow-report (v2.12.5 Phase 5) ──────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user