fix(2meet-data-optimizer-latepoint-addon): drop the booking index table on uninstall
Tests / PHP Lint (pull_request) Successful in 4s

- 0.1.1 started creating wp_hpct_latepoint_idx, but uninstall.php was still the Phase 0 stub and left it behind (package check §10: CREATE without DROP)
- Uninstall drops the table and the tmdo_latepoint_db_version option on every site; LatePoint's own tables are kept (the index is rebuilt from its bookings)
- Version 0.1.2, CHANGELOG
- Verify: php -l; dev36 uninstall run removed a stand-in table and the option
This commit is contained in:
2026-09-26 21:54:20 +08:00
parent c9378e9c9f
commit d0723c5d0a
3 changed files with 28 additions and 3 deletions
+15 -1
View File
@@ -11,4 +11,18 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Phase 3 完整實作。Phase 0 stub:保留所有資料以避免誤刪。
// 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 );
}
$wpdb->query( 'DROP TABLE IF EXISTS `' . $wpdb->prefix . 'hpct_latepoint_idx`' ); // 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();
}
}