Files
wpdev 1a50ab20b8 chore: initial snapshot of 2meet-data-optimizer-collab-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

58 lines
2.0 KiB
PHP

<?php
/**
* TMDO_Collab — integration with 2meet-collab (Wave 3 / v2.2.0).
*
* 7 張表的協作系統。註冊全部 7 表。
*
* @package WP_Data_Optimizer
* @since 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// phpcs:disable Squiz.Commenting.FunctionComment.Missing,Squiz.Commenting.InlineComment.InvalidEndChar,Generic.Commenting.DocComment.MissingShort,WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.PHP.YodaConditions,Generic.CodeAnalysis.EmptyStatement -- v2.0.0 partner integrations: pure registration helpers + intentional silent catches.
/**
* 2meet-collab 整合。
*/
final class TMDO_Collab {
public static function register(): void {
$detected = class_exists( 'TMCLB_Plugin' )
|| class_exists( 'TMCLB_Main' )
|| file_exists( WP_PLUGIN_DIR . '/2meet-collab/2meet-collab.php' );
if ( ! $detected ) {
return;
}
add_action( 'wpdo_register_custom_tables', array( __CLASS__, 'register_custom_tables' ) );
}
public static function register_custom_tables( TMDO_Custom_Table_Registry $registry ): void {
// v2.0.4 修正:表名與 2meet-collab v0.1.2-alpha+ 實際 DB schema 對齊。
// 之前 v2.0.0~v2.0.3 使用截短名(templates / instances / history / venues)導致
// `wp wpdo doctor` 找不到實際表,誤報 missing。實際表名來自 2meet-collab 自身:
// `class-tmclb-activator.php` CREATE TABLE 與 `uninstall.php` 的 7 張表。
$tables = array(
'2mclb_rider_templates' => array( 'id', null ),
'2mclb_rider_instances' => array( 'id', 'hp_vendor' ),
'2mclb_collaborators' => array( 'id', null ),
'2mclb_confirmations' => array( 'id', null ),
'2mclb_comments' => array( 'id', null ),
'2mclb_rider_history' => array( 'id', null ),
'2mclb_venue_profiles' => array( 'id', null ),
);
foreach ( $tables as $table_name => $meta ) {
$registry->register(
'2meet-collab',
array(
'table_name' => $table_name,
'primary_key' => $meta[0],
'post_type_link' => $meta[1],
)
);
}
}
}