// type = 1 for the boot hardware config
// type = 2 for running config
// type = 3 for web config
+
+ // type = 4 for merged running config cache
+ // type = 5 for merged web config cache
function putConfig($config, $type=0)
{
global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY, $CONF_STORE_SIZE;
$newname = $_REQUEST["zonename"];
$renewname = null;
+ error_log("comparing \"$oldname\" to \"$newname\"");
if($oldname != $newname) {
$renewname = " rename $newname";
}
- $oldconf = $comms->getConfig(0);
+ $oldconf = getWebUserConfig();
$olddesc = $oldconf["zone"][$oldname]["description"];
+ error_log("Comparing \"$olddesc\" and \"$desc\"");
if($desc != $olddesc) {
$newdesc = " # $desc";
} else $newdesc = null;
if($renewname == null && $newdesc == null) {
header("Location: $BASE_URL/zones");
+ error_log("no changes?");
return;
}
$zone = $urls[2];
- $comms = new Comms();
- $myconf = new Config();
-
- $config = $comms->getConfig();
- $conf2 = $comms->getConfig(3);
- $config = $myconf->mergeConfig($config, $conf2);
+ $config = getWebUserConfig();
echo "<h2>Edit Zone $zone</h2>";
echo "</form>";
}
-function CBFWZonesPageDisplay()
+function getWebUserConfig()
{
- global $BASE_URL, $MENU_ITEMS;
-
$comms = new Comms();
$myconf = new Config();
- $config = $comms->getConfig();
+
+ // check to see if pre-cache config matches change level of config change buffer
+ $config = $comms->getConfig(5);
$conf2 = $comms->getConfig(3);
- $config = $myconf->mergeConfig($config, $conf2);
+ if(isset($config["status"])) {
+ if($config["status"] == $conf2["status"]) {
+ // it did, return the pre-cache
+ error_log("got pre-cache config");
+ return $config;
+ }
+ }
+
+ // it did not, do a new merge and cache
+ $config = $myconf->mergeConfig($comms->getConfig(), $conf2);
+ $reconfig = $config;
+ $reconfig["status"] = $conf2["status"];
+ error_log("put pre-cache config");
+ $comms->putConfig($reconfig, 5);
+
+ return $config;
+}
+
+function CBFWZonesPageDisplay()
+{
+ global $BASE_URL, $MENU_ITEMS;
+
+ $config = getWebUserConfig();
echo "<h2>Zones</h2>";
echo "<table border=\"1\"><tr><th>Zone</th><th>Interfaces</th><th>Description</th><th>Edit</th></tr>";