fix: partner 偵測符號對齊實際存在的常數 + schema 期望值補齊 #1
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: 2meet Data Optimizer — Mobile_Bridge AddOn
|
||||
* Plugin URI: https://2meet.io/2meet-data-optimizer/mobile-bridge
|
||||
* Description: 2meet-mobile-bridge 1 張自訂表 (2meet_refresh_tokens) 註冊
|
||||
* Version: 0.1.0
|
||||
* Version: 0.1.1
|
||||
* Requires at least: 6.0
|
||||
* Tested up to: 6.9.4
|
||||
* Requires PHP: 8.1
|
||||
@@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'TMDO_MOBILE_BRIDGE_VERSION', '0.1.0' );
|
||||
define( 'TMDO_MOBILE_BRIDGE_VERSION', '0.1.1' );
|
||||
define( 'TMDO_MOBILE_BRIDGE_PATH', plugin_dir_path( __FILE__ ) );
|
||||
define( 'TMDO_MOBILE_BRIDGE_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'TMDO_MOBILE_BRIDGE_FILE', __FILE__ );
|
||||
|
||||
@@ -13,6 +13,31 @@ Versioning follows [Semantic Versioning](https://semver.org/).
|
||||
|
||||
---
|
||||
|
||||
## [0.1.1] — 2026-08-08 — `2meet_refresh_tokens` 補齊 schema 期望值
|
||||
|
||||
### Added
|
||||
|
||||
- 為 `2meet_refresh_tokens` 補上 `expected_columns` 與 `indexes`,欄位與索引逐項
|
||||
轉錄自 2meet-mobile-bridge activator 的 `CREATE TABLE`。這張表承載行動端
|
||||
refresh token 的查詢與撤銷,索引漏建會直接反映成登入延遲;先前只註冊表名,
|
||||
`wp wpdo doctor` 只知道表存在,無從判斷欄位或索引是否漂移。
|
||||
|
||||
### Fixed
|
||||
|
||||
- `TMDO_Custom_Table_Registry::register()` 的索引期望值 config key 由
|
||||
`expected_indexes` 更正為 `indexes`。該 API 以 `wp_parse_args()` 併入預設值,
|
||||
未知 key 會被**靜默丟棄**——先前索引期望值等同從未送達 registry,
|
||||
`wp wpdo doctor` 的 schema drift 只驗欄位、不驗索引。此問題橫跨全部 8 個 AddOn,
|
||||
已一併更正。
|
||||
- `TMDO_Mobile_Bridge::register()` 的 partner 偵測符號對齊實際存在的常數。舊版偵測
|
||||
`TMEETMB_Plugin` 類別,但該類別在 2meet-mobile-bridge 中**根本不存在**,偵測實際
|
||||
完全靠 `file_exists()` 後備撐著。改用 `TMEETMB_VERSION` / `TMEETMB_PLUGIN_DIR`,
|
||||
兩者在主檔檔案解析當下即 define,早於 `plugins_loaded`。
|
||||
實測(mu-plugin 於 `plugins_loaded:6` 量測):`TMEETMB_VERSION` = AVAILABLE。
|
||||
`file_exists()` 後備保留不動,行為不變;但偵測不再是死碼。
|
||||
|
||||
---
|
||||
|
||||
## [0.1.0] — TBD
|
||||
|
||||
### Added (initial release, scaffold)
|
||||
|
||||
@@ -19,8 +19,18 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
*/
|
||||
final class TMDO_Mobile_Bridge {
|
||||
|
||||
/**
|
||||
* 偵測以常數優先:`TMEETMB_VERSION` / `TMEETMB_PLUGIN_DIR` 在 2meet-mobile-bridge
|
||||
* 主檔的**檔案解析當下**(第 21/23 行)即 define,早於 `plugins_loaded`;本 AddOn
|
||||
* bootstrap 掛在 `plugins_loaded:6`,故此時常數已可用。
|
||||
*
|
||||
* 舊版偵測的 `TMEETMB_Plugin` 類別在 2meet-mobile-bridge 中**並不存在**,偵測實際
|
||||
* 完全靠 `file_exists()` 撐著。保留 file_exists 作最終後備,但常數檢查現在真的
|
||||
* 有效——即使將來移除後備也不會像 infocards 那樣整個 AddOn 靜默失效。
|
||||
*/
|
||||
public static function register(): void {
|
||||
$detected = class_exists( 'TMEETMB_Plugin' )
|
||||
$detected = defined( 'TMEETMB_VERSION' )
|
||||
|| defined( 'TMEETMB_PLUGIN_DIR' )
|
||||
|| file_exists( WP_PLUGIN_DIR . '/2meet-mobile-bridge/2meet-mobile-bridge.php' );
|
||||
if ( ! $detected ) {
|
||||
return;
|
||||
@@ -32,9 +42,23 @@ final class TMDO_Mobile_Bridge {
|
||||
$registry->register(
|
||||
'2meet-mobile-bridge',
|
||||
array(
|
||||
'table_name' => '2meet_refresh_tokens',
|
||||
'primary_key' => 'id',
|
||||
'post_type_link' => null,
|
||||
'table_name' => '2meet_refresh_tokens',
|
||||
'primary_key' => 'id',
|
||||
'post_type_link' => null,
|
||||
'expected_columns' => array(
|
||||
'id' => 'BIGINT',
|
||||
'token_hash' => 'CHAR',
|
||||
'user_id' => 'BIGINT',
|
||||
'expires_at' => 'DATETIME',
|
||||
'created_at' => 'DATETIME',
|
||||
'revoked_at' => 'DATETIME',
|
||||
'replaced_by' => 'CHAR',
|
||||
),
|
||||
'indexes' => array(
|
||||
'token_hash' => array( 'token_hash' ),
|
||||
'user_id' => array( 'user_id' ),
|
||||
'expires_at' => array( 'expires_at' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user