style(admin): inline style 全面改用 CSS class(PR-H)
Anti-EAV Lint + Quality Gate / anti-eav-lint (push) Successful in 8s
Tests / Unit Tests (push) Successful in 10s
Tests / Integration Tests (push) Successful in 35s
Tests / PHP Lint (push) Successful in 7s
Tests / PHPCS (push) Successful in 19s
Tests / PHPStan (push) Successful in 24s
Anti-EAV Lint + Quality Gate / anti-eav-lint (push) Successful in 8s
Tests / Unit Tests (push) Successful in 10s
Tests / Integration Tests (push) Successful in 35s
Tests / PHP Lint (push) Successful in 7s
Tests / PHPCS (push) Successful in 19s
Tests / PHPStan (push) Successful in 24s
admin/ 的 inline style= 由 348 處降到 9 處,剩下的 9 處全是 CSS custom property 載體(--wpdo-bar-width / --wpdo-cov-pct 等動態數值),與來源外掛的 設計一致。 - wpdo-admin.css 543 → 911 行:補上 148 個 class(來源檔在 selector 與 rule-block 層級都是既有內容的超集,逐條核對過),另加 .wpdo-form-inline - 5 個變數改為 class 版本:$mode_cls / $badge_mode_cls / $diffs_cls / $ap_cls / $e_mode_cls;3 個 stress-test template 補 $mode_text_cls / $mode_card_cls - 刪掉因此變成孤兒的 $mode_badge / $style / $mode_style / $badge_style / $e_mode_bg / $badge_bg - entity card 改 .wpdo-eb-card、pipeline dot 改 .wpdo-stage-pill、demote 按鈕 改 .wpdo-eb-btn-dim;.wpdo-native-counts / .wpdo-recommendation / .wpdo-setup-banner-btn 的重複 inline style 移除 - dashboard 的 top-views 查詢一併改用上一個 commit 的 TMDO_Zone_Warm::VIEW_KEY PHPStan 抓出自動轉換造成的 11 個未定義變數,已全數補回定義並複驗。
This commit is contained in:
+170
-184
@@ -997,7 +997,7 @@ class TMDO_Admin {
|
||||
$top_views = $wpdb->get_results( // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
$wpdb->prepare(
|
||||
"SELECT post_id, CAST(meta_value AS UNSIGNED) as views FROM `{$warm_table}` WHERE meta_key = %s AND (expires_at IS NULL OR expires_at > %s) ORDER BY views DESC LIMIT 10", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
||||
TMDO_Listing_Stats::VIEW_KEY,
|
||||
TMDO_Zone_Warm::VIEW_KEY,
|
||||
$now_sql
|
||||
),
|
||||
ARRAY_A
|
||||
@@ -1295,7 +1295,7 @@ class TMDO_Admin {
|
||||
<p class="description">
|
||||
<?php esc_html_e( 'POST /view 端點因 IP 或 Cookie 重複計數而被拒絕的次數(HTTP 429)。', '2meet-data-optimizer' ); ?>
|
||||
<?php if ( $rl_total > 0 ) : ?>
|
||||
<form method="post" style="display:inline">
|
||||
<form method="post" class="wpdo-form-inline">
|
||||
<input type="hidden" name="wpdo_reset_rl_stats" value="1">
|
||||
<?php wp_nonce_field( 'wpdo_reset_rl_stats' ); ?>
|
||||
<button type="submit" class="button button-small"><?php esc_html_e( '重置統計', '2meet-data-optimizer' ); ?></button>
|
||||
@@ -1343,12 +1343,6 @@ class TMDO_Admin {
|
||||
<?php
|
||||
$hb_enabled = class_exists( 'TMDO_Hook_Bus_Bridge' ) && TMDO_Hook_Bus_Bridge::is_enabled();
|
||||
$bridge_modes = class_exists( 'TMDO_Mode_Manager' ) ? TMDO_Mode_Manager::all() : array();
|
||||
$mode_badge = array(
|
||||
'disabled' => 'background:#e0e0e0;color:#444',
|
||||
'dual_write' => 'background:#d4edda;color:#155724',
|
||||
'shadow_read' => 'background:#fff3cd;color:#856404',
|
||||
'aeav_only' => 'background:#cce5ff;color:#004085',
|
||||
);
|
||||
?>
|
||||
<table class="widefat striped wpdo-table--narrow">
|
||||
<thead>
|
||||
@@ -1362,10 +1356,10 @@ class TMDO_Admin {
|
||||
<tbody>
|
||||
<?php foreach ( array( 'post', 'user', 'term', 'comment' ) as $etype ) : ?>
|
||||
<?php
|
||||
$mode = $bridge_modes[ $etype ] ?? 'disabled';
|
||||
$style = $mode_badge[ $mode ] ?? 'background:#e0e0e0;color:#444';
|
||||
$groups = class_exists( 'TMDO_Entity_Registry' ) ? TMDO_Entity_Registry::get_groups_for_type( $etype ) : array();
|
||||
$is_post = 'post' === $etype;
|
||||
$mode = $bridge_modes[ $etype ] ?? 'disabled';
|
||||
$groups = class_exists( 'TMDO_Entity_Registry' ) ? TMDO_Entity_Registry::get_groups_for_type( $etype ) : array();
|
||||
$is_post = 'post' === $etype;
|
||||
$mode_cls = 'wpdo-badge-mode wpdo-mode-' . str_replace( '_', '-', $mode );
|
||||
?>
|
||||
<tr>
|
||||
<td><code><?php echo esc_html( $etype ); ?></code></td>
|
||||
@@ -1373,22 +1367,22 @@ class TMDO_Admin {
|
||||
<?php if ( $is_post ) : ?>
|
||||
<em><?php esc_html_e( '由 Feature_Flags FSM 管理', '2meet-data-optimizer' ); ?></em>
|
||||
<?php elseif ( $hb_enabled ) : ?>
|
||||
<span style="color:#155724">✓ <?php esc_html_e( '啟用', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-green">✓ <?php esc_html_e( '啟用', '2meet-data-optimizer' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span style="color:#721c24">✗ <?php esc_html_e( '停用', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-dark-red">✗ <?php esc_html_e( '停用', '2meet-data-optimizer' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<span style="display:inline-block;padding:2px 8px;border-radius:3px;font-size:12px;<?php echo esc_attr( $style ); ?>">
|
||||
<span class="<?php echo esc_attr( $mode_cls ); ?>">
|
||||
<?php echo esc_html( $mode ); ?>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ( empty( $groups ) ) : ?>
|
||||
<span style="color:#999"><?php esc_html_e( '(無)', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-muted"><?php esc_html_e( '(無)', '2meet-data-optimizer' ); ?></span>
|
||||
<?php else : ?>
|
||||
<?php foreach ( $groups as $g ) : ?>
|
||||
<code style="margin-right:4px"><?php echo esc_html( $g ); ?></code>
|
||||
<code><?php echo esc_html( $g ); ?></code>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
@@ -1529,18 +1523,18 @@ class TMDO_Admin {
|
||||
* Entity Bridge tab: health cards + migration wizard for user/term/comment.
|
||||
*/
|
||||
private static function render_entity_bridge(): void {
|
||||
$mode_order = array( 'disabled', 'dual_write', 'shadow_read', 'aeav_only' );
|
||||
$mode_labels = array(
|
||||
$mode_order = array( 'disabled', 'dual_write', 'shadow_read', 'aeav_only' );
|
||||
$mode_labels = array(
|
||||
'disabled' => 'disabled',
|
||||
'dual_write' => 'dual_write',
|
||||
'shadow_read' => 'shadow_read',
|
||||
'aeav_only' => 'aeav_only',
|
||||
);
|
||||
$mode_style = array(
|
||||
'disabled' => 'background:#e0e0e0;color:#444',
|
||||
'dual_write' => 'background:#d4edda;color:#155724',
|
||||
'shadow_read' => 'background:#fff3cd;color:#856404',
|
||||
'aeav_only' => 'background:#cce5ff;color:#004085',
|
||||
$mode_cls_map = array(
|
||||
'disabled' => 'wpdo-mode-disabled',
|
||||
'dual_write' => 'wpdo-mode-dual-write',
|
||||
'shadow_read' => 'wpdo-mode-shadow-read',
|
||||
'aeav_only' => 'wpdo-mode-aeav-only',
|
||||
);
|
||||
|
||||
$health_data = class_exists( 'TMDO_Entity_Health' ) ? TMDO_Entity_Health::get_all() : array();
|
||||
@@ -1559,7 +1553,7 @@ class TMDO_Admin {
|
||||
<?php esc_html_e( '以下四張健康卡片顯示 user / post / term / comment entity 目前的遷移狀態與覆蓋率。可在此直接觸發 Backfill、升級或降級模式。進度每 5 秒自動更新(user/term/comment);post 進度需手動重整。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
|
||||
<div class="wpdo-entity-bridge-grid" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(380px,1fr));gap:20px;margin-top:20px;">
|
||||
<div class="wpdo-eb-grid">
|
||||
<?php
|
||||
foreach ( array( 'user', 'post', 'term', 'comment' ) as $etype ) :
|
||||
$info = $health_data[ $etype ] ?? array();
|
||||
@@ -1572,44 +1566,42 @@ class TMDO_Admin {
|
||||
$next_mode = $info['next_mode'] ?? null;
|
||||
$prev_mode = $info['prev_mode'] ?? null;
|
||||
$bf_active = $info['backfill_active'] ?? false;
|
||||
$badge_style = $mode_style[ $mode ] ?? 'background:#e0e0e0;color:#444';
|
||||
$badge_mode_cls = $mode_cls_map[ $mode ] ?? 'wpdo-mode-disabled';
|
||||
$native_entity_table = $info['native_entity_table'] ?? '';
|
||||
$native_entity_count = (int) ( $info['native_entity_count'] ?? 0 );
|
||||
$native_meta_table = $info['native_meta_table'] ?? '';
|
||||
$native_meta_count = (int) ( $info['native_meta_count'] ?? 0 );
|
||||
?>
|
||||
<div class="wpdo-card" data-entity-type="<?php echo esc_attr( $etype ); ?>"
|
||||
style="padding:20px;border-radius:8px;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.1);">
|
||||
<div class="wpdo-eb-card" data-entity-type="<?php echo esc_attr( $etype ); ?>">
|
||||
|
||||
<!-- Header -->
|
||||
<div style="display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px;">
|
||||
<div class="wpdo-eb-header">
|
||||
<div>
|
||||
<h3 style="margin:0 0 4px;font-size:16px;"><?php echo esc_html( ucfirst( $etype ) ); ?> Entity</h3>
|
||||
<span class="wpdo-mode-badge" style="display:inline-block;padding:2px 10px;border-radius:20px;font-size:12px;font-weight:600;<?php echo esc_attr( $badge_style ); ?>">
|
||||
<h3 class="wpdo-eb-title"><?php echo esc_html( ucfirst( $etype ) ); ?> Entity</h3>
|
||||
<span class="wpdo-mode-badge <?php echo esc_attr( $badge_mode_cls ); ?>">
|
||||
<?php echo esc_html( $mode ); ?>
|
||||
</span>
|
||||
<span class="wpdo-mode-days" style="margin-left:8px;font-size:12px;color:#666;">
|
||||
<span class="wpdo-mode-days">
|
||||
<?php echo esc_html( $mode_days ); ?> 天
|
||||
</span>
|
||||
</div>
|
||||
<?php if ( $bf_active ) : ?>
|
||||
<span style="font-size:12px;color:#856404;background:#fff3cd;padding:2px 8px;border-radius:4px;">
|
||||
<span class="wpdo-mode-warn-sm">
|
||||
⟳ <?php esc_html_e( 'Backfill 執行中', '2meet-data-optimizer' ); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Pipeline -->
|
||||
<div class="wpdo-pipeline" style="display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-bottom:16px;font-size:11px;">
|
||||
<div class="wpdo-pipeline wpdo-eb-pipeline">
|
||||
<?php
|
||||
foreach ( $mode_order as $i => $m ) :
|
||||
$active = ( $m === $mode );
|
||||
?>
|
||||
<?php if ( $i > 0 ) : ?>
|
||||
<span style="color:#999;">→</span>
|
||||
<span class="wpdo-pipeline-arrow">→</span>
|
||||
<?php endif; ?>
|
||||
<span class="wpdo-pipeline-dot <?php echo $active ? 'wpdo-pipeline-active' : ''; ?>"
|
||||
style="padding:2px 8px;border-radius:3px;<?php echo $active ? esc_attr( $badge_style ) : 'background:#f0f0f0;color:#666'; ?>">
|
||||
<span class="wpdo-pipeline-dot wpdo-stage-pill <?php echo $active ? esc_attr( $badge_mode_cls ) : 'wpdo-stage-pill--inactive'; ?>">
|
||||
<?php echo esc_html( $mode_labels[ $m ] ); ?>
|
||||
</span>
|
||||
<?php endforeach; ?>
|
||||
@@ -1617,18 +1609,17 @@ class TMDO_Admin {
|
||||
|
||||
<!-- Native EAV counts -->
|
||||
<?php if ( $native_entity_table || $native_meta_table ) : ?>
|
||||
<div class="wpdo-native-counts"
|
||||
style="margin-bottom:14px;padding:6px 10px;background:#f8f9fa;border-radius:4px;font-size:12px;color:#555;display:flex;flex-wrap:wrap;gap:4px;align-items:center;">
|
||||
<span style="font-weight:600;margin-right:4px;"><?php esc_html_e( '原生資料:', '2meet-data-optimizer' ); ?></span>
|
||||
<div class="wpdo-native-counts">
|
||||
<span class="wpdo-eb-tables-label"><?php esc_html_e( '原生資料:', '2meet-data-optimizer' ); ?></span>
|
||||
<?php if ( $native_entity_table ) : ?>
|
||||
<code style="font-size:11px;"><?php echo esc_html( $native_entity_table ); ?></code>
|
||||
<code class="wpdo-code-xs"><?php echo esc_html( $native_entity_table ); ?></code>
|
||||
<span><?php echo esc_html( number_format( $native_entity_count ) ); ?> <?php esc_html_e( '筆', '2meet-data-optimizer' ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ( $native_entity_table && $native_meta_table ) : ?>
|
||||
<span style="color:#ccc;">|</span>
|
||||
<span class="wpdo-eb-sep">|</span>
|
||||
<?php endif; ?>
|
||||
<?php if ( $native_meta_table ) : ?>
|
||||
<code style="font-size:11px;"><?php echo esc_html( $native_meta_table ); ?></code>
|
||||
<code class="wpdo-code-xs"><?php echo esc_html( $native_meta_table ); ?></code>
|
||||
<span><?php echo esc_html( number_format( $native_meta_count ) ); ?> <?php esc_html_e( '筆 meta', '2meet-data-optimizer' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -1636,8 +1627,8 @@ class TMDO_Admin {
|
||||
|
||||
<!-- Groups / Coverage -->
|
||||
<?php if ( ! empty( $groups ) ) : ?>
|
||||
<div style="margin-bottom:14px;">
|
||||
<strong style="font-size:12px;text-transform:uppercase;color:#666;letter-spacing:.5px;">
|
||||
<div class="wpdo-eb-section">
|
||||
<strong class="wpdo-eb-section-title">
|
||||
<?php esc_html_e( '群組覆蓋率', '2meet-data-optimizer' ); ?>
|
||||
</strong>
|
||||
<?php
|
||||
@@ -1645,35 +1636,35 @@ class TMDO_Admin {
|
||||
$cov_pct = (float) ( $g['coverage_pct'] ?? 0 );
|
||||
$bar_color = $cov_pct >= 99 ? '#28a745' : ( $cov_pct >= 50 ? '#ffc107' : '#dc3545' );
|
||||
?>
|
||||
<div data-group="<?php echo esc_attr( $g['name'] ); ?>" style="margin-top:8px;">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:3px;">
|
||||
<span style="font-size:13px;font-weight:500;"><?php echo esc_html( $g['name'] ); ?></span>
|
||||
<span style="font-size:12px;color:#666;">
|
||||
<code style="font-size:11px;"><?php echo esc_html( $g['fields_count'] ); ?> 欄位</code>
|
||||
<div data-group="<?php echo esc_attr( $g['name'] ); ?>" class="wpdo-eb-group">
|
||||
<div class="wpdo-eb-group-header">
|
||||
<span class="wpdo-eb-group-name"><?php echo esc_html( $g['name'] ); ?></span>
|
||||
<span class="wpdo-eb-group-meta">
|
||||
<code class="wpdo-code-xs"><?php echo esc_html( $g['fields_count'] ); ?> 欄位</code>
|
||||
|
||||
<span class="wpdo-mig-status" style="font-size:11px;padding:1px 6px;border-radius:3px;background:#f0f0f0;">
|
||||
<span class="wpdo-mig-status">
|
||||
<?php echo esc_html( $g['migration_status'] ?? 'not_started' ); ?>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;gap:8px;">
|
||||
<div style="flex:1;height:8px;background:#e0e0e0;border-radius:4px;overflow:hidden;">
|
||||
<div class="wpdo-eb-group-bar-row">
|
||||
<div class="wpdo-eb-bar-track">
|
||||
<div class="wpdo-cov-bar-fill"
|
||||
style="height:100%;background:<?php echo esc_attr( $bar_color ); ?>;width:<?php echo esc_attr( $cov_pct ); ?>%;transition:width .4s ease;border-radius:4px;">
|
||||
style="--wpdo-cov-pct:<?php echo esc_attr( (string) $cov_pct ); ?>%;--wpdo-cov-color:<?php echo esc_attr( $bar_color ); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<span class="wpdo-cov-pct" style="font-size:12px;min-width:42px;text-align:right;color:#333;">
|
||||
<span class="wpdo-cov-pct">
|
||||
<?php echo esc_html( number_format( $cov_pct, 1 ) ); ?>%
|
||||
</span>
|
||||
</div>
|
||||
<div style="font-size:11px;color:#888;margin-top:2px;">
|
||||
<div class="wpdo-eb-key-hint">
|
||||
<?php esc_html_e( 'flat:', '2meet-data-optimizer' ); ?>
|
||||
<span class="wpdo-cov-rows">
|
||||
<?php echo esc_html( $g['flat_rows'] ); ?> / <?php echo esc_html( $g['eav_rows'] ); ?> EAV
|
||||
</span>
|
||||
</div>
|
||||
<?php if ( $g['table_exists'] ) : ?>
|
||||
<div style="margin-top:6px;">
|
||||
<div class="wpdo-eb-actions">
|
||||
<button type="button"
|
||||
class="button button-small"
|
||||
data-wpdo-action="backfill"
|
||||
@@ -1687,11 +1678,11 @@ class TMDO_Admin {
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div style="margin-bottom:14px;">
|
||||
<p class="description" style="margin:0 0 6px;font-size:13px;">
|
||||
<div class="wpdo-eb-section">
|
||||
<p class="description">
|
||||
<?php esc_html_e( '(尚無已登錄的欄位群組)', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
<p style="margin:0;font-size:12px;color:#856404;background:#fff3cd;padding:6px 10px;border-radius:4px;line-height:1.6;">
|
||||
<p class="wpdo-eb-warn-box">
|
||||
<?php
|
||||
esc_html_e(
|
||||
'Hook Bus 已設定攔截此 entity type,但目前尚無 partner plugin 透過 wpdo_register_entity_fields 登錄欄位群組。Flat table 不會自動建立——直到有群組被登錄後才開始生效。',
|
||||
@@ -1704,24 +1695,26 @@ class TMDO_Admin {
|
||||
|
||||
<!-- Shadow diffs -->
|
||||
<?php if ( 'shadow_read' === $mode ) : ?>
|
||||
<div style="margin-bottom:12px;padding:8px;background:#f8f9fa;border-radius:4px;font-size:13px;">
|
||||
<div class="wpdo-eb-shadow-row">
|
||||
<?php esc_html_e( 'Shadow Diffs:', '2meet-data-optimizer' ); ?>
|
||||
<strong class="wpdo-shadow-diffs" style="color:<?php echo $diffs > 0 ? '#dc3545' : '#28a745'; ?>;">
|
||||
<?php $diffs_cls = $diffs > 0 ? 'wpdo-eb-shadow-warn' : 'wpdo-text-green-bold'; ?>
|
||||
<strong class="wpdo-shadow-diffs <?php echo esc_attr( $diffs_cls ); ?>">
|
||||
<?php echo esc_html( $diffs ); ?>
|
||||
</strong>
|
||||
<?php if ( $diffs > 0 ) : ?>
|
||||
<span style="color:#666;font-size:12px;"> — <?php esc_html_e( '請調查差異後再升級', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-muted"> — <?php esc_html_e( '請調查差異後再升級', '2meet-data-optimizer' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span style="color:#28a745;font-size:12px;"> ✓ <?php esc_html_e( '無差異', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-eb-shadow-ok"> ✓ <?php esc_html_e( '無差異', '2meet-data-optimizer' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Auto-promote status -->
|
||||
<?php if ( ! empty( $ap ) ) : ?>
|
||||
<div style="margin-bottom:12px;font-size:12px;color:#666;">
|
||||
<div class="wpdo-eb-promote-row">
|
||||
<?php esc_html_e( 'Auto-promote:', '2meet-data-optimizer' ); ?>
|
||||
<span class="wpdo-auto-promote-eligible" style="color:<?php echo ! empty( $ap['eligible'] ) ? '#155724' : '#856404'; ?>;">
|
||||
<?php $ap_cls = ! empty( $ap['eligible'] ) ? 'wpdo-eb-auto-ok' : 'wpdo-eb-auto-warn'; ?>
|
||||
<span class="wpdo-auto-promote-eligible <?php echo esc_attr( $ap_cls ); ?>">
|
||||
<?php if ( ! empty( $ap['eligible'] ) ) : ?>
|
||||
✓ <?php esc_html_e( '可升級', '2meet-data-optimizer' ); ?>
|
||||
<?php else : ?>
|
||||
@@ -1729,7 +1722,7 @@ class TMDO_Admin {
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<?php if ( $ap['enabled'] ?? false ) : ?>
|
||||
<span style="background:#d4edda;color:#155724;padding:1px 5px;border-radius:3px;margin-left:4px;font-size:11px;">
|
||||
<span class="wpdo-eb-auto-badge">
|
||||
<?php esc_html_e( '自動', '2meet-data-optimizer' ); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
@@ -1738,14 +1731,13 @@ class TMDO_Admin {
|
||||
|
||||
<!-- Recommendation -->
|
||||
<?php if ( $rec ) : ?>
|
||||
<div class="wpdo-recommendation"
|
||||
style="margin-bottom:14px;padding:8px 10px;background:#f0f4ff;border-left:3px solid #4f6ef7;border-radius:0 4px 4px 0;font-size:13px;color:#333;">
|
||||
<div class="wpdo-recommendation">
|
||||
<?php echo esc_html( $rec ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Action buttons -->
|
||||
<div style="display:flex;gap:8px;flex-wrap:wrap;">
|
||||
<div class="wpdo-eb-button-row">
|
||||
<button type="button"
|
||||
class="button wpdo-btn-promote"
|
||||
data-wpdo-action="promote"
|
||||
@@ -1756,25 +1748,25 @@ class TMDO_Admin {
|
||||
↑ <?php esc_html_e( '升級模式', '2meet-data-optimizer' ); ?>
|
||||
</button>
|
||||
<button type="button"
|
||||
class="button wpdo-btn-demote"
|
||||
class="button wpdo-btn-demote <?php echo $prev_mode ? '' : 'wpdo-eb-btn-dim'; ?>"
|
||||
data-wpdo-action="demote"
|
||||
data-entity-type="<?php echo esc_attr( $etype ); ?>"
|
||||
data-prev-mode="<?php echo esc_attr( $prev_mode ?? '' ); ?>"
|
||||
<?php disabled( ! $prev_mode ); ?>
|
||||
title="<?php echo esc_attr( $prev_mode ? '降級到 ' . $prev_mode : '已在最低模式' ); ?>"
|
||||
style="<?php echo $prev_mode ? '' : 'opacity:.5;'; ?>">
|
||||
class="<?php echo $prev_mode ? '' : 'wpdo-eb-btn-dim'; ?>">
|
||||
↓ <?php esc_html_e( '降級模式', '2meet-data-optimizer' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div><!-- .wpdo-card -->
|
||||
</div><!-- .wpdo-eb-card -->
|
||||
<?php endforeach; ?>
|
||||
</div><!-- .wpdo-entity-bridge-grid -->
|
||||
|
||||
<!-- Migration Guide -->
|
||||
<div class="wpdo-card wpdo-card-wide" style="margin-top:24px;padding:20px;background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.1);">
|
||||
<h3 style="margin-top:0;"><?php esc_html_e( '遷移路徑說明', '2meet-data-optimizer' ); ?></h3>
|
||||
<ol style="margin-left:20px;line-height:1.9;font-size:13px;">
|
||||
<div class="wpdo-eb-footer">
|
||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '遷移路徑說明', '2meet-data-optimizer' ); ?></h3>
|
||||
<ol class="wpdo-eb-ol">
|
||||
<li>
|
||||
<strong>disabled → dual_write</strong>:
|
||||
<?php esc_html_e( 'Hook Bus 開始對 flat table 雙寫(讀取仍走原生 EAV)。此步驟安全,可隨時回退。', '2meet-data-optimizer' ); ?>
|
||||
@@ -1796,7 +1788,7 @@ class TMDO_Admin {
|
||||
<?php esc_html_e( '所有讀寫均走 flat table,原生 EAV 不再寫入。效能最佳,適合生產環境。', '2meet-data-optimizer' ); ?>
|
||||
</li>
|
||||
</ol>
|
||||
<p class="description" style="margin-top:8px;">
|
||||
<p class="description wpdo-mt-1">
|
||||
<?php esc_html_e( '任何步驟均可透過「降級模式」安全回退(EAV 資料一直保留直到 aeav_only)。Auto-promote 設定請前往', '2meet-data-optimizer' ); ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'tools.php?page=wp-data-optimizer&tab=settings' ) ); ?>">
|
||||
<?php esc_html_e( '設定頁面', '2meet-data-optimizer' ); ?>
|
||||
@@ -1980,7 +1972,7 @@ class TMDO_Admin {
|
||||
<h2><?php esc_html_e( 'User Entity 壓力測試 & Benchmark', '2meet-data-optimizer' ); ?></h2>
|
||||
|
||||
<!-- Warning banner -->
|
||||
<div style="margin:14px 0;padding:12px 14px;background:#f8d7da;color:#721c24;border-left:4px solid #dc3545;border-radius:4px;font-size:13px;line-height:1.6;">
|
||||
<div class="wpdo-notice-error">
|
||||
⚠️ <strong><?php esc_html_e( '此工具僅供開發 / 測試環境使用。', '2meet-data-optimizer' ); ?></strong>
|
||||
<?php esc_html_e( '它會建立大量測試使用者並填滿所有 user 相關 flat tables(hot / cold / membership / activity / profile / sso / points_ledger)。請勿在生產環境執行。', '2meet-data-optimizer' ); ?>
|
||||
</div>
|
||||
@@ -1989,15 +1981,15 @@ class TMDO_Admin {
|
||||
<?php esc_html_e( '透過自動產生大量測試使用者,評估 user entity 反 EAV 系統在不同規模下的寫入吞吐、DB 容量與查詢效能。所有測試使用者均以 test{n} 命名、密碼為 PassWord2026!,可一鍵清除。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px;">
|
||||
<div class="wpdo-grid-2col">
|
||||
|
||||
<!-- Left: Configure & Start -->
|
||||
<div class="wpdo-card" style="padding:20px;background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);">
|
||||
<h3 style="margin-top:0;"><?php esc_html_e( '1. 設定並啟動測試', '2meet-data-optimizer' ); ?></h3>
|
||||
<div class="wpdo-eb-card">
|
||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '1. 設定並啟動測試', '2meet-data-optimizer' ); ?></h3>
|
||||
|
||||
<table class="form-table" style="margin-top:0;">
|
||||
<table class="form-table wpdo-form-table-mt0">
|
||||
<tr>
|
||||
<th style="width:35%;"><label for="wpdo-st-target"><?php esc_html_e( '要建立的使用者數', '2meet-data-optimizer' ); ?></label></th>
|
||||
<th class="wpdo-th-main"><label for="wpdo-st-target"><?php esc_html_e( '要建立的使用者數', '2meet-data-optimizer' ); ?></label></th>
|
||||
<td>
|
||||
<input type="number" id="wpdo-st-target" min="1" max="1000000" value="1000" class="regular-text" />
|
||||
<p class="description"><?php esc_html_e( '常用:100 / 1,000 / 10,000 / 100,000', '2meet-data-optimizer' ); ?></p>
|
||||
@@ -2006,11 +1998,11 @@ class TMDO_Admin {
|
||||
<tr>
|
||||
<th><label><?php esc_html_e( '寫入模式', '2meet-data-optimizer' ); ?></label></th>
|
||||
<td>
|
||||
<label style="display:block;margin-bottom:6px;">
|
||||
<label class="wpdo-label-block">
|
||||
<input type="radio" name="wpdo-st-mode" value="fast" checked />
|
||||
<strong>Fast</strong> — <?php esc_html_e( '直接 bulk INSERT,跳過 hooks(~5,000-10,000 users/秒)', '2meet-data-optimizer' ); ?>
|
||||
</label>
|
||||
<label style="display:block;">
|
||||
<label>
|
||||
<input type="radio" name="wpdo-st-mode" value="realistic" />
|
||||
<strong>Realistic</strong> — <?php esc_html_e( '走 wp_insert_user + Hook Bus(~50-200 users/秒,測試生產路徑)', '2meet-data-optimizer' ); ?>
|
||||
</label>
|
||||
@@ -2036,11 +2028,11 @@ class TMDO_Admin {
|
||||
</div>
|
||||
|
||||
<!-- Right: Cleanup -->
|
||||
<div class="wpdo-card" style="padding:20px;background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);">
|
||||
<h3 style="margin-top:0;"><?php esc_html_e( '清除測試資料', '2meet-data-optimizer' ); ?></h3>
|
||||
<div class="wpdo-eb-card">
|
||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '清除測試資料', '2meet-data-optimizer' ); ?></h3>
|
||||
<p>
|
||||
<?php esc_html_e( '目前 test_* 使用者數量:', '2meet-data-optimizer' ); ?>
|
||||
<strong id="wpdo-st-count" style="font-size:18px;color:#dc3545;">
|
||||
<strong id="wpdo-st-count" class="wpdo-count-danger">
|
||||
<?php echo esc_html( number_format( $test_user_count ) ); ?>
|
||||
</strong>
|
||||
</p>
|
||||
@@ -2053,7 +2045,7 @@ class TMDO_Admin {
|
||||
</button>
|
||||
</p>
|
||||
|
||||
<hr style="margin:18px 0;" />
|
||||
<hr class="wpdo-hr-section" />
|
||||
|
||||
<p>
|
||||
<button type="button" class="button" id="wpdo-st-rerun-bench" <?php disabled( $is_running || 0 === $test_user_count ); ?>>
|
||||
@@ -2067,42 +2059,42 @@ class TMDO_Admin {
|
||||
</div>
|
||||
|
||||
<!-- Progress section (live) -->
|
||||
<div id="wpdo-st-progress-card" class="wpdo-card" style="margin-top:20px;padding:20px;background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);<?php echo $is_running ? '' : 'display:none;'; ?>">
|
||||
<h3 style="margin-top:0;"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
||||
<div style="margin-bottom:10px;">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-size:13px;">
|
||||
<div id="wpdo-st-progress-card" class="wpdo-eb-card wpdo-mt-3<?php echo $is_running ? '' : ' wpdo-hidden'; ?>">
|
||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
||||
<div class="wpdo-bar-section">
|
||||
<div class="wpdo-bar-header">
|
||||
<span><strong id="wpdo-st-pg-status"><?php echo esc_html( $status ); ?></strong> · <span id="wpdo-st-pg-mode"><?php echo esc_html( $state['mode'] ?? '' ); ?></span> mode</span>
|
||||
<span id="wpdo-st-pg-pct" style="font-weight:600;"><?php echo esc_html( $state['pct'] ?? 0 ); ?>%</span>
|
||||
<span id="wpdo-st-pg-pct" class="wpdo-bar-pct"><?php echo esc_html( $state['pct'] ?? 0 ); ?>%</span>
|
||||
</div>
|
||||
<div style="height:14px;background:#e0e0e0;border-radius:7px;overflow:hidden;">
|
||||
<div id="wpdo-st-pg-bar" style="height:100%;background:linear-gradient(90deg,#28a745,#20c997);width:<?php echo esc_attr( $state['pct'] ?? 0 ); ?>%;transition:width .4s;"></div>
|
||||
<div class="wpdo-bar-track">
|
||||
<div id="wpdo-st-pg-bar" class="wpdo-bar-fill" style="--wpdo-bar-width:<?php echo esc_attr( (string) ( $state['pct'] ?? 0 ) ); ?>%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<table style="width:100%;font-size:13px;margin-top:10px;border-collapse:collapse;">
|
||||
<table class="wpdo-stats-table">
|
||||
<tr>
|
||||
<td style="padding:6px;color:#666;"><?php esc_html_e( '已建立', '2meet-data-optimizer' ); ?></td>
|
||||
<td style="padding:6px;font-weight:600;"><span id="wpdo-st-pg-processed"><?php echo esc_html( $state['processed'] ?? 0 ); ?></span> / <span id="wpdo-st-pg-target"><?php echo esc_html( $state['target'] ?? 0 ); ?></span></td>
|
||||
<td style="padding:6px;color:#666;"><?php esc_html_e( '速率', '2meet-data-optimizer' ); ?></td>
|
||||
<td style="padding:6px;font-weight:600;"><span id="wpdo-st-pg-rate"><?php echo esc_html( $state['rate_per_sec'] ?? 0 ); ?></span> users/sec</td>
|
||||
<td class="wpdo-td-muted"><?php esc_html_e( '已建立', '2meet-data-optimizer' ); ?></td>
|
||||
<td class="wpdo-td-val"><span id="wpdo-st-pg-processed"><?php echo esc_html( $state['processed'] ?? 0 ); ?></span> / <span id="wpdo-st-pg-target"><?php echo esc_html( $state['target'] ?? 0 ); ?></span></td>
|
||||
<td class="wpdo-td-muted"><?php esc_html_e( '速率', '2meet-data-optimizer' ); ?></td>
|
||||
<td class="wpdo-td-val"><span id="wpdo-st-pg-rate"><?php echo esc_html( $state['rate_per_sec'] ?? 0 ); ?></span> users/sec</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:6px;color:#666;"><?php esc_html_e( '已耗時', '2meet-data-optimizer' ); ?></td>
|
||||
<td style="padding:6px;"><span id="wpdo-st-pg-elapsed"><?php echo esc_html( $state['elapsed_sec'] ?? 0 ); ?></span> 秒</td>
|
||||
<td style="padding:6px;color:#666;"><?php esc_html_e( '預估剩餘', '2meet-data-optimizer' ); ?></td>
|
||||
<td style="padding:6px;"><span id="wpdo-st-pg-eta"><?php echo esc_html( $state['eta_sec'] ?? 0 ); ?></span> 秒</td>
|
||||
<td class="wpdo-td-muted"><?php esc_html_e( '已耗時', '2meet-data-optimizer' ); ?></td>
|
||||
<td class="wpdo-td"><span id="wpdo-st-pg-elapsed"><?php echo esc_html( $state['elapsed_sec'] ?? 0 ); ?></span> 秒</td>
|
||||
<td class="wpdo-td-muted"><?php esc_html_e( '預估剩餘', '2meet-data-optimizer' ); ?></td>
|
||||
<td class="wpdo-td"><span id="wpdo-st-pg-eta"><?php echo esc_html( $state['eta_sec'] ?? 0 ); ?></span> 秒</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:6px;color:#666;"><?php esc_html_e( '完成批次', '2meet-data-optimizer' ); ?></td>
|
||||
<td style="padding:6px;"><span id="wpdo-st-pg-batches"><?php echo esc_html( $state['batches_done'] ?? 0 ); ?></span></td>
|
||||
<td style="padding:6px;color:#666;"><?php esc_html_e( 'PHP Peak Mem', '2meet-data-optimizer' ); ?></td>
|
||||
<td style="padding:6px;"><span id="wpdo-st-pg-mem"><?php echo esc_html( round( ( $state['peak_memory'] ?? 0 ) / 1048576, 1 ) ); ?></span> MB</td>
|
||||
<td class="wpdo-td-muted"><?php esc_html_e( '完成批次', '2meet-data-optimizer' ); ?></td>
|
||||
<td class="wpdo-td"><span id="wpdo-st-pg-batches"><?php echo esc_html( $state['batches_done'] ?? 0 ); ?></span></td>
|
||||
<td class="wpdo-td-muted"><?php esc_html_e( 'PHP Peak Mem', '2meet-data-optimizer' ); ?></td>
|
||||
<td class="wpdo-td"><span id="wpdo-st-pg-mem"><?php echo esc_html( round( ( $state['peak_memory'] ?? 0 ) / 1048576, 1 ) ); ?></span> MB</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Benchmark report -->
|
||||
<div id="wpdo-st-bench-card" class="wpdo-card" style="margin-top:20px;padding:20px;background:#fff;border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.08);<?php echo ! empty( $state['benchmark'] ) ? '' : 'display:none;'; ?>">
|
||||
<h3 style="margin-top:0;"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
||||
<div id="wpdo-st-bench-card" class="wpdo-eb-card wpdo-mt-3<?php echo ! empty( $state['benchmark'] ) ? '' : ' wpdo-hidden'; ?>">
|
||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
||||
<div id="wpdo-st-bench-content">
|
||||
<?php if ( ! empty( $state['benchmark'] ) ) : ?>
|
||||
<?php self::render_stress_benchmark( $state['benchmark'] ); ?>
|
||||
@@ -2124,8 +2116,8 @@ class TMDO_Admin {
|
||||
$db_sizes = $bench['db_sizes'] ?? array();
|
||||
$query = $bench['query'] ?? array();
|
||||
?>
|
||||
<h4 style="margin-bottom:6px;">▍ <?php esc_html_e( '寫入指標', '2meet-data-optimizer' ); ?></h4>
|
||||
<table class="widefat" style="margin-bottom:14px;">
|
||||
<h4 class="wpdo-h4-mb">▍ <?php esc_html_e( '寫入指標', '2meet-data-optimizer' ); ?></h4>
|
||||
<table class="widefat wpdo-table-mb">
|
||||
<tbody>
|
||||
<tr><td><?php esc_html_e( '模式', '2meet-data-optimizer' ); ?></td><td><code><?php echo esc_html( $write['mode'] ?? '' ); ?></code></td></tr>
|
||||
<tr><td><?php esc_html_e( '完成 / 目標', '2meet-data-optimizer' ); ?></td><td><?php echo esc_html( number_format( (int) ( $write['processed'] ?? 0 ) ) ); ?> / <?php echo esc_html( number_format( (int) ( $write['target'] ?? 0 ) ) ); ?></td></tr>
|
||||
@@ -2137,8 +2129,8 @@ class TMDO_Admin {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h4 style="margin-bottom:6px;">▍ <?php esc_html_e( 'DB 容量(user 相關表)', '2meet-data-optimizer' ); ?></h4>
|
||||
<table class="widefat striped" style="margin-bottom:14px;">
|
||||
<h4 class="wpdo-h4-mb">▍ <?php esc_html_e( 'DB 容量(user 相關表)', '2meet-data-optimizer' ); ?></h4>
|
||||
<table class="widefat striped wpdo-table-mb">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Table', '2meet-data-optimizer' ); ?></th>
|
||||
@@ -2163,8 +2155,8 @@ class TMDO_Admin {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h4 style="margin-bottom:6px;">▍ <?php esc_html_e( '查詢效能', '2meet-data-optimizer' ); ?></h4>
|
||||
<table class="widefat striped" style="margin-bottom:8px;">
|
||||
<h4 class="wpdo-h4-mb">▍ <?php esc_html_e( '查詢效能', '2meet-data-optimizer' ); ?></h4>
|
||||
<table class="widefat striped wpdo-table-mb-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php esc_html_e( '測試項目', '2meet-data-optimizer' ); ?></th>
|
||||
@@ -2259,7 +2251,7 @@ class TMDO_Admin {
|
||||
}
|
||||
}
|
||||
?>
|
||||
<hr style="margin:2em 0">
|
||||
<hr>
|
||||
<h2><?php esc_html_e( 'Entity 欄位登錄(user / term / comment)', '2meet-data-optimizer' ); ?></h2>
|
||||
<p class="description">
|
||||
<?php esc_html_e( '透過 wpdo_register_entity_fields action 登錄的非 postmeta 欄位。Hook Bus 啟用後,這些欄位的讀寫會被路由至對應的 flat table。', '2meet-data-optimizer' ); ?>
|
||||
@@ -2275,38 +2267,32 @@ class TMDO_Admin {
|
||||
if ( empty( $e_groups ) ) {
|
||||
continue;
|
||||
}
|
||||
$e_mode = class_exists( 'TMDO_Mode_Manager' ) ? TMDO_Mode_Manager::get( $etype ) : 'disabled';
|
||||
$e_mode_bg = array(
|
||||
'disabled' => '#e0e0e0',
|
||||
'dual_write' => '#d4edda',
|
||||
'shadow_read' => '#fff3cd',
|
||||
'aeav_only' => '#cce5ff',
|
||||
);
|
||||
$badge_bg = $e_mode_bg[ $e_mode ] ?? '#e0e0e0';
|
||||
$e_mode = class_exists( 'TMDO_Mode_Manager' ) ? TMDO_Mode_Manager::get( $etype ) : 'disabled';
|
||||
$e_mode_cls = 'wpdo-badge-mode wpdo-mode-' . str_replace( '_', '-', $e_mode );
|
||||
?>
|
||||
<h3>
|
||||
<code><?php echo esc_html( $etype ); ?></code>
|
||||
<span style="display:inline-block;margin-left:8px;padding:2px 8px;border-radius:3px;font-size:11px;background:<?php echo esc_attr( $badge_bg ); ?>">
|
||||
<span class="<?php echo esc_attr( $e_mode_cls ); ?>">
|
||||
<?php echo esc_html( $e_mode ); ?>
|
||||
</span>
|
||||
</h3>
|
||||
<?php foreach ( $e_groups as $e_group ) : ?>
|
||||
<?php $e_fields = TMDO_Entity_Registry::get_group_fields( $etype, $e_group ); ?>
|
||||
<h4 style="margin-bottom:0.5em">
|
||||
<h4 class="wpdo-h4-mb">
|
||||
<?php esc_html_e( '群組:', '2meet-data-optimizer' ); ?>
|
||||
<code><?php echo esc_html( $e_group ); ?></code>
|
||||
<?php
|
||||
if ( class_exists( 'TMDO_Schema_Manager' ) ) {
|
||||
$e_tbl = TMDO_Schema_Manager::get_table_name( $etype, $e_group );
|
||||
if ( TMDO_Schema_Manager::table_exists( $e_tbl ) ) {
|
||||
echo '<span style="color:#155724;font-size:12px"> ✓ ' . esc_html( $e_tbl ) . '</span>';
|
||||
echo '<span class="wpdo-text-green wpdo-code-xs"> ✓ ' . esc_html( $e_tbl ) . '</span>';
|
||||
} else {
|
||||
echo '<span style="color:#856404;font-size:12px"> ⏳ ' . esc_html__( '表格尚未建立', '2meet-data-optimizer' ) . '</span>';
|
||||
echo '<span class="wpdo-text-olive wpdo-code-xs"> ⏳ ' . esc_html__( '表格尚未建立', '2meet-data-optimizer' ) . '</span>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</h4>
|
||||
<table class="widefat striped wpdo-table" style="margin-bottom:1.5em">
|
||||
<table class="widefat striped wpdo-table wpdo-table-mb">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Meta Key', '2meet-data-optimizer' ); ?></th>
|
||||
@@ -2873,12 +2859,12 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<form method="post" style="display:inline">
|
||||
<form method="post" class="wpdo-form-inline">
|
||||
<input type="hidden" name="wpdo_create_snapshot" value="1">
|
||||
<?php wp_nonce_field( 'wpdo_create_snapshot' ); ?>
|
||||
<button type="submit" class="button button-primary"><?php esc_html_e( '立即建立快照', '2meet-data-optimizer' ); ?></button>
|
||||
</form>
|
||||
<form method="post" style="display:inline">
|
||||
<form method="post" class="wpdo-form-inline">
|
||||
<input type="hidden" name="wpdo_prune_snapshots" value="1">
|
||||
<?php wp_nonce_field( 'wpdo_prune_snapshots' ); ?>
|
||||
<button type="submit" class="button"
|
||||
@@ -2913,7 +2899,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<td><?php echo esc_html( $row['created_at'] ); ?></td>
|
||||
<td><?php echo esc_html( (string) ( $row['expires_at'] ?? '—' ) ); ?></td>
|
||||
<td>
|
||||
<form method="post" style="display:inline">
|
||||
<form method="post" class="wpdo-form-inline">
|
||||
<input type="hidden" name="wpdo_delete_snapshot" value="<?php echo esc_attr( $row['snapshot_id'] ); ?>">
|
||||
<?php wp_nonce_field( 'wpdo_delete_snapshot' ); ?>
|
||||
<button type="submit" class="button button-small button-link-delete"
|
||||
@@ -2953,16 +2939,16 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
$summary = TMDO_Conflict_Monitor::get_summary();
|
||||
$total = (int) ( $summary['total'] ?? 0 );
|
||||
?>
|
||||
<table class="widefat striped" style="max-width:600px;">
|
||||
<table class="widefat striped wpdo-max-600">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e( '衝突總數', '2meet-data-optimizer' ); ?></th>
|
||||
<td>
|
||||
<?php if ( 0 === $total ) : ?>
|
||||
<span style="color:#46b450;font-weight:bold;">●</span>
|
||||
<span class="wpdo-text-ok">●</span>
|
||||
<?php esc_html_e( '無衝突', '2meet-data-optimizer' ); ?>
|
||||
<?php else : ?>
|
||||
<span style="color:#dc3232;font-weight:bold;">●</span>
|
||||
<span class="wpdo-text-err">●</span>
|
||||
<?php echo esc_html( (string) $total ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
@@ -2979,7 +2965,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
</table>
|
||||
<?php if ( $total > 0 ) : ?>
|
||||
<h3><?php esc_html_e( '詳細', '2meet-data-optimizer' ); ?></h3>
|
||||
<pre style="background:#f0f0f1;padding:1em;overflow:auto;max-height:400px;">
|
||||
<pre class="wpdo-pre-code">
|
||||
<?php
|
||||
echo esc_html( wp_json_encode( $summary, JSON_PRETTY_PRINT ) );
|
||||
?>
|
||||
@@ -3044,7 +3030,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="description" style="margin-top:1em;">
|
||||
<p class="description wpdo-description-mt">
|
||||
<?php esc_html_e( '結果由 5 分鐘 transient 快取;若剛操作完想立即重檢,請點刷新或等下一個快取週期。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
<?php
|
||||
@@ -3137,7 +3123,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
$bar_w = (int) round( $conf * 100 );
|
||||
$color = $conf >= 0.7 ? '#46b450' : ( $conf >= 0.5 ? '#dba617' : '#c3c4c7' );
|
||||
printf(
|
||||
'<tr><td><code>%s</code></td><td><div style="background:#f0f0f1;border-radius:3px;width:80px;height:18px;position:relative;"><div style="background:%s;width:%d%%;height:100%%;border-radius:3px;"></div><span style="position:absolute;inset:0;text-align:center;font-size:11px;line-height:18px;">%s</span></div></td>',
|
||||
'<tr><td><code>%s</code></td><td><div class="wpdo-advisor-bar-track" style="--wpdo-adv-color:%s;--wpdo-adv-width:%d%%"><div class="wpdo-advisor-bar-fill"></div><span class="wpdo-advisor-bar-label">%s</span></div></td>',
|
||||
esc_html( $module ),
|
||||
esc_attr( $color ),
|
||||
(int) $bar_w,
|
||||
@@ -3152,7 +3138,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
}
|
||||
echo '</td>';
|
||||
printf( '<td><code>%s</code></td>', esc_html( (string) $r['current_state'] ) );
|
||||
echo '<td><form method="post" style="display:inline">';
|
||||
echo '<td><form method="post" class="wpdo-form-inline">';
|
||||
printf( '<input type="hidden" name="wpdo_enable_module" value="%s">', esc_attr( $module ) );
|
||||
wp_nonce_field( 'wpdo_enable_module' );
|
||||
printf(
|
||||
@@ -3215,7 +3201,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
echo '</tbody></table></details>';
|
||||
}
|
||||
|
||||
echo '<p class="description" style="margin-top:1em;">' . esc_html__( '結果由 1 小時 transient 快取;每日健康檢查 cron 也會自動更新。', '2meet-data-optimizer' ) . '</p>';
|
||||
echo '<p class="description wpdo-description-mt">' . esc_html__( '結果由 1 小時 transient 快取;每日健康檢查 cron 也會自動更新。', '2meet-data-optimizer' ) . '</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3279,8 +3265,8 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
$ch_enabled = '1' === (string) get_option( "wpdo_{$ch}_enabled", '0' );
|
||||
$ch_throttle = (int) get_option( "wpdo_{$ch}_throttle_hours", 24 );
|
||||
$ch_severity = (string) get_option( "wpdo_{$ch}_severity", 'critical_only' );
|
||||
echo '<details' . ( $ch_enabled ? ' open' : '' ) . ' style="margin-top:1.5em;border:1px solid #c3c4c7;border-radius:3px;padding:0.6em 1em;">';
|
||||
echo '<summary style="cursor:pointer;font-weight:600;font-size:1.1em;">' . esc_html( $cfg[0] ) . '</summary>';
|
||||
echo '<details' . ( $ch_enabled ? ' open' : '' ) . ' class="wpdo-details-section">';
|
||||
echo '<summary class="wpdo-summary-section">' . esc_html( $cfg[0] ) . '</summary>';
|
||||
echo '<table class="form-table" role="presentation"><tbody>';
|
||||
printf(
|
||||
'<tr><th scope="row"><label>%s</label></th><td><label><input type="checkbox" name="wpdo_%s_enabled" value="1" %s> %s</label></td></tr>',
|
||||
@@ -3341,7 +3327,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
</div>
|
||||
</div><!-- /.wpdo-settings-section -->
|
||||
<div class="wpdo-settings-section" data-section="entity-bridge">
|
||||
<h3 style="margin-top: 2em;"><?php esc_html_e( '⚡ Entity Bridge(v2.5.4 / post v2.11.0)', '2meet-data-optimizer' ); ?></h3>
|
||||
<h3 class="wpdo-h3-section"><?php esc_html_e( '⚡ Entity Bridge(v2.5.4 / post v2.11.0)', '2meet-data-optimizer' ); ?></h3>
|
||||
<p class="description">
|
||||
<?php esc_html_e( 'Hook Bus 攔截 WordPress 原生 metadata filter,將 user / post / term / comment meta 路由至扁平化資料表。', '2meet-data-optimizer' ); ?><br>
|
||||
<?php esc_html_e( '模式說明:', '2meet-data-optimizer' ); ?>
|
||||
@@ -3389,7 +3375,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<p class="description" style="margin-top:0.25em;">
|
||||
<p class="description wpdo-description-sm">
|
||||
<?php
|
||||
if ( class_exists( 'TMDO_Mode_Manager' ) ) {
|
||||
echo esc_html( TMDO_Mode_Manager::description( $current_mode ) );
|
||||
@@ -3423,7 +3409,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
</div>
|
||||
</div><!-- /.wpdo-settings-section -->
|
||||
<div class="wpdo-settings-section" data-section="hp-transient">
|
||||
<h3 style="margin-top: 2em;"><?php esc_html_e( '🌿 HivePress Transient Filter(v2.11.5)', '2meet-data-optimizer' ); ?></h3>
|
||||
<h3 class="wpdo-h3-section"><?php esc_html_e( '🌿 HivePress Transient Filter(v2.11.5)', '2meet-data-optimizer' ); ?></h3>
|
||||
<p class="description">
|
||||
<?php esc_html_e( 'HivePress 內部用 update_post_meta($post_id, \'_transient_<name>\', $value) 把 TTL cache 寫進 wp_postmeta(每個 hp_listing publish 觸發 8-16 個 transient row)。本 filter 在 metadata 層攔截並重新路由到 wp_options(native transient API),HivePress 完全無感,wp_postmeta 保持乾淨。Filter 是 metadata 層運作,不依賴 mode promote。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
@@ -3436,7 +3422,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<input type="checkbox" name="wpdo_hp_transient_filter_enabled" value="1" <?php checked( $hp_filter_enabled ); ?>>
|
||||
<?php esc_html_e( '攔截 _transient_hp_* postmeta 讀寫並路由至 wp_options(預設啟用)', '2meet-data-optimizer' ); ?>
|
||||
</label>
|
||||
<p class="description" style="margin-top:0.5em;font-size:12px;">
|
||||
<p class="description wpdo-description-xs">
|
||||
<?php esc_html_e( '停用此選項會讓未來新建的 hp_listing 重新把 transient cache 寫進 wp_postmeta(不建議,除非要 debug HivePress 行為)。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
@@ -3444,14 +3430,14 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e( '當前狀態', '2meet-data-optimizer' ); ?></th>
|
||||
<td>
|
||||
<table class="widefat striped" style="max-width:600px;">
|
||||
<table class="widefat striped wpdo-max-600">
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Filter 啟用', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<?php if ( $hp_filter_enabled ) : ?>
|
||||
<span style="color:#28a745;font-weight:600;">✓ <?php esc_html_e( '啟用中', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-green-bold">✓ <?php esc_html_e( '啟用中', '2meet-data-optimizer' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span style="color:#dc3545;font-weight:600;">✗ <?php esc_html_e( '已停用', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-red-bold">✗ <?php esc_html_e( '已停用', '2meet-data-optimizer' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -3459,11 +3445,11 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<td><?php esc_html_e( 'wp_postmeta 殘留 (legacy)', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<?php if ( $hp_legacy_count > 0 ) : ?>
|
||||
<strong style="color:#dc3545;"><?php echo esc_html( number_format_i18n( $hp_legacy_count ) ); ?></strong> rows
|
||||
<code style="margin-left:8px;font-size:11px;">wp wpdo cleanup-hp-transients --dry-run</code>
|
||||
<strong class="wpdo-text-red-bold"><?php echo esc_html( number_format_i18n( $hp_legacy_count ) ); ?></strong> rows
|
||||
<code class="wpdo-code-sm">wp wpdo cleanup-hp-transients --dry-run</code>
|
||||
<?php else : ?>
|
||||
<strong style="color:#28a745;">0 rows ✓</strong>
|
||||
<span style="color:#666;font-size:12px;margin-left:8px;"><?php esc_html_e( '(已清乾淨)', '2meet-data-optimizer' ); ?></span>
|
||||
<strong class="wpdo-text-green-bold">0 rows ✓</strong>
|
||||
<span class="wpdo-text-muted wpdo-ml-2"><?php esc_html_e( '(已清乾淨)', '2meet-data-optimizer' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -3471,14 +3457,14 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<td><?php esc_html_e( 'wp_options 路由總量', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<strong><?php echo esc_html( number_format_i18n( $hp_routed_count ) ); ?></strong> rows
|
||||
<span style="color:#666;font-size:12px;margin-left:8px;">
|
||||
<span class="wpdo-text-muted wpdo-ml-2">
|
||||
<?php esc_html_e( '(filter 已成功路由的 transient 對數,含值 + timeout 兩半)', '2meet-data-optimizer' ); ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php if ( $hp_legacy_count > 0 ) : ?>
|
||||
<p class="description" style="margin-top:8px;color:#856404;background:#fff3cd;padding:8px 12px;border-radius:4px;">
|
||||
<p class="description wpdo-notice-warn-desc">
|
||||
⚠️
|
||||
<?php
|
||||
printf(
|
||||
@@ -3519,7 +3505,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
</div>
|
||||
</div><!-- /.wpdo-settings-section -->
|
||||
<div class="wpdo-settings-section" data-section="garbage-filter">
|
||||
<h3 style="margin-top: 2em;"><?php esc_html_e( '🗑 Term + Comment Garbage Filter(v2.12.1)', '2meet-data-optimizer' ); ?></h3>
|
||||
<h3 class="wpdo-h3-section"><?php esc_html_e( '🗑 Term + Comment Garbage Filter(v2.12.1)', '2meet-data-optimizer' ); ?></h3>
|
||||
<p class="description">
|
||||
<?php esc_html_e( '攔截 wp_termmeta / wp_commentmeta 已知垃圾 keys 的寫入並 silent drop(_wxr_import_* WP 匯入殘留、_2meet_demo_* demo 標記、commentmeta 中 8 個誤寫的 post-domain orphan keys)。Phase 0 cleanup CLI 清歷史,本 filter 防再次累積。Read 路徑不攔截(向後相容)。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
@@ -3532,7 +3518,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<input type="checkbox" name="wpdo_term_comment_garbage_filter_enabled" value="1" <?php checked( $tcg_enabled ); ?>>
|
||||
<?php esc_html_e( '攔截 garbage 寫入到 wp_termmeta / wp_commentmeta(預設啟用)', '2meet-data-optimizer' ); ?>
|
||||
</label>
|
||||
<p class="description" style="margin-top:0.5em;font-size:12px;">
|
||||
<p class="description wpdo-description-xs">
|
||||
<?php esc_html_e( '⚠️ 跑 WXR import 工具前可暫時停用本 filter(_wxr_import_* 為 importer 內部追蹤),完成後再啟用 + 跑 cleanup CLI。一般 production 維持啟用。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
@@ -3540,14 +3526,14 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e( '當前狀態', '2meet-data-optimizer' ); ?></th>
|
||||
<td>
|
||||
<table class="widefat striped" style="max-width:600px;">
|
||||
<table class="widefat striped wpdo-max-600">
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Filter 啟用', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<?php if ( $tcg_enabled ) : ?>
|
||||
<span style="color:#28a745;font-weight:600;">✓ <?php esc_html_e( '啟用中', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-green-bold">✓ <?php esc_html_e( '啟用中', '2meet-data-optimizer' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span style="color:#dc3545;font-weight:600;">✗ <?php esc_html_e( '已停用', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-red-bold">✗ <?php esc_html_e( '已停用', '2meet-data-optimizer' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -3555,7 +3541,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<td><?php esc_html_e( '24h 內 drop 計數', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<strong><?php echo esc_html( number_format_i18n( $tcg_drops_24h ) ); ?></strong> writes
|
||||
<span style="color:#666;font-size:12px;margin-left:8px;">
|
||||
<span class="wpdo-text-muted wpdo-ml-2">
|
||||
<?php esc_html_e( '(rolling 24h,自動重置)', '2meet-data-optimizer' ); ?>
|
||||
</span>
|
||||
</td>
|
||||
@@ -3564,10 +3550,10 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<td><?php esc_html_e( 'wp_termmeta 殘留 (legacy)', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<?php if ( $term_garbage_count > 0 ) : ?>
|
||||
<strong style="color:#dc3545;"><?php echo esc_html( number_format_i18n( $term_garbage_count ) ); ?></strong> rows
|
||||
<code style="margin-left:8px;font-size:11px;">wp wpdo termmeta-cleanup --confirm</code>
|
||||
<strong class="wpdo-text-red-bold"><?php echo esc_html( number_format_i18n( $term_garbage_count ) ); ?></strong> rows
|
||||
<code class="wpdo-code-sm">wp wpdo termmeta-cleanup --confirm</code>
|
||||
<?php else : ?>
|
||||
<strong style="color:#28a745;">0 rows ✓</strong>
|
||||
<strong class="wpdo-text-green-bold">0 rows ✓</strong>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -3575,10 +3561,10 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<td><?php esc_html_e( 'wp_commentmeta 殘留 (legacy)', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<?php if ( $comment_garbage_count > 0 ) : ?>
|
||||
<strong style="color:#dc3545;"><?php echo esc_html( number_format_i18n( $comment_garbage_count ) ); ?></strong> rows
|
||||
<code style="margin-left:8px;font-size:11px;">wp wpdo commentmeta-cleanup --confirm</code>
|
||||
<strong class="wpdo-text-red-bold"><?php echo esc_html( number_format_i18n( $comment_garbage_count ) ); ?></strong> rows
|
||||
<code class="wpdo-code-sm">wp wpdo commentmeta-cleanup --confirm</code>
|
||||
<?php else : ?>
|
||||
<strong style="color:#28a745;">0 rows ✓</strong>
|
||||
<strong class="wpdo-text-green-bold">0 rows ✓</strong>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -3605,7 +3591,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
</div>
|
||||
</div><!-- /.wpdo-settings-section -->
|
||||
<div class="wpdo-settings-section" data-section="wc-term-count">
|
||||
<h3 style="margin-top: 2em;"><?php esc_html_e( '🛒 WooCommerce Term Count Filter(v2.12.3)', '2meet-data-optimizer' ); ?></h3>
|
||||
<h3 class="wpdo-h3-section"><?php esc_html_e( '🛒 WooCommerce Term Count Filter(v2.12.3)', '2meet-data-optimizer' ); ?></h3>
|
||||
<p class="description">
|
||||
<?php esc_html_e( '攔截 WooCommerce 寫入 wp_termmeta 的 product_count_<taxonomy> cache rows,重新路由到 wp_options(native transient 結構)。WC 自身 cache 失效邏輯不變(每次新增/刪除 product 時會重算寫入),僅儲存位置改變。Read 路徑亦會優先從 wp_options 讀回,cache miss 才 fall-through 至 wp_termmeta(向後相容)。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
@@ -3623,14 +3609,14 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e( '當前狀態', '2meet-data-optimizer' ); ?></th>
|
||||
<td>
|
||||
<table class="widefat striped" style="max-width:600px;">
|
||||
<table class="widefat striped wpdo-max-600">
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Filter 啟用', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<?php if ( $wctc_enabled ) : ?>
|
||||
<span style="color:#28a745;font-weight:600;">✓ <?php esc_html_e( '啟用中', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-green-bold">✓ <?php esc_html_e( '啟用中', '2meet-data-optimizer' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span style="color:#dc3545;font-weight:600;">✗ <?php esc_html_e( '已停用', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-red-bold">✗ <?php esc_html_e( '已停用', '2meet-data-optimizer' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -3638,9 +3624,9 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<td><?php esc_html_e( 'wp_termmeta 殘留 (legacy)', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<?php if ( $wctc_legacy > 0 ) : ?>
|
||||
<strong style="color:#dc3545;"><?php echo esc_html( number_format_i18n( $wctc_legacy ) ); ?></strong> rows
|
||||
<strong class="wpdo-text-red-bold"><?php echo esc_html( number_format_i18n( $wctc_legacy ) ); ?></strong> rows
|
||||
<?php else : ?>
|
||||
<strong style="color:#28a745;">0 rows ✓</strong>
|
||||
<strong class="wpdo-text-green-bold">0 rows ✓</strong>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -3648,7 +3634,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<td><?php esc_html_e( 'wp_options 路由總量', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<strong><?php echo esc_html( number_format_i18n( $wctc_routed ) ); ?></strong> rows
|
||||
<span style="color:#666;font-size:12px;margin-left:8px;"><?php esc_html_e( '(filter 已成功路由的 product_count cache)', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-muted wpdo-ml-2"><?php esc_html_e( '(filter 已成功路由的 product_count cache)', '2meet-data-optimizer' ); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -3673,7 +3659,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
</div>
|
||||
</div><!-- /.wpdo-settings-section -->
|
||||
<div class="wpdo-settings-section" data-section="misc-bucket">
|
||||
<h3 style="margin-top: 2em;"><?php esc_html_e( '📦 Term + Comment Misc Bucket(v2.12.4)', '2meet-data-optimizer' ); ?></h3>
|
||||
<h3 class="wpdo-h3-section"><?php esc_html_e( '📦 Term + Comment Misc Bucket(v2.12.4)', '2meet-data-optimizer' ); ?></h3>
|
||||
<p class="description">
|
||||
<?php esc_html_e( 'Catch-all flat 表,捕捉所有未被前面 filter 處理的 term/comment meta keys(priority 99,整條 filter chain 的最後一棒)。讓 wp_termmeta / wp_commentmeta 完全可避開(v3.0.0 DROP 前置條件)。寫入 wp_wpdo_term_misc / wp_wpdo_comment_misc 兩張 K/V 表,PRIMARY KEY (entity_id, meta_key)。讀取 cache miss 時 fall-through 至 wp_*meta 維持向後相容。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
@@ -3686,7 +3672,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<input type="checkbox" name="wpdo_term_comment_misc_bucket_enabled" value="1" <?php checked( $misc_enabled ); ?>>
|
||||
<?php esc_html_e( '攔截未註冊 keys 寫入並路由至 wpdo_*_misc 表(預設啟用)', '2meet-data-optimizer' ); ?>
|
||||
</label>
|
||||
<p class="description" style="margin-top:0.5em;font-size:12px;">
|
||||
<p class="description wpdo-description-xs">
|
||||
<?php esc_html_e( '⚠️ 停用此選項時,未註冊 keys 會回到 wp_termmeta / wp_commentmeta。Phase 5 升 mode 前必須維持啟用。', '2meet-data-optimizer' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
@@ -3694,14 +3680,14 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e( '當前狀態', '2meet-data-optimizer' ); ?></th>
|
||||
<td>
|
||||
<table class="widefat striped" style="max-width:600px;">
|
||||
<table class="widefat striped wpdo-max-600">
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Misc bucket 啟用', '2meet-data-optimizer' ); ?></td>
|
||||
<td>
|
||||
<?php if ( $misc_enabled ) : ?>
|
||||
<span style="color:#28a745;font-weight:600;">✓ <?php esc_html_e( '啟用中', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-green-bold">✓ <?php esc_html_e( '啟用中', '2meet-data-optimizer' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span style="color:#dc3545;font-weight:600;">✗ <?php esc_html_e( '已停用', '2meet-data-optimizer' ); ?></span>
|
||||
<span class="wpdo-text-red-bold">✗ <?php esc_html_e( '已停用', '2meet-data-optimizer' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -3725,7 +3711,7 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
</div>
|
||||
</div><!-- /.wpdo-settings-section -->
|
||||
<div class="wpdo-settings-section" data-section="automator">
|
||||
<h3 style="margin-top: 2em;"><?php esc_html_e( '🤖 FSM Automator(v2.5.0 M13)', '2meet-data-optimizer' ); ?></h3>
|
||||
<h3 class="wpdo-h3-section"><?php esc_html_e( '🤖 FSM Automator(v2.5.0 M13)', '2meet-data-optimizer' ); ?></h3>
|
||||
<p class="description"><?php esc_html_e( '預設關閉。啟用後,每日 04:30 UTC 跑一次,自動執行 FSM Advisor 標記為 PROMOTE 的 module 推進。Destructive 轉態(verify→cutover、cutover→cleanup、cleanup→complete)即使 enabled 也永不自動。', '2meet-data-optimizer' ); ?></p>
|
||||
<table class="form-table" role="presentation">
|
||||
<tbody>
|
||||
@@ -3745,10 +3731,10 @@ wpdo.getListings({ per_page: 3 }).then(r => console.log(r));'
|
||||
$blacklist = class_exists( 'TMDO_FSM_Automator' ) ? TMDO_FSM_Automator::blacklist() : array();
|
||||
if ( class_exists( 'TMDO_Feature_Flags' ) ) {
|
||||
$all = array_merge( TMDO_Feature_Flags::HPCT_MODULES, TMDO_Feature_Flags::ZONE_MODULES );
|
||||
echo '<div style="max-height:180px;overflow-y:auto;border:1px solid #c3c4c7;padding:0.6em;border-radius:3px;">';
|
||||
echo '<div class="wpdo-details-section">';
|
||||
foreach ( $all as $m ) {
|
||||
printf(
|
||||
'<label style="display:inline-block;margin-right:1em;margin-bottom:0.3em;"><input type="checkbox" name="wpdo_automator_blacklist[]" value="%s" %s> <code>%s</code></label>',
|
||||
'<label class="wpdo-label-inline"><input type="checkbox" name="wpdo_automator_blacklist[]" value="%s" %s> <code>%s</code></label>',
|
||||
esc_attr( $m ),
|
||||
checked( in_array( $m, $blacklist, true ), true, false ),
|
||||
esc_html( $m )
|
||||
|
||||
Reference in New Issue
Block a user