fix: partner 偵測符號對齊實際存在的常數 + schema 期望值補齊 #1

Open
wpdev wants to merge 0 commits from fix/partner-detection-symbols into main
Owner

舊版 TMDO_Quotation::register() 偵測 TMQUO_Main / TMQUO_Plugin 兩個類別,在 partner 外掛中根本不存在。偵測實際完全靠 file_exists() 後備撐著——程式碼讀起來像在驗證「partner 已載入」,實際只驗證了「目錄存在」。

修法:改用 TMQUO_VERSION / TMQUO_PLUGIN_DIR,兩者在 partner 主檔的檔案解析當下即 define,早於 plugins_loaded,故本 AddOn bootstrap 的 :6 時點確實可用。file_exists() 後備保留不動,行為不變。

為何值得修:這是潛伏風險而非現行 bug。哪天有人看到這些 class_exists() 覺得多餘而移除 file_exists(),就會複製出 2meet-data-optimizer-infocards-addon 那場事故——該 AddOn 因獨缺 file_exists 後備,hook 從未掛上,等同未啟用。

實測驗證(mu-plugin 於 plugins_loaded:6 量測真實 HTTP 請求):TMQUO_VERSION = AVAILABLE。5 個 AddOn 合計 29 張表註冊,欄位與索引定義 100% 完整;wp wpdo doctor 89 OK / 0 FAIL。

同一版本另含先前未提交的 schema 工作:補齊 expected_columns / indexes,並將 registry 索引 config key 由 expected_indexes 更正為 indexes(wp_parse_args() 會靜默丟棄未知 key,索引期望值先前等同從未送達 registry)。


🤖 Generated with Claude Code

舊版 `TMDO_Quotation::register()` 偵測 `TMQUO_Main` / `TMQUO_Plugin` 兩個類別,在 partner 外掛中**根本不存在**。偵測實際完全靠 `file_exists()` 後備撐著——程式碼讀起來像在驗證「partner 已載入」,實際只驗證了「目錄存在」。 **修法**:改用 `TMQUO_VERSION` / `TMQUO_PLUGIN_DIR`,兩者在 partner 主檔的**檔案解析當下**即 `define`,早於 `plugins_loaded`,故本 AddOn bootstrap 的 `:6` 時點確實可用。`file_exists()` 後備**保留不動**,行為不變。 **為何值得修**:這是潛伏風險而非現行 bug。哪天有人看到這些 `class_exists()` 覺得多餘而移除 `file_exists()`,就會複製出 `2meet-data-optimizer-infocards-addon` 那場事故——該 AddOn 因獨缺 file_exists 後備,hook 從未掛上,等同未啟用。 **實測驗證**(mu-plugin 於 `plugins_loaded:6` 量測真實 HTTP 請求):`TMQUO_VERSION` = AVAILABLE。5 個 AddOn 合計 29 張表註冊,欄位與索引定義 100% 完整;`wp wpdo doctor` 89 OK / 0 FAIL。 同一版本另含先前未提交的 schema 工作:補齊 `expected_columns` / `indexes`,並將 registry 索引 config key 由 `expected_indexes` 更正為 `indexes`(`wp_parse_args()` 會靜默丟棄未知 key,索引期望值先前等同從未送達 registry)。 --- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wpdev added 1 commit 2026-08-09 00:48:03 +08:00
TMDO_Quotation::register() 舊版偵測 TMQUO_Main / TMQUO_Plugin 兩個類別,
在 partner 外掛中並不存在(或載入太晚),偵測實際完全靠 file_exists() 後備
撐著——程式碼讀起來像在驗證「partner 已載入」,實際只驗證了「目錄存在」。

改用 TMQUO_VERSION / TMQUO_PLUGIN_DIR,兩者在 partner 主檔的檔案解析當下即
define,早於 plugins_loaded,故本 AddOn bootstrap 的 :6 時點確實可用。
file_exists() 後備保留不動,行為不變;但偵測不再是死碼,即使將來移除後備也
不會重演 infocards-addon 那種「整個 AddOn 靜默失效」的事故。

同一版本另含先前未提交的 schema 工作:補齊 expected_columns / indexes,
並將 registry 索引 config key 由 expected_indexes 更正為 indexes
(wp_parse_args() 會靜默丟棄未知 key,索引期望值先前等同從未送達)。

實測驗證(mu-plugin 於 plugins_loaded:6 量測真實請求):
新常數 AVAILABLE;wp wpdo doctor 89 OK / 0 FAIL;表註冊欄位與索引 100% 完整。
All checks were successful
Tests / PHP Lint (pull_request) Successful in 8s
Required
Details
This branch is already included in the target branch. There is nothing to merge.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/partner-detection-symbols:fix/partner-detection-symbols
git checkout fix/partner-detection-symbols
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wpdev/2meet-data-optimizer-quotation-addon#1