From f5251da21e6e2042a77b5b8df890cd21bd3c2fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Cap=C3=B3?= Date: Sun, 4 Mar 2018 00:10:29 +0100 Subject: [PATCH] bug fix and solve multiple petitions when using IWP --- gitea-updater.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gitea-updater.php b/gitea-updater.php index 0ca6be3..f5d5705 100644 --- a/gitea-updater.php +++ b/gitea-updater.php @@ -3,7 +3,7 @@ * Plugin Name: Gitea Updater * Plugin URI: http://www.paucapo.com * Description: Plugins updater - * Version: 0.3.2 + * Version: 0.3.3 * Author: Pau Capó * Author URI: http://www.paucapo.com * Text Domain: gitea @@ -82,9 +82,16 @@ class Gitea_Updater function update($type) { + // disable cache in case of a force-check from admin site if (isset($_GET['force-check'])) { return true; } + // small hack for multiple checks when asked throw IWP + foreach ($_POST as $key => $value) { + if (substr($key, 0, 5) == '_IWP_') { + $this->cache = 30; + } + } $last_update = get_option('gitea_' . $type . '_updated'); return ($last_update + $this->cache) < time(); } @@ -93,6 +100,7 @@ class Gitea_Updater { if (!$this->update('plugins')) { + $this->plugins = get_option('gitea_plugins'); return; } @@ -148,6 +156,7 @@ class Gitea_Updater { if (!$this->update('themes')) { + $this->themes = get_option('gitea_themes'); return; }