Files
2meet-data-optimizer-latepo…/uninstall.php
T
wpdev d6258eeb00
Tests / PHP Lint (pull_request) Successful in 4s
refactor(2meet-data-optimizer-latepoint-addon): name the index table in uninstall.php
- Build the table name as $wpdb->prefix . 'hpct_latepoint_idx' like the installer does, so the package check (§10) can match the DROP to the CREATE
- Verify: php -l; package-plugin.sh §10
2026-09-26 21:55:19 +08:00

30 lines
1.0 KiB
PHP

<?php
/**
* Uninstall handler for 2meet Data Optimizer Latepoint AddOn.
*
* 僅清理本 AddOn 自有 schema(核心 wp_wpdo_* 系統表保留給 core)。
*
* @package TMDO_LATEPOINT
*/
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// wp_hpct_latepoint_idx is an index rebuilt from LatePoint's own bookings, so
// dropping it loses no data; LatePoint's tables are left untouched.
global $wpdb;
$tmdo_latepoint_blogs = is_multisite() ? get_sites( array( 'fields' => 'ids' ) ) : array( get_current_blog_id() );
foreach ( $tmdo_latepoint_blogs as $tmdo_latepoint_blog ) {
if ( is_multisite() ) {
switch_to_blog( $tmdo_latepoint_blog );
}
$tmdo_latepoint_table = $wpdb->prefix . 'hpct_latepoint_idx';
$wpdb->query( "DROP TABLE IF EXISTS `{$tmdo_latepoint_table}`" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange
delete_option( 'tmdo_latepoint_db_version' );
if ( is_multisite() ) {
restore_current_blog();
}
}