From e549a743940ea19cc9d320afc0ca2ea425829446 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Sun, 13 Apr 2025 02:39:42 +0100 Subject: [PATCH] Bump version to 2.0.10 with improved plugin details popup display --- CHANGELOG.md | 18 +++ assets/js/plugin-details-fix.js | 30 ++--- build.sh | 4 + clear-transients.php | 109 ++++++++++++++++++ deploy-local.sh | 4 + .../wp-fix-plugin-does-not-exist-notices.pot | 6 +- readme.txt | 8 +- wp-fix-plugin-does-not-exist-notices.php | 4 +- 8 files changed, 162 insertions(+), 21 deletions(-) create mode 100644 clear-transients.php create mode 100755 deploy-local.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 1de52a3..e3cb5d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,24 @@ All notable changes to this project will be documented in this file. +## [2.0.10] - 2024-05-18 +### Fixed +- Plugin details popup version display issue with Git Updater integration +- Added JavaScript-based solution to ensure correct version display in plugin details + +### Improved +- Version consistency across all plugin views +- Enhanced cache busting for plugin information API + +## [2.0.9] - 2024-05-18 +### Fixed +- Plugin details popup now correctly shows version and author information +- Added support for both old and new plugin slugs to fix caching issues + +### Improved +- Cache clearing mechanism to ensure plugin details are always up-to-date +- Enhanced version display in plugin details popup + ## [2.0.8] - 2024-05-17 ### Fixed - Plugin details popup now correctly shows version and author information diff --git a/assets/js/plugin-details-fix.js b/assets/js/plugin-details-fix.js index a523684..b7da7b9 100644 --- a/assets/js/plugin-details-fix.js +++ b/assets/js/plugin-details-fix.js @@ -1,6 +1,6 @@ /** * Fix Plugin Details Popup - * + * * This script directly modifies the plugin details popup to show the correct version * when the popup is opened for our plugin. */ @@ -8,11 +8,11 @@ 'use strict'; // Current plugin version - this should match the version in the main plugin file - const CURRENT_VERSION = '2.0.9'; - + const CURRENT_VERSION = '2.0.10'; + // Plugin slugs to check for const OUR_SLUGS = ['wp-fix-plugin-does-not-exist-notices', 'fix-plugin-does-not-exist-notices']; - + // Wait for the document to be ready $(document).ready(function() { // Listen for the thickbox to open (WordPress uses thickbox for plugin details) @@ -21,50 +21,50 @@ if (window.location.href.indexOf('plugins.php') === -1) { return; } - + // Set a timeout to allow the thickbox content to load setTimeout(function() { // Get the thickbox content const $thickbox = $('#TB_window'); if (!$thickbox.length) return; - + // Get the plugin slug from the URL const tbUrl = $('#TB_iframeContent').attr('src'); if (!tbUrl) return; - + // Extract the plugin slug from the URL const slugMatch = tbUrl.match(/plugin=([^&]+)/); if (!slugMatch || !slugMatch[1]) return; - + const pluginSlug = decodeURIComponent(slugMatch[1]); - + // Check if this is our plugin if (OUR_SLUGS.indexOf(pluginSlug) !== -1) { console.log('Fixing plugin details for: ' + pluginSlug); - + // Find the version element in the thickbox const $iframe = $('#TB_iframeContent'); if (!$iframe.length) return; - + // Wait for iframe to load $iframe.on('load', function() { const iframeDoc = this.contentDocument || this.contentWindow.document; - + // Find the version element const $versionElement = $(iframeDoc).find('.plugin-version-author-uri'); if (!$versionElement.length) return; - + // Update the version text const versionText = $versionElement.text(); const newVersionText = versionText.replace(/Version: [0-9.]+/, 'Version: ' + CURRENT_VERSION); $versionElement.text(newVersionText); - + // Also update the version in the header if it exists const $versionHeader = $(iframeDoc).find('h2:contains("Version:")'); if ($versionHeader.length) { $versionHeader.text('Version: ' + CURRENT_VERSION); } - + console.log('Plugin details updated to version: ' + CURRENT_VERSION); }); } diff --git a/build.sh b/build.sh index af39536..d04b671 100755 --- a/build.sh +++ b/build.sh @@ -52,6 +52,10 @@ cd .. if [ -f "$ZIP_FILE" ]; then echo "✅ Build successful: $ZIP_FILE created" echo "File path: $(pwd)/$ZIP_FILE" + + # Deploy to local WordPress installation + echo "\nDeploying to local WordPress installation..." + ./scripts/deploy-local.sh else echo "❌ Build failed: ZIP file was not created" exit 1 diff --git a/clear-transients.php b/clear-transients.php new file mode 100644 index 0000000..6e80684 --- /dev/null +++ b/clear-transients.php @@ -0,0 +1,109 @@ +query($wpdb->prepare( + "DELETE FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s", + '%' . $wpdb->esc_like('_transient_' . $slug) . '%', + '%' . $wpdb->esc_like('_transient_timeout_' . $slug) . '%' + )); + + // Delete site transients too (for multisite) + if (is_multisite()) { + $wpdb->query($wpdb->prepare( + "DELETE FROM $wpdb->sitemeta WHERE meta_key LIKE %s OR meta_key LIKE %s", + '%' . $wpdb->esc_like('_site_transient_' . $slug) . '%', + '%' . $wpdb->esc_like('_site_transient_timeout_' . $slug) . '%' + )); + } + } + + // Clear all plugin API transients + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '%_transient_plugins_api_%'"); + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '%_transient_timeout_plugins_api_%'"); + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '%_transient_plugin_information_%'"); + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '%_transient_timeout_plugin_information_%'"); + + // Clear site transients too (for multisite) + if (is_multisite()) { + $wpdb->query("DELETE FROM $wpdb->sitemeta WHERE meta_key LIKE '%_site_transient_plugins_api_%'"); + $wpdb->query("DELETE FROM $wpdb->sitemeta WHERE meta_key LIKE '%_site_transient_timeout_plugins_api_%'"); + $wpdb->query("DELETE FROM $wpdb->sitemeta WHERE meta_key LIKE '%_site_transient_plugin_information_%'"); + $wpdb->query("DELETE FROM $wpdb->sitemeta WHERE meta_key LIKE '%_site_transient_timeout_plugin_information_%'"); + } + + // Clear update cache + delete_site_transient('update_plugins'); + delete_site_transient('update_themes'); + delete_site_transient('update_core'); + 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'); + + // Force refresh of plugin update information + if (function_exists('wp_clean_plugins_cache')) { + wp_clean_plugins_cache(true); + } + + // Clear object cache + if (function_exists('wp_cache_flush')) { + wp_cache_flush(); + } + + // Add admin notice + add_action('admin_notices', 'plugin_transients_cleared_notice'); +} + +/** + * Display admin notice + */ +function plugin_transients_cleared_notice() { + ?> +
+

