refactor(2meet-data-optimizer): retire the SSO AddOn recommendation
- missing_integration_addons() no longer asks for the SSO AddOn when 2meet-hub-core / 2meet-spoke-sso are active: they register their own tables and the `sso` values belong in usermeta (benchmark: no measurable gain from the flat table for by-user-id access). - `sso` joins the deprecated AddOns; for hub / spoke / sso the notice says they go without replacement and to run `wp tmdo bridge-restore-native user --group=sso --retire` first. - Verify: core unit 658 / integration 479 green, phpcs clean - PR: PR-043
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
* mobile-bridge, playlist, quotation, spoke) only registered tables and fields
|
||||
* on the partner's behalf. Partner plugins now register themselves with the
|
||||
* TMDO_Anti_EAV_Aware trait (docs/PARTNER-REGISTRATION.md), so these AddOns
|
||||
* are deprecated and will be removed. The hub and spoke AddOns are replaced
|
||||
* by 2meet-data-optimizer-sso-addon.
|
||||
* are deprecated and will be removed. The SSO data needs no AddOn at all:
|
||||
* the hub, spoke and SSO AddOns go without replacement (the `sso` group gave
|
||||
* no measurable gain over usermeta) once its values are written back.
|
||||
*
|
||||
* @package WP_Data_Optimizer
|
||||
*/
|
||||
@@ -24,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
final class TMDO_Deprecated_Addons_Notice {
|
||||
|
||||
/** In-house plugins whose AddOn is replaced by partner self-registration. */
|
||||
private const SLUGS = array( 'bookings', 'collab', 'hub', 'infocards', 'mobile-bridge', 'playlist', 'quotation', 'spoke' );
|
||||
private const SLUGS = array( 'bookings', 'collab', 'hub', 'infocards', 'mobile-bridge', 'playlist', 'quotation', 'spoke', 'sso' );
|
||||
|
||||
/**
|
||||
* Hook the notice.
|
||||
@@ -80,10 +81,10 @@ final class TMDO_Deprecated_Addons_Notice {
|
||||
),
|
||||
esc_html__( '改寫方式見 2meet-data-optimizer 外掛內的 docs/PARTNER-REGISTRATION.md;partner 外掛完成自行註冊後即可停用對應 AddOn。', '2meet-data-optimizer' )
|
||||
);
|
||||
if ( array_intersect( $active, array( 'hub', 'spoke' ) ) ) {
|
||||
if ( array_intersect( $active, array( 'hub', 'spoke', 'sso' ) ) ) {
|
||||
printf(
|
||||
'<div class="notice notice-warning"><p>%s</p></div>',
|
||||
esc_html__( 'Hub / Spoke AddOn 由 2meet-data-optimizer-sso-addon 取代:啟用它之後即可停用這兩個 AddOn。', '2meet-data-optimizer' )
|
||||
esc_html__( 'Hub / Spoke / SSO AddOn 不需替代:2meet-hub-core 與 2meet-spoke-sso 會自行註冊資料表,SSO 值存回 usermeta 即可。停用前先執行 wp tmdo bridge-restore-native user --group=sso --retire。', '2meet-data-optimizer' )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,10 +85,6 @@ class TMDO_Compatibility {
|
||||
if ( self::is_woocommerce_active() && ! class_exists( 'TMDO_Woocommerce_Bootstrap' ) ) {
|
||||
$missing['WooCommerce'] = '2meet-data-optimizer-woocommerce-addon';
|
||||
}
|
||||
// 2meet-hub-core / 2meet-spoke-sso read and write the user `sso` group it owns.
|
||||
if ( ( class_exists( 'TMHC_Plugin', false ) || class_exists( 'TMSO_Plugin', false ) ) && ! class_exists( 'TMDO_SSO_Integration', false ) ) {
|
||||
$missing['2meet Hub / Spoke SSO'] = '2meet-data-optimizer-sso-addon';
|
||||
}
|
||||
return $missing;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,15 +43,17 @@ class DeprecatedAddonsNoticeTest extends TestCase {
|
||||
$this->assertStringContainsString( 'PARTNER-REGISTRATION.md', $html );
|
||||
}
|
||||
|
||||
public function test_hub_and_spoke_point_to_the_sso_addon(): void {
|
||||
$GLOBALS['_wp_options']['active_plugins'] = array( '2meet-data-optimizer-spoke-addon/2meet-data-optimizer-spoke-addon.php' );
|
||||
public function test_sso_hub_and_spoke_addons_are_deprecated_without_replacement(): void {
|
||||
$this->activate( 'hub', 'sso' );
|
||||
|
||||
$this->assertSame( array( 'hub', 'sso' ), TMDO_Deprecated_Addons_Notice::active() );
|
||||
ob_start();
|
||||
TMDO_Deprecated_Addons_Notice::render();
|
||||
$html = (string) ob_get_clean();
|
||||
|
||||
$this->assertStringContainsString( '2meet-data-optimizer-spoke-addon', $html );
|
||||
$this->assertStringContainsString( '2meet-data-optimizer-sso-addon', $html );
|
||||
$this->assertStringContainsString( '不需替代', $html );
|
||||
$this->assertStringContainsString( 'bridge-restore-native user --group=sso --retire', $html );
|
||||
}
|
||||
|
||||
public function test_no_notice_when_none_active_or_user_cannot_manage(): void {
|
||||
|
||||
@@ -83,19 +83,9 @@ class MissingIntegrationAddonsTest extends TestCase {
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function test_hub_or_spoke_without_the_sso_addon_is_reported(): void {
|
||||
eval( 'final class TMSO_Plugin {}' );
|
||||
|
||||
$this->assertSame( array( '2meet Hub / Spoke SSO' => '2meet-data-optimizer-sso-addon' ), TMDO_Compatibility::missing_integration_addons() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function test_hub_with_the_sso_addon_is_fine(): void {
|
||||
public function test_hub_and_spoke_need_no_addon(): void {
|
||||
eval( 'final class TMHC_Plugin {}' );
|
||||
eval( 'final class TMDO_SSO_Integration {}' );
|
||||
eval( 'final class TMSO_Plugin {}' );
|
||||
|
||||
$this->assertSame( array(), TMDO_Compatibility::missing_integration_addons() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user