From 76019713e87dfa801e61839b2ae2ec45d12a1892 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Tue, 23 Oct 2012 16:35:35 +0000 Subject: [PATCH] If there's no external update to display, remove any cached update info WordPress might have about the plugin. This is a significant change from previous behaviour where the library would leave the value of the "update_transients" unmodified if there were no updates available. That worked fine at the time because WP wouldn't re-save the injected update to the DB. So when no updates were available, old cached updates wouldn't show up either. However, this appears to have changed - in some cases, the injected update sticks around even if the plugin is no longer injecting it. This patch counters that. Drawback: If you use this library in a plugin that's hosted on wordpress.org, it will overwrite any update data from wordpress.org with its own and effectively disable wordpress.org updates for your plugin (doesn't affect other plugins). --- plugin-update-checker.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin-update-checker.php b/plugin-update-checker.php index 6829518..20b08c7 100644 --- a/plugin-update-checker.php +++ b/plugin-update-checker.php @@ -360,6 +360,8 @@ class PluginUpdateChecker { //Let plugins filter the update info before it's passed on to WordPress. $update = apply_filters('puc_pre_inject_update-' . $this->slug, $update); $updates->response[$this->pluginFile] = $update->toWpFormat(); + } else { + unset($updates->response[$this->pluginFile]); } return $updates;