Revision 38af638a
Added by Steve Beaver almost 8 years ago
src/usr/local/www/widgets/widgets/support.widget.php | ||
---|---|---|
29 | 29 |
$supportfile = "/var/db/support.json"; |
30 | 30 |
$idfile = "/var/db/uniqueid"; |
31 | 31 |
$FQDN = "https://ews.netgate.com/support"; |
32 |
$refreshinterval = (24 * 3600); // 24 hours |
|
32 | 33 |
|
33 | 34 |
// Write a dummy support file containg an error message |
34 | 35 |
function nosupportdata() { |
... | ... | |
36 | 37 |
|
37 | 38 |
file_put_contents($supportfile, sprintf(gettext("%sSupport information unavailable%s"), |
38 | 39 |
"{\"summary\":\"<div class=\\\"alert alert-danger\\\">", "</div>\",\"htmltext\":\"\"}")); |
40 |
|
|
41 |
// Make the file a day old so that the widget tries again on the next page load |
|
42 |
touch($supportfile, (time() - $refreshinterval)); |
|
39 | 43 |
} |
40 | 44 |
|
41 | 45 |
// Poll the Netgate server to obtain the JSON/HTML formatted support information |
... | ... | |
84 | 88 |
|
85 | 89 |
// Retrieve the support data from Netgate.com if the supprt data file does not exist, |
86 | 90 |
// or if it is more than a day old |
87 |
if (!file_exists($supportfile) || ( time()-filemtime($supportfile) > (24 * 3600))) {
|
|
91 |
if (!file_exists($supportfile) || ( time()-filemtime($supportfile) > $refreshinterval)) {
|
|
88 | 92 |
updateSupport(); |
89 | 93 |
} |
90 | 94 |
|
Also available in: Unified diff
Allow recheck on refresh if JSON not available