WP Data Optimizer. * * Appears in the Tools section so admins can re-run the wizard at any time. * The wizard itself is idempotent: re-running it never auto-enables modules. * * @return void */ public static function register_menu_page(): void { $hook_suffix = add_submenu_page( 'tools.php', __( 'WPDO 設定嚮導', '2meet-data-optimizer' ), __( 'WPDO 設定嚮導', '2meet-data-optimizer' ), 'manage_options', 'wpdo-setup-wizard', array( __CLASS__, 'render_page' ) ); if ( $hook_suffix ) { add_action( 'load-' . $hook_suffix, array( __CLASS__, 'handle_snapshot_post' ) ); } } /** * Step 4 baseline snapshot (POST + nonce, prevents Referer leak — v3.3.x * P1-6b hardening), handled on load-{page} so the redirect runs before any * output. * * @return void */ public static function handle_snapshot_post(): void { if ( ! isset( $_POST['wpdo_take_snapshot'] ) || ! TMDO_Capability::current_user_can_admin() || ! class_exists( 'TMDO_Snapshot_Manager' ) ) { return; } check_admin_referer( self::NONCE_NAME ); $result = TMDO_Snapshot_Manager::create( 'manual', array(), array( 'notes' => 'wizard_baseline', 'retention_days' => 365, ) ); wp_safe_redirect( admin_url( 'tools.php?page=wpdo-setup-wizard&step=4&' . ( empty( $result['ok'] ) ? 'snap_failed=1' : 'snap_done=1' ) ) ); exit; } /** * Render the wizard. * * @return void */ public static function render_page(): void { if ( ! TMDO_Capability::current_user_can_admin() ) { wp_die( esc_html__( 'Insufficient permissions.', '2meet-data-optimizer' ) ); } $step = max( 1, min( self::TOTAL_STEPS, absint( wp_unslash( $_GET['step'] ?? 1 ) ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $completed = '1' === get_option( self::OPT_COMPLETED ); ?>
| Zone | ||
|---|---|---|
| Hot | ||
| Warm | ||
| Cold | ||
| Archive |
| 1_000_000 ) : ?> ✅ 100_000 ) : ?> 🟡 ⏸ |
| meta_key | |
|---|---|
|
|
|
✅
' . esc_html__( 'Snapshot 建立失敗,請查日誌。', '2meet-data-optimizer' ) . '
'; } ?>' . esc_html( gmdate( 'Y-m-d H:i:s', $next ) ) . '' ); } else { esc_html_e( '⚠️ Daily cron 未排程;請重新啟用外掛。', '2meet-data-optimizer' ); } ?>