summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Beaver <sbeaver@netgate.com>2017-07-26 10:10:12 -0400
committerSteve Beaver <sbeaver@netgate.com>2017-07-26 10:11:12 -0400
commit38af638a5f8324cfc8d2629ead7ecef81d17b59e (patch)
tree03ba290856bd5d68257dece25a017152b1a55eb8
parente14c441bf9e1c922001180ff6cc02e0b4ef91723 (diff)
downloadpfsense-38af638a5f8324cfc8d2629ead7ecef81d17b59e.zip
pfsense-38af638a5f8324cfc8d2629ead7ecef81d17b59e.tar.gz
Allow recheck on refresh if JSON not available
-rw-r--r--src/usr/local/www/widgets/widgets/support.widget.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/usr/local/www/widgets/widgets/support.widget.php b/src/usr/local/www/widgets/widgets/support.widget.php
index 9955f65..cc2237c 100644
--- a/src/usr/local/www/widgets/widgets/support.widget.php
+++ b/src/usr/local/www/widgets/widgets/support.widget.php
@@ -29,6 +29,7 @@ $nocsrf = true;
$supportfile = "/var/db/support.json";
$idfile = "/var/db/uniqueid";
$FQDN = "https://ews.netgate.com/support";
+$refreshinterval = (24 * 3600); // 24 hours
// Write a dummy support file containg an error message
function nosupportdata() {
@@ -36,6 +37,9 @@ function nosupportdata() {
file_put_contents($supportfile, sprintf(gettext("%sSupport information unavailable%s"),
"{\"summary\":\"<div class=\\\"alert alert-danger\\\">", "</div>\",\"htmltext\":\"\"}"));
+
+ // Make the file a day old so that the widget tries again on the next page load
+ touch($supportfile, (time() - $refreshinterval));
}
// Poll the Netgate server to obtain the JSON/HTML formatted support information
@@ -84,7 +88,7 @@ if ($_REQUEST['act'] == "refresh") {
// Retrieve the support data from Netgate.com if the supprt data file does not exist,
// or if it is more than a day old
-if (!file_exists($supportfile) || ( time()-filemtime($supportfile) > (24 * 3600))) {
+if (!file_exists($supportfile) || ( time()-filemtime($supportfile) > $refreshinterval)) {
updateSupport();
}
OpenPOWER on IntegriCloud