Fix plugin details popup to show correct version and changelog
This commit is contained in:
@ -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"
|
||||
|
@ -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 = '<a href="https://www.wpallstars.com">Marcus Quinn & WP ALLSTARS</a>';
|
||||
$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 = '<h2>' . FPDEN_VERSION . '</h2><ul><li>Fixed: Plugin details popup now correctly shows version and author information</li><li>Added: Cache-busting mechanism to ensure plugin details are always up-to-date</li><li>Improved: Author and contributor information display</li></ul>';
|
||||
|
||||
if (file_exists($readme_file)) {
|
||||
$readme_content = file_get_contents($readme_file);
|
||||
if (preg_match('/== Changelog ==\s*\n\s*= ' . FPDEN_VERSION . ' =(.*?)(?:= \d|$)/s', $readme_content, $matches)) {
|
||||
$version_changelog = trim($matches[1]);
|
||||
$changelog = '<h2>' . FPDEN_VERSION . '</h2>' . wpautop($version_changelog);
|
||||
}
|
||||
}
|
||||
|
||||
$new_result->sections = array(
|
||||
'description' => sprintf(
|
||||
__( 'This plugin is still marked as "Active" in your database — but its folder and files can\'t be found in %s. Use the "Remove Notice" link on the plugins page to permanently remove it from your active plugins list and eliminate the error notice.', 'wp-fix-plugin-does-not-exist-notices' ),
|
||||
'<code>/wp-content/plugins/</code>'
|
||||
),
|
||||
'changelog' => '<h2>2.0.8</h2><ul><li>Fixed: Plugin details popup now correctly shows version and author information</li><li>Added: Cache-busting mechanism to ensure plugin details are always up-to-date</li><li>Improved: Author and contributor information display</li></ul>',
|
||||
'changelog' => $changelog,
|
||||
'faq' => '<h3>Is it safe to remove plugin references?</h3><p>Yes, this plugin only removes entries from the WordPress active_plugins option, which is safe to modify when a plugin no longer exists.</p>'
|
||||
);
|
||||
|
||||
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user