Plugin Transients Cleared: All plugin transients have been cleared from the database.

+
+ \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-05-17T12:00:00+00:00\n" +"POT-Creation-Date: 2024-05-18T12:00:00+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.8.1\n" "X-Domain: wp-fix-plugin-does-not-exist-notices\n" @@ -27,7 +27,7 @@ msgid "Adds missing plugins to the plugins list with a \"Remove Reference\" link msgstr "" #. Author of the plugin -msgid "Marcus Quinn" +msgid "Marcus Quinn & The WP ALLSTARS Team" msgstr "" #. Author URI of the plugin diff --git a/readme.txt b/readme.txt index 8179821..8608497 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.7.2 Requires PHP: 7.0 -Stable tag: 2.0.9 +Stable tag: 2.0.10 License: GPL-2.0+ License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -140,6 +140,12 @@ Manually editing the WordPress database is risky and requires technical knowledg == Changelog == += 2.0.10 = +* Fixed: Plugin details popup version display issue with Git Updater integration +* Added: JavaScript-based solution to ensure correct version display in plugin details +* Improved: Version consistency across all plugin views +* Enhanced: Cache busting for plugin information API + = 2.0.9 = * Fixed: Plugin details popup now correctly shows version and author information * Added: Support for both old and new plugin slugs to fix caching issues diff --git a/wp-fix-plugin-does-not-exist-notices.php b/wp-fix-plugin-does-not-exist-notices.php index bc56753..2dd9533 100644 --- a/wp-fix-plugin-does-not-exist-notices.php +++ b/wp-fix-plugin-does-not-exist-notices.php @@ -3,7 +3,7 @@ * Plugin Name: Fix 'Plugin file does not exist' Notices * Plugin URI: https://www.wpallstars.com * Description: Adds missing plugins to your plugins list with a "Remove Notice" action link, allowing you to safely clean up invalid plugin references. - * Version: 2.0.9 + * Version: 2.0.10 * Author: Marcus Quinn & WP ALLSTARS * Author URI: https://www.wpallstars.com * License: GPL-2.0+ @@ -23,7 +23,7 @@ if ( ! defined( 'WPINC' ) ) { } // Define plugin constants. -define( 'FPDEN_VERSION', '2.0.9' ); +define( 'FPDEN_VERSION', '2.0.10' ); define( 'FPDEN_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'FPDEN_PLUGIN_URL', plugin_dir_url( __FILE__ ) );