Files
2meet-data-optimizer/includes/migration/phases/class-tmdo-phase-promote-aeav.php
T
wpdev 76c01e44df refactor: 全部 128 個生產檔加入 declare(strict_types=1)(PR-H)
對齊 A v3.2.0。型別強制會把隱式轉換變成 TypeError,所以一次全檔加入
並跑完整測試(unit 451 / integration 398 全綠,無迴歸)。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
2026-07-31 06:13:33 +08:00

54 lines
1.2 KiB
PHP

<?php
/**
* Migration phase: promote entity mode to aeav_only (cutover complete).
*
* @package TMDO
* @since 3.0.1
*/
declare(strict_types=1);
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Transitions mode from shadow_read → aeav_only.
*/
class TMDO_Phase_Promote_Aeav extends TMDO_Migration_Phase_Base {
/**
* Returns the phase slug.
*
* @return string
*/
public function name(): string {
return 'promote_aeav';
}
/**
* Executes the phase.
*
* @param array $job Job array (by reference).
* @return array{status: string}
* @throws \RuntimeException If mode transition fails.
*/
public function execute( array &$job ): array {
$current = TMDO_Mode_Manager::get( $this->entity_type );
if ( TMDO_Mode_Manager::MODE_AEAV_ONLY === $current ) {
$this->log( $job, '↪ Already aeav_only' );
return array( 'status' => 'ok' );
}
$r = TMDO_Mode_Manager::set( $this->entity_type, TMDO_Mode_Manager::MODE_AEAV_ONLY );
if ( is_wp_error( $r ) ) {
throw new \RuntimeException( 'Promote to aeav_only failed: ' . $r->get_error_message() );
}
$this->log( $job, 'Mode: shadow_read → aeav_only (cutover complete)' );
return array( 'status' => 'ok' );
}
}