fix(2meet-data-optimizer): report entity group name collisions instead of silently dropping
- register_group() keeps the first definition but records a field diff (added/removed/changed) when the same entity/group is re-registered differently; identical re-registration stays silent - Surface collisions via Site Health (wpdo_entity_group_collisions), the admin Doctor tab, and wp wpdo doctor; warning log throttled to once a day - Verify: EntityRegistryCollisionTest (7); core unit 613 / integration 432, HP 141/49, WC 10/22 OK - PR: PR-017
This commit is contained in:
@@ -330,6 +330,25 @@ class TMDO_CLI {
|
||||
WP_CLI::log( ' [OK] Crypto key derivable (AUTH_KEY / SECURE_AUTH_SALT present)' );
|
||||
}
|
||||
|
||||
// ── Entity group name collisions ─────────────────────────────────────────
|
||||
$collisions = TMDO_Entity_Registry::get_collisions();
|
||||
if ( empty( $collisions ) ) {
|
||||
WP_CLI::log( ' [OK] No entity group name collisions' );
|
||||
}
|
||||
foreach ( $collisions as $c ) {
|
||||
WP_CLI::warning(
|
||||
sprintf(
|
||||
' [COLLISION] %s/%s registered twice with different fields (second ignored) — added: %s; removed: %s; changed: %s',
|
||||
$c['entity_type'],
|
||||
$c['group'],
|
||||
implode( ', ', $c['added'] ) ?: '-',
|
||||
implode( ', ', $c['removed'] ) ?: '-',
|
||||
implode( ', ', $c['changed'] ) ?: '-'
|
||||
)
|
||||
);
|
||||
$all_ok = false;
|
||||
}
|
||||
|
||||
// Check recent errors.
|
||||
$errors = TMDO_Logger::get_recent( '', 5 );
|
||||
if ( ! empty( $errors ) ) {
|
||||
|
||||
Reference in New Issue
Block a user