better skipcache integration
This commit is contained in:
@@ -550,6 +550,9 @@ def importConfig ():
|
||||
# Used to determine the next import
|
||||
lastTimeImported = time.time()
|
||||
|
||||
# Used to display a message in the UI
|
||||
sql.executemany ("""INSERT INTO Parameters ("par_ID", "par_Value") VALUES (?, ?)""", [('Back_Settings_Imported', str(lastTimeImported) )])
|
||||
|
||||
commitDB()
|
||||
|
||||
# Update scheduler
|
||||
@@ -2875,6 +2878,7 @@ def upgradeDB ():
|
||||
('Front_Devices_Order', '[[3,"desc"],[0,"asc"]]'),
|
||||
('Front_Devices_Rows', '100'),
|
||||
('Front_Details_Tab', 'tabDetails'),
|
||||
('Back_Settings_Imported', ''),
|
||||
('Back_App_State', 'Initializing')
|
||||
]
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ services:
|
||||
network_mode: "host"
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ${APP_DATA_LOCATION}/pialert/config2:/home/pi/pialert/config
|
||||
- ${APP_DATA_LOCATION}/pialert/config:/home/pi/pialert/config
|
||||
# - ${APP_DATA_LOCATION}/pialert/db/pialert.db:/home/pi/pialert/db/pialert.db
|
||||
- ${APP_DATA_LOCATION}/pialert/db2:/home/pi/pialert/db
|
||||
- ${APP_DATA_LOCATION}/pialert/db:/home/pi/pialert/db
|
||||
# (optional) map an empty file with the name 'setting_darkmode' if you want to force the dark mode on container rebuilt
|
||||
- ${APP_DATA_LOCATION}/pialert/db/setting_darkmode:/home/pi/pialert/db/setting_darkmode
|
||||
# (optional) useful for debugging if you have issues setting up the container
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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¶meter='+ key, function(data) {
|
||||
$.get('php/server/parameters.php?action=get¶meter='+ key + skipCacheQuery, function(data) {
|
||||
var result = data;
|
||||
|
||||
document.getElementById(targetId).innerHTML = result.replaceAll('"', '');
|
||||
|
||||
@@ -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.',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user