From 53eab762036fa80e57bccdff3d7da969b08f3fe4 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 4 Sep 2024 09:46:36 +0300 Subject: [PATCH 1/3] Remove autoload from the plugin option on plugin deactivation --- uninstall.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 uninstall.php diff --git a/uninstall.php b/uninstall.php new file mode 100644 index 0000000..6cb3b1f --- /dev/null +++ b/uninstall.php @@ -0,0 +1,17 @@ + Date: Wed, 4 Sep 2024 09:49:36 +0300 Subject: [PATCH 2/3] Add deactivation hook --- aaa-option-optimizer.php | 11 +++++++++++ uninstall.php | 7 +++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/aaa-option-optimizer.php b/aaa-option-optimizer.php index 3b0b2d9..7eaf1a7 100644 --- a/aaa-option-optimizer.php +++ b/aaa-option-optimizer.php @@ -24,6 +24,7 @@ require_once __DIR__ . '/src/autoload.php'; register_activation_hook( __FILE__, 'aaa_option_optimizer_activation' ); +register_deactivation_hook( __FILE__, 'aaa_option_optimizer_deactivation' ); /** * Activation hooked function to store start stats. @@ -46,6 +47,16 @@ function aaa_option_optimizer_activation() { ); } +/** + * Deactivation hooked function to remove autoload from the plugin option. + * + * @return void + */ +function aaa_option_optimizer_deactivation() { + $aaa_option_value = get_option( 'option_optimizer' ); + update_option( 'option_optimizer', $aaa_option_value, false ); +} + /** * Initializes the plugin. * diff --git a/uninstall.php b/uninstall.php index 6cb3b1f..16fc9af 100644 --- a/uninstall.php +++ b/uninstall.php @@ -2,7 +2,7 @@ /** * Uninstall the plugin. * - * Remove autoload from the plugin option. + * Delete the plugin option. * * @package Progress_Planner */ @@ -12,6 +12,5 @@ exit; } -// Remove autoload from the plugin option. -$aaa_option_value = get_option( 'option_optimizer' ); -update_option( 'option_optimizer', $aaa_option_value, false ); \ No newline at end of file +// Delete the plugin option. +delete_option( 'option_optimizer' ); \ No newline at end of file From 3b1b7ad45db19f7cdf0695750d16f686f7630781 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 4 Sep 2024 09:53:26 +0300 Subject: [PATCH 3/3] CS --- uninstall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uninstall.php b/uninstall.php index 16fc9af..4fa17e2 100644 --- a/uninstall.php +++ b/uninstall.php @@ -13,4 +13,4 @@ } // Delete the plugin option. -delete_option( 'option_optimizer' ); \ No newline at end of file +delete_option( 'option_optimizer' );