fix(audit,sso): audit 表補 group_name/action 欄 + 註冊 Audit_Logger + known_login_ips(A11/A12/A14)

- wpdo_audit CREATE 補 group_name varchar(50) 與 action varchar(20):
  TMDO_Audit_Logger::write_row() 一直在寫這兩個 key,表卻沒有該欄位。
  SCHEMA_VERSION 2.0.0 → 2.1.0 觸發既有站台 dbDelta ALTER;主檔與兩個
  test bootstrap 的 TMDO_DB_VERSION 同步(BackCompatTest 守門要求一致)。
- TMDO_Core::run() 註冊 TMDO_Audit_Logger::init():先前完全沒掛,
  wpdo_after_write / wpdo_after_delete 的稽核監聽器形同不存在。
- register_sso_group() 補 known_login_ips(A v3.4.4):2meet-spoke-sso 的
  TMSO_Login_Notify 以 set_entity 寫此欄,未註冊時降級落 wp_usermeta。
  對應測試改為 test_sso_group_has_eight_fields。

unit 379 / integration 398 GREEN

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
This commit is contained in:
2026-07-31 05:16:33 +08:00
parent f1c577df0d
commit a0847a27bf
7 changed files with 20 additions and 6 deletions
+5
View File
@@ -134,6 +134,11 @@ class TMDO_Core {
// v2.0.0: boot the unified Hook Bus when explicitly enabled.
TMDO_Hook_Bus_Bridge::maybe_init_hook_bus();
// Register audit log listeners for wpdo_after_write / wpdo_after_delete.
if ( class_exists( 'TMDO_Audit_Logger' ) ) {
TMDO_Audit_Logger::init();
}
// v2.0.0: fire the Custom Table Registry hook so partner plugins can register.
TMDO_Custom_Table_Registry::instance()->fire_registration();
+3 -1
View File
@@ -36,7 +36,7 @@ class TMDO_Installer {
* wpdo_audit / wpdo_shadow_diffs / wpdo_site_metrics / wpdo_uni_options
* tables installed via install_v2_tables() during V2 upgrade.
*/
private const SCHEMA_VERSION = '2.0.0';
private const SCHEMA_VERSION = '2.1.0';
// ── Public API ────────────────────────────────────────────────────────
@@ -289,7 +289,9 @@ class TMDO_Installer {
user_id bigint(20) unsigned NOT NULL DEFAULT 0,
entity_type varchar(20) NOT NULL DEFAULT '',
entity_id bigint(20) unsigned NOT NULL DEFAULT 0,
group_name varchar(50) NOT NULL DEFAULT '',
meta_key varchar(255) NOT NULL DEFAULT '',
action varchar(20) NOT NULL DEFAULT '',
op varchar(20) NOT NULL DEFAULT '',
value_before longtext,
value_after longtext,
@@ -266,6 +266,11 @@ final class TMDO_Member_Fields {
'default' => 0,
'label' => 'SSO login count',
),
array(
'key' => 'known_login_ips',
'type' => 'textarea',
'label' => 'Recent login IPs JSON array (new-device notification) — replaces _tmso_known_ips usermeta',
),
)
);
}