← All changes
|
includes/abilities/settings/wdesignkit-remove-database.php
+18
-1
2.6.3
→
2.7.0
View file →
| @@ -63,10 +63,16 @@ | ||
| 63 | 63 | ], |
| 64 | 64 | 'execute_callback' => 'wdesignkit_mcp_remove_database', |
| 65 | 65 | 'permission_callback' => 'wdesignkit_mcp_permission_callback', |
| 66 | 66 | 'meta' => [ |
| 67 | + // action "execute" irreversibly deletes the plugin's stored data, which is the data half | |
| 68 | + // of deleting the plugin — gated on delete_plugins so a multisite site admin (who has | |
| 69 | + // manage_options but not delete_plugins) cannot wipe it. Enforced via | |
| 70 | + // wp_ability_permission_result (WP 7.1+); see class-wdk-ability-lifecycle.php. | |
| 71 | + 'required_capability' => 'delete_plugins', | |
| 72 | + 'public' => false, | |
| 67 | 73 | 'show_in_rest' => true, |
| 68 | - 'mcp' => ['public' => true], | |
| 74 | + 'mcp' => ['public' => false], | |
| 69 | 75 | 'annotations' => [ |
| 70 | 76 | 'instructions' => implode("\n", [ |
| 71 | 77 | 'Manages WDesignKit database cleanup.', |
| 72 | 78 | 'action "get": returns current remove_db config (default if action omitted).', |
| @@ -226,8 +232,19 @@ | ||
| 226 | 232 | 'wdkit_dark_mode', |
| 227 | 233 | 'wdkit_wintersale_notice_dismissed', |
| 228 | 234 | 'wdkit_rating_banner_start_date (all users)', |
| 229 | 235 | ]; |
| 236 | + } | |
| 237 | + | |
| 238 | + // Both branches above delete wkit_deactivate_widgets, and the cached widget registry bakes | |
| 239 | + // that option's membership in. The cache is a no-expiry transient, so without this the | |
| 240 | + // widgets the reset was meant to re-enable stayed unregistered indefinitely | |
| 241 | + // (ClickUp 86d41cd18 — same root cause as the admin activate/deactivate path, 86d41cck1). | |
| 242 | + if (($new_config['widget_builder_data'] || $new_config['all_data']) | |
| 243 | + && function_exists('wdesignkit_invalidate_widget_registry')) { | |
| 244 | + foreach (['elementor', 'gutenberg', 'gutenberg_core', 'bricks'] as $builder_slug) { | |
| 245 | + wdesignkit_invalidate_widget_registry($builder_slug); | |
| 246 | + } | |
| 230 | 247 | } |
| 231 | 248 | } |
| 232 | 249 | |
| 233 | 250 | return [ |