From aceb9e62a528425adb700a6a46828a9d1eb50eb5 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Sat, 20 Oct 2012 14:24:04 +0000 Subject: [PATCH] Add a resetUpdateState() method for clearing update cache, last check timestamp and last checked version. --- plugin-update-checker.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugin-update-checker.php b/plugin-update-checker.php index 40d4ef9..7f924eb 100644 --- a/plugin-update-checker.php +++ b/plugin-update-checker.php @@ -159,7 +159,7 @@ class PluginUpdateChecker { $url, $options ); - + //Try to parse the response $pluginInfo = null; if ( !is_wp_error($result) && isset($result['response']['code']) && ($result['response']['code'] == 200) && !empty($result['body']) ){ @@ -309,6 +309,16 @@ class PluginUpdateChecker { } update_option($this->optionName, $state); } + + /** + * Reset update checker state - i.e. last check time, cached update data and so on. + * + * Call this when your plugin is being uninstalled, or if you want to + * clear the update cache. + */ + public function resetUpdateState() { + delete_option($this->optionName); + } /** * Intercept plugins_api() calls that request information about our plugin and @@ -432,6 +442,7 @@ class PluginUpdateChecker { '

%s

', apply_filters('puc_manual_check_message-' . $this->slug, $message, $update) ); + //todo: the update doesn't show up right away, why? } }