better skipcache integration

This commit is contained in:
Jokob-sk
2023-01-01 14:33:32 +11:00
parent 9cc4513ba1
commit 5ed57780a3
5 changed files with 28 additions and 17 deletions

View File

@@ -21,11 +21,17 @@
// Set maximum execution time to 15 seconds
ini_set ('max_execution_time','15');
$skipCache = FALSE;
if (isset ($_REQUEST['skipcache'])) {
$skipCache = TRUE;
}
// Action functions
if (isset ($_REQUEST['action']) && !empty ($_REQUEST['action'])) {
$action = $_REQUEST['action'];
switch ($action) {
case 'get': getParameter(); break;
case 'get': getParameter($skipCache); break;
case 'set': setParameter(); break;
default: logServerConsole ('Action: '. $action); break;
}
@@ -35,7 +41,7 @@
//------------------------------------------------------------------------------
// Get Parameter Value
//------------------------------------------------------------------------------
function getParameter() {
function getParameter($skipCache) {
$parameter = $_REQUEST['parameter'];
$value = "";
@@ -47,7 +53,7 @@ function getParameter() {
}
// query the database if no cache entry found or requesting live data for the Back_App_State in the header
if($parameter == "Back_App_State" || $value == "" )
if($skipCache || $value == "" )
{
global $db;

View File

@@ -83,7 +83,7 @@ if ($ENABLED_DARKMODE === True) {
<script>
function updateState(){
getParam("state","Back_App_State")
getParam("state","Back_App_State", true)
setTimeout("updateState()", 5000);
}
@@ -205,18 +205,11 @@ if ($ENABLED_DARKMODE === True) {
<!-- Sidebar Menu -->
<ul class="sidebar-menu" data-widget="tree">
<!--
<li class="header">MAIN MENU</li>
-->
<li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('devices.php', 'deviceDetails.php') ) ){ echo 'active'; } ?>">
<a href="devices.php"><i class="fa fa-laptop"></i> <span><?php echo lang('Navigation_Devices');?></span></a>
</li>
<!--
<li><a href="devices.php?status=favorites"><i class="fa fa-star"></i> <span>Favorites Devices</span></a></li>
-->
<li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('presence.php') ) ){ echo 'active'; } ?>">
<a href="presence.php"><i class="fa fa-calendar"></i> <span><?php echo lang('Navigation_Presence');?></span></a>
</li>
@@ -248,9 +241,17 @@ if ($ENABLED_DARKMODE === True) {
<script defer>
function getParam(targetId, key) {
function getParam(targetId, key, skipCache = false) {
skipCacheQuery = "";
if(skipCache)
{
skipCacheQuery = "&skipcache";
}
// get parameter value
$.get('php/server/parameters.php?action=get&parameter='+ key, function(data) {
$.get('php/server/parameters.php?action=get&parameter='+ key + skipCacheQuery, function(data) {
var result = data;
document.getElementById(targetId).innerHTML = result.replaceAll('"', '');

View File

@@ -561,8 +561,8 @@ the arp-scan will take hours to complete instead of seconds.
'PHOLUS_RUN_TIMEOUT_name' => 'Scheduled run timeout',
'PHOLUS_RUN_TIMEOUT_description' => 'The timeout in seconds for the scheduled Pholus scan. Same notes regarding the duration apply as on the <a href="#PHOLUS_TIMEOUT"><code>PHOLUS_TIMEOUT</code> setting</a>. A scheduled scan doesn\'t check if there are <code>(unknown)</code> or <code>(name not found)</code> devices, the scan is executed either way.',
'PHOLUS_RUN_SCHD_name' => 'Schedule',
'PHOLUS_RUN_SCHD_description' => 'Make sure you enter the schedule in the correct cron-like format
(e.g. validate at <a href="https://crontab.guru/" target="_blank">crontab.guru</a>). Will be run NEXT time the time passes. For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a href="#TIMEZONE"><code>TIMEZONE</code> you set above</a>.',
'PHOLUS_RUN_SCHD_description' => 'Only run if you select <code>schedule</code> in the <a href="#PHOLUS_RUN"><code>PHOLUS_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format
(e.g. validate at <a href="https://crontab.guru/" target="_blank">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a href="#TIMEZONE"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes.',
'PHOLUS_DAYS_DATA_name' => 'Data retention',
'PHOLUS_DAYS_DATA_description' => 'How many days of Pholus scan entries should be kept (globally, not device specific!). The <a href="/maintenance.php#tab_Logging">pialert_pholus.log</a> file is not touched. Enter <code>0</code> to disable.',