fix(boundary): 核心不得無守衛呼叫 AddOn 的 TMDO_Listing_Stats

實機渲染時 Dashboard 分頁 fatal:"Class TMDO_Listing_Stats not found"。
該類別住在 hivepress-addon,核心有 6 處直呼,沒裝 AddOn 的站台會炸掉
Dashboard 與兩個 REST 端點(GET /listing/{id}、POST /listing/{id}/view)。

- TMDO_Zone_Warm 新增 VIEW_KEY / VIEW_TTL 常數(值與 AddOn 的
  TMDO_Listing_Stats::VIEW_KEY 完全相同的 'wpdo_views',指向同一批列,
  無資料遷移)
- CLI benchmark 改用核心常數
- REST 兩個 handler 改走新的 read_view_count() / bump_view_count():
  AddOn 在場時仍委派過去(保留 hp_view_count postmeta fallback),
  否則核心自己讀寫 warm 列
- wp tmdo cleanup --archive-expired 加守衛,AddOn 缺席時印 warning 並跳過
This commit is contained in:
2026-07-31 10:34:40 +08:00
parent b63ab46f54
commit 6751c69bc2
3 changed files with 61 additions and 10 deletions
+13
View File
@@ -24,6 +24,19 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
class TMDO_Zone_Warm {
/**
* Warm key used for per-post view counters.
*
* Owned by core because the row lives in this zone's table and core's admin,
* CLI and REST layers all read it. The HivePress AddOn's
* TMDO_Listing_Stats::VIEW_KEY carries the identical literal, so the two
* address the same rows — nothing to migrate either way.
*/
const VIEW_KEY = 'wpdo_views';
/** TTL applied when core increments the view counter itself. */
const VIEW_TTL = DAY_IN_SECONDS;
/**
* Get the warm table name.
*/