File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,15 +93,17 @@ public function __construct() {
9393 }
9494
9595 /**
96- * Register plugin activate/deactivate/uninstall hooks
96+ * Register plugin activate/deactivate hooks
9797 * NOTE: this can't be moved under after_setup_theme, otherwise activation will be bypassed
9898 *
99+ * Uninstall runs from uninstall.php: register_uninstall_hook() reads the non-autoloaded
100+ * `uninstall_plugins` option on every call, which cost one query per page view here.
101+ *
99102 * @since 2.7.1 Disabled admin&CLI check to make frontend able to enable cache too
100103 */
101104 $ plugin_file = LSCWP_DIR . 'litespeed-cache.php ' ;
102105 register_activation_hook ( $ plugin_file , [ __NAMESPACE__ . '\Activation ' , 'register_activation ' ] );
103106 register_deactivation_hook ( $ plugin_file , [ __NAMESPACE__ . '\Activation ' , 'register_deactivation ' ] );
104- register_uninstall_hook ( $ plugin_file , __NAMESPACE__ . '\Activation::uninstall_litespeed_cache ' );
105107
106108 if ( defined ( 'LITESPEED_ON ' ) ) {
107109 // Register purge_all actions
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Uninstall entry point, included by WordPress when the plugin is deleted.
4+ *
5+ * Replaces register_uninstall_hook(), which read the non-autoloaded `uninstall_plugins`
6+ * option on every request. The main file is included first, as WordPress did for the
7+ * hook, so the cleanup finds its classes and constants.
8+ *
9+ * @see https://developer.wordpress.org/plugins/plugin-basics/uninstall-methods/
10+ * @package LiteSpeed
11+ */
12+
13+ defined ( 'WP_UNINSTALL_PLUGIN ' ) || exit ();
14+
15+ require_once __DIR__ . '/litespeed-cache.php ' ;
16+
17+ \LiteSpeed \Activation::uninstall_litespeed_cache ();
You can’t perform that action at this time.
0 commit comments