feat(2meet-data-optimizer): set an entity bridge mode from the CLI under the Promotion Guard
- New `wp tmdo bridge-mode <entity> <mode>` goes through TMDO_Mode_Manager::set(): unsafe jumps and aeav_only promotions refused by the Promotion Guard exit with the reason and leave the mode unchanged. Named apart from the Feature Flags `mode-set`. - member-sso-sync and member-force-logout warn that they are deprecated: the user sso group they work on is no longer registered. - Verify: CliBridgeModeTest (RED: method missing); dev36 bridge-mode user aeav_only refused (unsafe jump), term dual_write → shadow_read → aeav_only refused by the HivePress guard → back to disabled, wpdo_bridge_modes identical to before. - PR: PR-069
This commit is contained in:
@@ -152,6 +152,40 @@ class TMDO_CLI_V2 {
|
||||
WP_CLI::success( "Hook Bus: {$state}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an entity's bridge mode. Goes through TMDO_Mode_Manager::set(): unsafe
|
||||
* jumps and promotions refused by the Promotion Guard (aeav_only on
|
||||
* HivePress / WooCommerce sites) fail and leave the mode unchanged.
|
||||
*
|
||||
* ## OPTIONS
|
||||
*
|
||||
* <entity>
|
||||
* : post | user | term | comment
|
||||
*
|
||||
* <mode>
|
||||
* : disabled | dual_write | shadow_read | aeav_only
|
||||
*
|
||||
* ## EXAMPLES
|
||||
*
|
||||
* wp tmdo bridge-mode user dual_write
|
||||
* wp tmdo bridge-mode post disabled
|
||||
*
|
||||
* @param array<int, string> $args Entity type and mode.
|
||||
* @param array<string, string> $assoc_args Unused.
|
||||
*/
|
||||
public function bridge_mode( $args, $assoc_args ): void {
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
|
||||
$entity = (string) ( $args[0] ?? '' );
|
||||
$mode = (string) ( $args[1] ?? '' );
|
||||
$from = TMDO_Mode_Manager::get( $entity );
|
||||
|
||||
$result = TMDO_Mode_Manager::set( $entity, $mode );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
WP_CLI::error( $result->get_error_message() );
|
||||
}
|
||||
WP_CLI::success( "{$entity}: {$from} → {$mode}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an entity's flat-table values back to native meta — the way out of
|
||||
* aeav_only. Resumable; re-run after an interruption.
|
||||
@@ -918,6 +952,8 @@ WP_CLI::add_command( 'wpdo bridge-status', array( 'TMDO_CLI_V2', 'bridge_status'
|
||||
WP_CLI::add_command( 'tmdo bridge-status', array( 'TMDO_CLI_V2', 'bridge_status' ) );
|
||||
WP_CLI::add_command( 'wpdo bridge-set', array( 'TMDO_CLI_V2', 'bridge_set' ) );
|
||||
WP_CLI::add_command( 'tmdo bridge-set', array( 'TMDO_CLI_V2', 'bridge_set' ) );
|
||||
WP_CLI::add_command( 'wpdo bridge-mode', array( new TMDO_CLI_V2(), 'bridge_mode' ) );
|
||||
WP_CLI::add_command( 'tmdo bridge-mode', array( new TMDO_CLI_V2(), 'bridge_mode' ) );
|
||||
WP_CLI::add_command( 'wpdo bridge-restore-native', array( new TMDO_CLI_V2(), 'bridge_restore_native' ) );
|
||||
WP_CLI::add_command( 'tmdo bridge-restore-native', array( new TMDO_CLI_V2(), 'bridge_restore_native' ) );
|
||||
WP_CLI::add_command( 'wpdo repair-array-literals', array( new TMDO_CLI_V2(), 'repair_array_literals' ) );
|
||||
|
||||
Reference in New Issue
Block a user