Support selective emhttpd state update.

This commit is contained in:
Tom Mortensen
2017-06-30 13:28:06 -07:00
parent 7e1f676e1f
commit 6ae0ee0c45
8 changed files with 32 additions and 14 deletions
@@ -66,6 +66,7 @@ foreach ($custom as $network) {
<form markdown="1" id="settingsForm" method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#file" value="<?=$docker_cfgfile;?>">
<input type="hidden" name="#command" value="/plugins/dynamix/scripts/refresh_emhttp_state" />
Enable Docker:
: <select id="DOCKER_ENABLED" name="DOCKER_ENABLED" class="narrow">
<?= mk_option($dockercfg['DOCKER_ENABLED'], 'no', 'No'); ?>
@@ -104,6 +104,7 @@ foreach ($arrSyslinuxCfg as &$strSyslinuxCfg) {
<?endif;?>
<form id="settingsForm" method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#file" value="<?=htmlspecialchars($domain_cfgfile)?>" />
<input type="hidden" name="#command" value="/plugins/dynamix/scripts/refresh_emhttp_state" />
<dl>
<dt>Enable VMs:</dt>
+5 -1
View File
@@ -1,3 +1,7 @@
Menu="Tasks:1"
Type="xmenu"
Tabs="false"
Tabs="false"
---
<?PHP
refresh_emhttp_state();
?>
+5 -1
View File
@@ -1,2 +1,6 @@
Menu="Tasks:1"
Type="xmenu"
Type="xmenu"
---
<?PHP
refresh_emhttp_state();
?>
-10
View File
@@ -1,10 +0,0 @@
#!/usr/bin/php
<?PHP
// The cpuload.ini file is generated by emhttpd just before the 'heartbeat' event callout.
// todo: having emhttpd directly publish json would be more efficient
require_once "/usr/local/emhttp/webGui/include/publish.php";
$data = @parse_ini_file("/var/local/emhttp/cpuload.ini", true);
if ($data !== FALSE) {
publish("cpuload", json_encode($data, JSON_NUMERIC_CHECK));
}
?>
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2016, Lime Technology
* Copyright 2012-2016, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/publish.php";
refresh_emhttp_state();
?>
+1 -2
View File
@@ -22,7 +22,6 @@ require_once "$docroot/webGui/include/publish.php";
extract(parse_plugin_cfg('dynamix',true));
// Read emhttp status
refresh_emhttp_state();
$var = parse_ini_file('state/var.ini');
$sec = parse_ini_file('state/sec.ini',true);
$devs = parse_ini_file('state/devs.ini',true);
@@ -60,7 +59,7 @@ $myPage = $site[basename($path)];
$pageroot = $docroot.'/'.dirname($myPage['file']);
$update = true; // set for legacy
// Maybe delete stale share size files
// hack: maybe delete stale share size files
if ($myPage['name'] != 'Shares')
foreach(glob('/var/local/emhttp/*.ssz*', GLOB_NOSORT) as $sszfile) @unlink($sszfile);