chore(2meet-data-optimizer): address the 2.1 audit notes
- The four public REST routes say why they are public (viewable posts only, show_in_rest fields only, per_page cap, one view per IP per post per hour).
- Admin ternary echoes of literal strings are escaped for their context: esc_attr() in attributes, esc_html() for text; the object-cache badge is an if/else and aria-current is always printed ("false" off the current tab).
- Exceptions in the migration engine and the health cron go to TMDO_Logger instead of error_log().
- Verify: audit greps (ternary echoes 23 → 0, error_log outside the logger 0); dev36 renders 8 admin tabs with the change, no PHP notice, one aria-current="page" each.
- PR: PR-078
This commit is contained in:
@@ -846,8 +846,8 @@ class TMDO_Admin {
|
|||||||
<span class="wpdo-tab-group-label" aria-hidden="true"><?php echo esc_html( $group['label'] ); ?></span>
|
<span class="wpdo-tab-group-label" aria-hidden="true"><?php echo esc_html( $group['label'] ); ?></span>
|
||||||
<?php foreach ( $group_tabs as $slug ) : ?>
|
<?php foreach ( $group_tabs as $slug ) : ?>
|
||||||
<a href="<?php echo esc_url( add_query_arg( 'tab', $slug, admin_url( 'tools.php?page=' . self::MENU_SLUG ) ) ); ?>"
|
<a href="<?php echo esc_url( add_query_arg( 'tab', $slug, admin_url( 'tools.php?page=' . self::MENU_SLUG ) ) ); ?>"
|
||||||
class="nav-tab <?php echo $tab === $slug ? 'nav-tab-active' : ''; ?>"
|
class="nav-tab <?php echo esc_attr( $tab === $slug ? 'nav-tab-active' : '' ); ?>"
|
||||||
<?php echo $tab === $slug ? 'aria-current="page"' : ''; ?>>
|
aria-current="<?php echo esc_attr( $tab === $slug ? 'page' : 'false' ); ?>">
|
||||||
<?php echo esc_html( $tabs[ $slug ] ); ?>
|
<?php echo esc_html( $tabs[ $slug ] ); ?>
|
||||||
<?php if ( isset( $needs_dot[ $slug ] ) ) : ?>
|
<?php if ( isset( $needs_dot[ $slug ] ) ) : ?>
|
||||||
<span class="wpdo-tab-dot" title="
|
<span class="wpdo-tab-dot" title="
|
||||||
@@ -1099,7 +1099,7 @@ class TMDO_Admin {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php esc_html_e( '資料庫引擎', '2meet-data-optimizer' ); ?></th>
|
<th><?php esc_html_e( '資料庫引擎', '2meet-data-optimizer' ); ?></th>
|
||||||
<td><code><?php echo TMDO_IS_MYSQL ? 'MySQL' : 'SQLite'; ?></code></td>
|
<td><code><?php echo esc_html( TMDO_IS_MYSQL ? 'MySQL' : 'SQLite' ); ?></code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php esc_html_e( '外掛版本', '2meet-data-optimizer' ); ?></th>
|
<th><?php esc_html_e( '外掛版本', '2meet-data-optimizer' ); ?></th>
|
||||||
@@ -1116,7 +1116,11 @@ class TMDO_Admin {
|
|||||||
<tr>
|
<tr>
|
||||||
<th><?php esc_html_e( 'Object Cache', '2meet-data-optimizer' ); ?></th>
|
<th><?php esc_html_e( 'Object Cache', '2meet-data-optimizer' ); ?></th>
|
||||||
<td>
|
<td>
|
||||||
<?php echo wp_using_ext_object_cache() ? '<span class="wpdo-badge wpdo-badge-ok">External</span>' : '<span class="wpdo-badge">Built-in</span>'; ?>
|
<?php if ( wp_using_ext_object_cache() ) : ?>
|
||||||
|
<span class="wpdo-badge wpdo-badge-ok">External</span>
|
||||||
|
<?php else : ?>
|
||||||
|
<span class="wpdo-badge">Built-in</span>
|
||||||
|
<?php endif; ?>
|
||||||
<?php if ( $cache['flush_support'] ) : ?>
|
<?php if ( $cache['flush_support'] ) : ?>
|
||||||
<span class="wpdo-badge wpdo-badge-ok">Flush Support</span>
|
<span class="wpdo-badge wpdo-badge-ok">Flush Support</span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -1726,13 +1730,13 @@ class TMDO_Admin {
|
|||||||
↑ <?php esc_html_e( '升級模式', '2meet-data-optimizer' ); ?>
|
↑ <?php esc_html_e( '升級模式', '2meet-data-optimizer' ); ?>
|
||||||
</button>
|
</button>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="button wpdo-btn-demote <?php echo $prev_mode ? '' : 'wpdo-eb-btn-dim'; ?>"
|
class="button wpdo-btn-demote <?php echo esc_attr( $prev_mode ? '' : 'wpdo-eb-btn-dim' ); ?>"
|
||||||
data-wpdo-action="demote"
|
data-wpdo-action="demote"
|
||||||
data-entity-type="<?php echo esc_attr( $etype ); ?>"
|
data-entity-type="<?php echo esc_attr( $etype ); ?>"
|
||||||
data-prev-mode="<?php echo esc_attr( $prev_mode ?? '' ); ?>"
|
data-prev-mode="<?php echo esc_attr( $prev_mode ?? '' ); ?>"
|
||||||
<?php disabled( ! $prev_mode ); ?>
|
<?php disabled( ! $prev_mode ); ?>
|
||||||
title="<?php echo esc_attr( $prev_mode ? '降級到 ' . $prev_mode : '已在最低模式' ); ?>"
|
title="<?php echo esc_attr( $prev_mode ? '降級到 ' . $prev_mode : '已在最低模式' ); ?>"
|
||||||
class="<?php echo $prev_mode ? '' : 'wpdo-eb-btn-dim'; ?>">
|
class="<?php echo esc_attr( $prev_mode ? '' : 'wpdo-eb-btn-dim' ); ?>">
|
||||||
↓ <?php esc_html_e( '降級模式', '2meet-data-optimizer' ); ?>
|
↓ <?php esc_html_e( '降級模式', '2meet-data-optimizer' ); ?>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -2037,7 +2041,7 @@ class TMDO_Admin {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Progress section (live) -->
|
<!-- Progress section (live) -->
|
||||||
<div id="wpdo-st-progress-card" class="wpdo-eb-card wpdo-mt-3<?php echo $is_running ? '' : ' wpdo-hidden'; ?>">
|
<div id="wpdo-st-progress-card" class="wpdo-eb-card wpdo-mt-3<?php echo esc_attr( $is_running ? '' : ' wpdo-hidden' ); ?>">
|
||||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
<h3 class="wpdo-mt-0"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
||||||
<div class="wpdo-bar-section">
|
<div class="wpdo-bar-section">
|
||||||
<div class="wpdo-bar-header">
|
<div class="wpdo-bar-header">
|
||||||
@@ -2071,7 +2075,7 @@ class TMDO_Admin {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Benchmark report -->
|
<!-- Benchmark report -->
|
||||||
<div id="wpdo-st-bench-card" class="wpdo-eb-card wpdo-mt-3<?php echo ! empty( $state['benchmark'] ) ? '' : ' wpdo-hidden'; ?>">
|
<div id="wpdo-st-bench-card" class="wpdo-eb-card wpdo-mt-3<?php echo esc_attr( ! empty( $state['benchmark'] ) ? '' : ' wpdo-hidden' ); ?>">
|
||||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
<h3 class="wpdo-mt-0"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
||||||
<div id="wpdo-st-bench-content">
|
<div id="wpdo-st-bench-content">
|
||||||
<?php if ( ! empty( $state['benchmark'] ) ) : ?>
|
<?php if ( ! empty( $state['benchmark'] ) ) : ?>
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ class TMDO_Dashboard_Widget {
|
|||||||
'%2$s'
|
'%2$s'
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
<p class="wpdo-widget-notice <?php echo $total_eav > 0 ? 'wpdo-widget-notice-warn' : 'wpdo-widget-notice-ok'; ?>">
|
<p class="wpdo-widget-notice <?php echo esc_attr( $total_eav > 0 ? 'wpdo-widget-notice-warn' : 'wpdo-widget-notice-ok' ); ?>">
|
||||||
📦
|
📦
|
||||||
<?php
|
<?php
|
||||||
if ( $total_eav > 0 ) {
|
if ( $total_eav > 0 ) {
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ $total_commentmeta = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->comment
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Progress card (live) -->
|
<!-- Progress card (live) -->
|
||||||
<div id="wpdo-cst-progress-card" class="wpdo-card wpdo-mt-3<?php echo $is_running ? '' : ' wpdo-hidden'; ?>">
|
<div id="wpdo-cst-progress-card" class="wpdo-card wpdo-mt-3<?php echo esc_attr( $is_running ? '' : ' wpdo-hidden' ); ?>">
|
||||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
<h3 class="wpdo-mt-0"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
||||||
<div class="wpdo-bar-section">
|
<div class="wpdo-bar-section">
|
||||||
<div class="wpdo-bar-header">
|
<div class="wpdo-bar-header">
|
||||||
@@ -249,7 +249,7 @@ $total_commentmeta = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->comment
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Benchmark report -->
|
<!-- Benchmark report -->
|
||||||
<div id="wpdo-cst-bench-card" class="wpdo-card wpdo-mt-3<?php echo ! empty( $state['benchmark'] ) ? '' : ' wpdo-hidden'; ?>">
|
<div id="wpdo-cst-bench-card" class="wpdo-card wpdo-mt-3<?php echo esc_attr( ! empty( $state['benchmark'] ) ? '' : ' wpdo-hidden' ); ?>">
|
||||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
<h3 class="wpdo-mt-0"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
||||||
<div id="wpdo-cst-bench-content"></div>
|
<div id="wpdo-cst-bench-content"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ $failed = 'failed' === $state;
|
|||||||
|
|
||||||
<!-- Run-migration panel (idle state) ──────────────────────────────── -->
|
<!-- Run-migration panel (idle state) ──────────────────────────────── -->
|
||||||
<section class="wpdo-mw-panel wpdo-mw-run" id="wpdo-mw-run-panel"
|
<section class="wpdo-mw-panel wpdo-mw-run" id="wpdo-mw-run-panel"
|
||||||
<?php echo $active || $completed ? 'hidden' : ''; ?>>
|
<?php echo esc_attr( $active || $completed ? 'hidden' : '' ); ?>>
|
||||||
|
|
||||||
<?php if ( 0 === $eav_residue && 'aeav_only' === $current_mode ) : ?>
|
<?php if ( 0 === $eav_residue && 'aeav_only' === $current_mode ) : ?>
|
||||||
<div class="wpdo-mw-nothing-todo">
|
<div class="wpdo-mw-nothing-todo">
|
||||||
@@ -170,7 +170,7 @@ $failed = 'failed' === $state;
|
|||||||
|
|
||||||
<!-- Live progress panel (running state) ───────────────────────────── -->
|
<!-- Live progress panel (running state) ───────────────────────────── -->
|
||||||
<section class="wpdo-mw-panel wpdo-mw-progress" id="wpdo-mw-progress-panel"
|
<section class="wpdo-mw-panel wpdo-mw-progress" id="wpdo-mw-progress-panel"
|
||||||
<?php echo $active || $failed ? '' : 'hidden'; ?>>
|
<?php echo esc_attr( $active || $failed ? '' : 'hidden' ); ?>>
|
||||||
|
|
||||||
<h3 id="wpdo-mw-progress-title"><?php esc_html_e( '執行中…', '2meet-data-optimizer' ); ?></h3>
|
<h3 id="wpdo-mw-progress-title"><?php esc_html_e( '執行中…', '2meet-data-optimizer' ); ?></h3>
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ $failed = 'failed' === $state;
|
|||||||
|
|
||||||
<!-- Completed state ───────────────────────────────────────────────── -->
|
<!-- Completed state ───────────────────────────────────────────────── -->
|
||||||
<section class="wpdo-mw-panel wpdo-mw-done" id="wpdo-mw-done-panel"
|
<section class="wpdo-mw-panel wpdo-mw-done" id="wpdo-mw-done-panel"
|
||||||
<?php echo $completed ? '' : 'hidden'; ?>>
|
<?php echo esc_attr( $completed ? '' : 'hidden' ); ?>>
|
||||||
<h3>✅ <?php esc_html_e( '遷移完成', '2meet-data-optimizer' ); ?></h3>
|
<h3>✅ <?php esc_html_e( '遷移完成', '2meet-data-optimizer' ); ?></h3>
|
||||||
<div class="wpdo-mw-done-summary" id="wpdo-mw-done-summary"></div>
|
<div class="wpdo-mw-done-summary" id="wpdo-mw-done-summary"></div>
|
||||||
<button type="button" class="button" id="wpdo-mw-reset"><?php esc_html_e( '回到診斷頁', '2meet-data-optimizer' ); ?></button>
|
<button type="button" class="button" id="wpdo-mw-reset"><?php esc_html_e( '回到診斷頁', '2meet-data-optimizer' ); ?></button>
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ $wpdo_format_msg = static function ( string $code ): string {
|
|||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="wpdo_postmeta_cleanup" value="1">
|
<input type="hidden" name="wpdo_postmeta_cleanup" value="1">
|
||||||
<?php wp_nonce_field( 'wpdo_postmeta_cleanup' ); ?>
|
<?php wp_nonce_field( 'wpdo_postmeta_cleanup' ); ?>
|
||||||
<button type="submit" class="button button-primary <?php echo (int) $garbage['total'] > 0 ? '' : 'disabled'; ?>"
|
<button type="submit" class="button button-primary <?php echo esc_attr( (int) $garbage['total'] > 0 ? '' : 'disabled' ); ?>"
|
||||||
onclick="return confirm(<?php echo wp_json_encode( __( '確定要刪除 wp_postmeta 中的垃圾資料?此動作不可逆。', '2meet-data-optimizer' ) ); ?>);">
|
onclick="return confirm(<?php echo wp_json_encode( __( '確定要刪除 wp_postmeta 中的垃圾資料?此動作不可逆。', '2meet-data-optimizer' ) ); ?>);">
|
||||||
<?php esc_html_e( '清理垃圾資料', '2meet-data-optimizer' ); ?>
|
<?php esc_html_e( '清理垃圾資料', '2meet-data-optimizer' ); ?>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -161,22 +161,22 @@ $post_type_options = array(
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="<?php echo 'disabled' === $current_post_mode ? 'wpdo-tr-highlight' : ''; ?>">
|
<tr class="<?php echo esc_attr( 'disabled' === $current_post_mode ? 'wpdo-tr-highlight' : '' ); ?>">
|
||||||
<td><code>disabled</code></td>
|
<td><code>disabled</code></td>
|
||||||
<td>wp_postmeta 5 rows / flat 0 → <strong>1:5(無優化)</strong></td>
|
<td>wp_postmeta 5 rows / flat 0 → <strong>1:5(無優化)</strong></td>
|
||||||
<td>wp_postmeta 5 / flat 0 → 1:5(無優化)</td>
|
<td>wp_postmeta 5 / flat 0 → 1:5(無優化)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="<?php echo 'dual_write' === $current_post_mode ? 'wpdo-tr-highlight' : ''; ?>">
|
<tr class="<?php echo esc_attr( 'dual_write' === $current_post_mode ? 'wpdo-tr-highlight' : '' ); ?>">
|
||||||
<td><code>dual_write</code></td>
|
<td><code>dual_write</code></td>
|
||||||
<td>wp_postmeta 5 / flat 0 → 1:5</td>
|
<td>wp_postmeta 5 / flat 0 → 1:5</td>
|
||||||
<td>wp_postmeta 5 + flat 1 → 1:5(有 flat 但 wp_postmeta 不減)</td>
|
<td>wp_postmeta 5 + flat 1 → 1:5(有 flat 但 wp_postmeta 不減)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="<?php echo 'shadow_read' === $current_post_mode ? 'wpdo-tr-highlight' : ''; ?>">
|
<tr class="<?php echo esc_attr( 'shadow_read' === $current_post_mode ? 'wpdo-tr-highlight' : '' ); ?>">
|
||||||
<td><code>shadow_read</code></td>
|
<td><code>shadow_read</code></td>
|
||||||
<td>wp_postmeta 5 / flat 0 → 1:5</td>
|
<td>wp_postmeta 5 / flat 0 → 1:5</td>
|
||||||
<td>wp_postmeta 5 + flat 1 → 1:5(讀走 flat,寫仍雙寫)</td>
|
<td>wp_postmeta 5 + flat 1 → 1:5(讀走 flat,寫仍雙寫)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="<?php echo 'aeav_only' === $current_post_mode ? 'wpdo-tr-success' : ''; ?>">
|
<tr class="<?php echo esc_attr( 'aeav_only' === $current_post_mode ? 'wpdo-tr-success' : '' ); ?>">
|
||||||
<td><code>aeav_only</code></td>
|
<td><code>aeav_only</code></td>
|
||||||
<td>wp_postmeta 5(直 SQL 繞過 Hook Bus)/ flat 0 → 1:5 ⚠️</td>
|
<td>wp_postmeta 5(直 SQL 繞過 Hook Bus)/ flat 0 → 1:5 ⚠️</td>
|
||||||
<td>wp_postmeta <strong>0</strong> / flat 1 → <strong>0:1(完全優化)</strong> ✅</td>
|
<td>wp_postmeta <strong>0</strong> / flat 1 → <strong>0:1(完全優化)</strong> ✅</td>
|
||||||
@@ -291,7 +291,7 @@ $post_type_options = array(
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Progress section (live) -->
|
<!-- Progress section (live) -->
|
||||||
<div id="wpdo-pst-progress-card" class="wpdo-card wpdo-mt-3<?php echo $is_running ? '' : ' wpdo-hidden'; ?>">
|
<div id="wpdo-pst-progress-card" class="wpdo-card wpdo-mt-3<?php echo esc_attr( $is_running ? '' : ' wpdo-hidden' ); ?>">
|
||||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
<h3 class="wpdo-mt-0"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
||||||
<div class="wpdo-bar-section">
|
<div class="wpdo-bar-section">
|
||||||
<div class="wpdo-bar-header">
|
<div class="wpdo-bar-header">
|
||||||
@@ -329,7 +329,7 @@ $post_type_options = array(
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Benchmark report -->
|
<!-- Benchmark report -->
|
||||||
<div id="wpdo-pst-bench-card" class="wpdo-card wpdo-mt-3<?php echo ! empty( $state['benchmark'] ) ? '' : ' wpdo-hidden'; ?>">
|
<div id="wpdo-pst-bench-card" class="wpdo-card wpdo-mt-3<?php echo esc_attr( ! empty( $state['benchmark'] ) ? '' : ' wpdo-hidden' ); ?>">
|
||||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
<h3 class="wpdo-mt-0"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
||||||
<div id="wpdo-pst-bench-content"></div>
|
<div id="wpdo-pst-bench-content"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ $total_termmeta = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->termmeta
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Progress card (live) -->
|
<!-- Progress card (live) -->
|
||||||
<div id="wpdo-tst-progress-card" class="wpdo-card wpdo-mt-3<?php echo $is_running ? '' : ' wpdo-hidden'; ?>">
|
<div id="wpdo-tst-progress-card" class="wpdo-card wpdo-mt-3<?php echo esc_attr( $is_running ? '' : ' wpdo-hidden' ); ?>">
|
||||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
<h3 class="wpdo-mt-0"><?php esc_html_e( '2. 即時進度', '2meet-data-optimizer' ); ?></h3>
|
||||||
<div class="wpdo-bar-section">
|
<div class="wpdo-bar-section">
|
||||||
<div class="wpdo-bar-header">
|
<div class="wpdo-bar-header">
|
||||||
@@ -245,7 +245,7 @@ $total_termmeta = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->termmeta
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Benchmark report -->
|
<!-- Benchmark report -->
|
||||||
<div id="wpdo-tst-bench-card" class="wpdo-card wpdo-mt-3<?php echo ! empty( $state['benchmark'] ) ? '' : ' wpdo-hidden'; ?>">
|
<div id="wpdo-tst-bench-card" class="wpdo-card wpdo-mt-3<?php echo esc_attr( ! empty( $state['benchmark'] ) ? '' : ' wpdo-hidden' ); ?>">
|
||||||
<h3 class="wpdo-mt-0"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
<h3 class="wpdo-mt-0"><?php esc_html_e( '3. Benchmark 報告', '2meet-data-optimizer' ); ?></h3>
|
||||||
<div id="wpdo-tst-bench-content"></div>
|
<div id="wpdo-tst-bench-content"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ class TMDO_REST_API {
|
|||||||
array(
|
array(
|
||||||
'methods' => WP_REST_Server::READABLE,
|
'methods' => WP_REST_Server::READABLE,
|
||||||
'callback' => array( $this, 'get_listings' ),
|
'callback' => array( $this, 'get_listings' ),
|
||||||
|
// Public by design: viewable post types and published posts only, fields
|
||||||
|
// declared show_in_rest only (1.1.1), per_page capped (wpdo_rest_max_per_page).
|
||||||
'permission_callback' => '__return_true',
|
'permission_callback' => '__return_true',
|
||||||
'args' => $this->listings_args(),
|
'args' => $this->listings_args(),
|
||||||
)
|
)
|
||||||
@@ -48,6 +50,8 @@ class TMDO_REST_API {
|
|||||||
array(
|
array(
|
||||||
'methods' => WP_REST_Server::READABLE,
|
'methods' => WP_REST_Server::READABLE,
|
||||||
'callback' => array( $this, 'get_listing' ),
|
'callback' => array( $this, 'get_listing' ),
|
||||||
|
// Public by design: the post must be viewable to the request (assert_post_viewable_or_error:
|
||||||
|
// publicly viewable or read_post); fields declared show_in_rest only (1.1.1).
|
||||||
'permission_callback' => '__return_true',
|
'permission_callback' => '__return_true',
|
||||||
'args' => array(
|
'args' => array(
|
||||||
'id' => array(
|
'id' => array(
|
||||||
@@ -65,6 +69,7 @@ class TMDO_REST_API {
|
|||||||
array(
|
array(
|
||||||
'methods' => WP_REST_Server::READABLE,
|
'methods' => WP_REST_Server::READABLE,
|
||||||
'callback' => array( $this, 'get_stats' ),
|
'callback' => array( $this, 'get_stats' ),
|
||||||
|
// Public by design: view / engagement counters of a post viewable to the request.
|
||||||
'permission_callback' => '__return_true',
|
'permission_callback' => '__return_true',
|
||||||
'args' => array(
|
'args' => array(
|
||||||
'id' => array(
|
'id' => array(
|
||||||
@@ -82,6 +87,8 @@ class TMDO_REST_API {
|
|||||||
array(
|
array(
|
||||||
'methods' => WP_REST_Server::CREATABLE,
|
'methods' => WP_REST_Server::CREATABLE,
|
||||||
'callback' => array( $this, 'post_view' ),
|
'callback' => array( $this, 'post_view' ),
|
||||||
|
// Public by design: anonymous visitors count views; viewable posts only, one view
|
||||||
|
// per IP per post per hour (rate limited).
|
||||||
'permission_callback' => '__return_true',
|
'permission_callback' => '__return_true',
|
||||||
'args' => array(
|
'args' => array(
|
||||||
'id' => array(
|
'id' => array(
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class TMDO_Health_Cron {
|
|||||||
}
|
}
|
||||||
} catch ( Throwable $e ) {
|
} catch ( Throwable $e ) {
|
||||||
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch -- detector failure must not break health check.
|
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch -- detector failure must not break health check.
|
||||||
error_log( '[WPDO] Module detector exception in health cron: ' . $e->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
TMDO_Logger::error( 'health_cron', 'module_detector', $e->getMessage() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,13 +144,14 @@ final class TMDO_Entity_Migration_Engine {
|
|||||||
}
|
}
|
||||||
} catch ( \Throwable $e ) {
|
} catch ( \Throwable $e ) {
|
||||||
++$stats['errors'];
|
++$stats['errors'];
|
||||||
error_log(
|
TMDO_Logger::error(
|
||||||
sprintf(
|
'migration_engine',
|
||||||
'[UAE Migration] Error %s/%s ID=%d: %s',
|
'migrate_group',
|
||||||
$entity_type,
|
$e->getMessage(),
|
||||||
$group_name,
|
array(
|
||||||
$entity_id,
|
'entity_type' => $entity_type,
|
||||||
$e->getMessage()
|
'group' => $group_name,
|
||||||
|
'entity_id' => $entity_id,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -383,7 +384,16 @@ final class TMDO_Entity_Migration_Engine {
|
|||||||
++$batch_migrated;
|
++$batch_migrated;
|
||||||
}
|
}
|
||||||
} catch ( \Throwable $e ) {
|
} catch ( \Throwable $e ) {
|
||||||
error_log( sprintf( '[UAE Migration Batch] Error %s/%s ID=%d: %s', $entity_type, $group_name, $entity_id, $e->getMessage() ) );
|
TMDO_Logger::error(
|
||||||
|
'migration_engine',
|
||||||
|
'migrate_group_batch',
|
||||||
|
$e->getMessage(),
|
||||||
|
array(
|
||||||
|
'entity_type' => $entity_type,
|
||||||
|
'group' => $group_name,
|
||||||
|
'entity_id' => $entity_id,
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$last_id = $entity_id;
|
$last_id = $entity_id;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user