From 203ce96618b1e01fe064c469169999cafbe8047f Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Sun, 13 Apr 2025 02:02:31 +0100 Subject: [PATCH] Fix plugin details popup to show correct version and changelog --- scripts/deploy-local.sh | 12 ++++ wp-fix-plugin-does-not-exist-notices.php | 74 +++++++++++++++++++++--- 2 files changed, 78 insertions(+), 8 deletions(-) diff --git a/scripts/deploy-local.sh b/scripts/deploy-local.sh index ed82ec7..28a2307 100755 --- a/scripts/deploy-local.sh +++ b/scripts/deploy-local.sh @@ -7,6 +7,7 @@ set -e PLUGIN_SLUG="wp-fix-plugin-does-not-exist-notices" SOURCE_DIR="/Users/marcusquinn/Git/wp-fix-plugin-does-not-exist-notices/build/$PLUGIN_SLUG" DEST_DIR="/Users/marcusquinn/Local/plugin-testing/app/public/wp-content/plugins/$PLUGIN_SLUG" +WP_CLI="/Users/marcusquinn/Local/plugin-testing/app/bin/wp" # Check if build directory exists if [ ! -d "$SOURCE_DIR" ]; then @@ -30,5 +31,16 @@ fi echo "Deploying to local WordPress installation..." rsync -av --delete "$SOURCE_DIR/" "$DEST_DIR/" +# Clear WordPress transients to ensure fresh plugin data +echo "Clearing WordPress transients..." +if [ -f "$WP_CLI" ]; then + cd /Users/marcusquinn/Local/plugin-testing/app/public + "$WP_CLI" transient delete --all + "$WP_CLI" cache flush + echo "✅ WordPress transients cleared" +else + echo "⚠️ WP-CLI not found, skipping transient clearing" +fi + echo "✅ Local deployment successful!" echo "Plugin deployed to: $DEST_DIR" diff --git a/wp-fix-plugin-does-not-exist-notices.php b/wp-fix-plugin-does-not-exist-notices.php index ecd655f..d21f817 100644 --- a/wp-fix-plugin-does-not-exist-notices.php +++ b/wp-fix-plugin-does-not-exist-notices.php @@ -426,19 +426,32 @@ class Fix_Plugin_Does_Not_Exist_Notices { // Set all the properties we need $new_result->name = isset($result->name) ? $result->name : basename( $plugin_file ); $new_result->slug = $args->slug; - $new_result->version = FPDEN_VERSION; + $new_result->version = FPDEN_VERSION . ' (' . date('Y-m-d') . ')'; $new_result->author = 'Marcus Quinn & WP ALLSTARS'; $new_result->author_profile = 'https://www.wpallstars.com'; $new_result->requires = '5.0'; - $new_result->tested = '6.5'; + $new_result->tested = '6.7.2'; // Updated to match readme.txt $new_result->requires_php = '7.0'; $new_result->last_updated = date('Y-m-d H:i:s'); + + // Get changelog from readme.txt + $readme_file = FPDEN_PLUGIN_DIR . 'readme.txt'; + $changelog = '
/wp-content/plugins/
'
),
- 'changelog' => 'Yes, this plugin only removes entries from the WordPress active_plugins option, which is safe to modify when a plugin no longer exists.
' ); @@ -456,8 +469,8 @@ class Fix_Plugin_Does_Not_Exist_Notices { ) ); - // Add a random number to force cache refresh - $new_result->download_link = 'https://www.wpallstars.com/plugins/wp-fix-plugin-does-not-exist-notices.zip?v=' . FPDEN_VERSION . '&cb=' . mt_rand(1000000, 9999999); + // Add a random number and timestamp to force cache refresh + $new_result->download_link = 'https://www.wpallstars.com/plugins/wp-fix-plugin-does-not-exist-notices.zip?v=' . FPDEN_VERSION . '&cb=' . mt_rand(1000000, 9999999) . '&t=' . time(); // Add active installations count $new_result->active_installs = 1000; @@ -552,13 +565,58 @@ class Fix_Plugin_Does_Not_Exist_Notices { $plugin_slug = basename( $plugin_file, '.php' ); } - // Delete the transient for this plugin + // Delete all possible transients for this plugin delete_transient( 'plugins_api_' . $plugin_slug ); delete_site_transient( 'plugins_api_' . $plugin_slug ); + delete_transient( 'plugin_information_' . $plugin_slug ); + delete_site_transient( 'plugin_information_' . $plugin_slug ); - // Also delete the update transient which might cache plugin info - delete_site_transient( 'update_plugins' ); + // Clear any other transients that might be caching plugin info + $this->clear_all_plugin_transients(); } + + // Also clear our own plugin's cache + $this->clear_own_plugin_cache(); + } + + /** + * Clear all plugin-related transients that might be caching information. + * + * @return void + */ + private function clear_all_plugin_transients() { + // Clear update cache + delete_site_transient( 'update_plugins' ); + delete_site_transient( 'update_themes' ); + delete_site_transient( 'update_core' ); + + // Clear plugins API cache + delete_site_transient( 'plugin_information' ); + + // Clear plugin update counts + delete_transient( 'plugin_updates_count' ); + delete_site_transient( 'plugin_updates_count' ); + + // Clear plugin slugs cache + delete_transient( 'plugin_slugs' ); + delete_site_transient( 'plugin_slugs' ); + } + + /** + * Clear cache specifically for our own plugin. + * + * @return void + */ + private function clear_own_plugin_cache() { + // Clear our own plugin's cache + $our_slug = 'wp-fix-plugin-does-not-exist-notices'; + delete_transient( 'plugins_api_' . $our_slug ); + delete_site_transient( 'plugins_api_' . $our_slug ); + delete_transient( 'plugin_information_' . $our_slug ); + delete_site_transient( 'plugin_information_' . $our_slug ); + + // Force refresh of plugin update information + wp_clean_plugins_cache(true); } } // End class Fix_Plugin_Does_Not_Exist_Notices