From bfaa2b807ac13a980554f64df640ab02d6cff168 Mon Sep 17 00:00:00 2001 From: Marcus Quinn <6428977+marcusquinn@users.noreply.github.com> Date: Sat, 12 Apr 2025 15:11:33 +0100 Subject: [PATCH] CRITICAL FIX: Remove auto-deactivation prevention code causing fatal errors (v1.6.11) --- README.md | 6 +++ fix-plugin-does-not-exist-notices.php | 49 ++----------------- .../fix-plugin-does-not-exist-notices.pot | 2 +- readme.txt | 12 +++-- 4 files changed, 21 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index b461dc0..8a7e0eb 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,12 @@ The plugin works by: ## Changelog +### 1.6.11 +* CRITICAL FIX: Completely removed auto-deactivation prevention code that was causing fatal errors +* Simplified plugin functionality to focus on core features only +* Improved compatibility with various WordPress configurations +* Ensured plugin works correctly when other plugins are deleted + ### 1.6.10 * Fixed critical error that could occur when a plugin folder is deleted * Improved error handling with try/catch blocks diff --git a/fix-plugin-does-not-exist-notices.php b/fix-plugin-does-not-exist-notices.php index 1413b82..80f7a82 100644 --- a/fix-plugin-does-not-exist-notices.php +++ b/fix-plugin-does-not-exist-notices.php @@ -13,7 +13,7 @@ * Plugin Name: Fix 'Plugin file does not exist.' Notices * Plugin URI: https://wordpress.org/plugins/fix-plugin-does-not-exist-notices/ * Description: Adds missing plugins to the plugins list with a "Remove Reference" link so you can permanently clean up invalid plugin entries and remove error notices. - * Version: 1.6.10 + * Version: 1.6.11 * Author: Marcus Quinn * Author URI: https://www.wpallstars.com * License: GPL-2.0+ @@ -48,7 +48,7 @@ if ( ! defined( 'ABSPATH' ) ) { } // Define plugin constants -define( 'FPDEN_VERSION', '1.6.10' ); +define( 'FPDEN_VERSION', '1.6.11' ); define( 'FPDEN_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'FPDEN_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'FPDEN_PLUGIN_FILE', __FILE__ ); @@ -99,8 +99,8 @@ class Fix_Plugin_Does_Not_Exist_Notices { // Enqueue admin scripts and styles. add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) ); - // Prevent WordPress from automatically deactivating missing plugins - add_filter( 'pre_option_recently_activated', array( $this, 'prevent_auto_deactivation' ) ); + // We're no longer trying to prevent WordPress from auto-deactivating plugins + // as it was causing critical errors in some environments } /** @@ -395,46 +395,7 @@ class Fix_Plugin_Does_Not_Exist_Notices { return $this->invalid_plugins; } - /** - * Safely prevent WordPress from automatically deactivating missing plugins. - * - * WordPress normally deactivates plugins that don't exist and adds them to the - * 'recently_activated' option. This filter modifies that behavior so we can - * handle the deactivation ourselves through our UI, but only on the plugins page. - * - * @param mixed $pre_option The value to return instead of the option value. - * @return mixed The original value (null) to let WordPress proceed, or an array to override. - */ - public function prevent_auto_deactivation( $pre_option ) { - // Safety check - if we're not in admin or if this isn't the plugins page, don't interfere - if ( ! is_admin() || ! function_exists( 'get_current_screen' ) ) { - return $pre_option; - } - - // Get current screen - only proceed if we're on the plugins page - $screen = get_current_screen(); - if ( ! $screen || 'plugins' !== $screen->base ) { - return $pre_option; - } - - // Only apply our logic if we're on an admin page and specifically the plugins.php page - global $pagenow; - if ( 'plugins.php' !== $pagenow ) { - return $pre_option; - } - - // We're on the plugins page, so let's try to preserve the current state - try { - // Get the current value of recently_activated - $recently_activated = get_option( 'recently_activated', array() ); - - // Return the current value to prevent WordPress from modifying it - return $recently_activated; - } catch ( Exception $e ) { - // If anything goes wrong, let WordPress handle it normally - return $pre_option; - } - } +// We've removed the prevent_auto_deactivation method as it was causing critical errors } // End class Fix_Plugin_Does_Not_Exist_Notices // Initialize the plugin class. diff --git a/languages/fix-plugin-does-not-exist-notices.pot b/languages/fix-plugin-does-not-exist-notices.pot index 346d0bf..eb7b3a9 100644 --- a/languages/fix-plugin-does-not-exist-notices.pot +++ b/languages/fix-plugin-does-not-exist-notices.pot @@ -2,7 +2,7 @@ # This file is distributed under the GPL-2.0+. msgid "" msgstr "" -"Project-Id-Version: Fix 'Plugin file does not exist.' Notices 1.6.10\n" +"Project-Id-Version: Fix 'Plugin file does not exist.' Notices 1.6.11\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/fix-plugin-does-not-exist-notices\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/readme.txt b/readme.txt index d2cf47b..dde8bcd 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: plugins, missing plugins, cleanup, error fix, admin tools, plugin file doe Requires at least: 5.0 Tested up to: 6.4 Requires PHP: 7.0 -Stable tag: 1.6.10 +Stable tag: 1.6.11 License: GPL-2.0+ License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -89,6 +89,12 @@ Although this plugin consumes minimal disk space, and doesn't run unless you are == Changelog == += 1.6.11 = +* CRITICAL FIX: Completely removed auto-deactivation prevention code that was causing fatal errors +* Simplified plugin functionality to focus on core features only +* Improved compatibility with various WordPress configurations +* Ensured plugin works correctly when other plugins are deleted + = 1.6.10 = * Fixed critical error that could occur when a plugin folder is deleted * Improved error handling with try/catch blocks @@ -241,8 +247,8 @@ Although this plugin consumes minimal disk space, and doesn't run unless you are == Upgrade Notice == -= 1.6.10 = -CRITICAL FIX: Resolves an issue that could cause a fatal error when a plugin folder is deleted. Upgrade immediately if you're experiencing the "critical error" message. += 1.6.11 = +URGENT CRITICAL FIX: Completely removes code that was causing fatal errors. If you're experiencing the "critical error" message, this update will resolve it. = 1.6.3 = Fixed Git Updater repository URLs and updated organization naming for consistent branding across all platforms!