Files
2meet-data-optimizer-spoke-…/includes/class-tmdo-spoke-custom-tables.php
T
wpdev 265bd14903 chore: initial snapshot of 2meet-data-optimizer-spoke-addon v0.1.0
Baseline before backporting wp-data-optimizer v3.0.1-v3.4.6.

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

53 lines
1.1 KiB
PHP

<?php
/**
* Register spoke-sso 2 custom tables to TMDO Custom Table Registry.
*
* @package TMDO_SPOKE
* @since 0.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
final class TMDO_Spoke_Custom_Tables {
private static bool $registered = false;
private const TABLES = array(
'2mso_sso_config' => array(
'description' => 'spoke-sso Hub OAuth2 連線設定',
),
'2mso_user_mapping' => array(
'description' => 'spoke-sso Hub global_user_id ↔ local user_id mapping',
),
);
/**
* Register tables to TMDO Custom Table Registry.
*
* @param object $registry TMDO_Custom_Table_Registry / WPDO_Custom_Table_Registry instance.
*/
public static function register( $registry ): void {
if ( self::$registered ) {
return;
}
if ( ! is_object( $registry ) || ! method_exists( $registry, 'register' ) ) {
return;
}
foreach ( self::TABLES as $suffix => $meta ) {
$registry->register(
'2meet-data-optimizer-spoke-addon',
array(
'table_name' => $suffix,
'primary_key' => 'id',
'description' => $meta['description'],
)
);
}
self::$registered = true;
}
}