unbound: general: include statistics toggle for general page migration

This commit is contained in:
Stephan de Wit 2023-05-03 10:20:51 +02:00
parent 643cb5d157
commit 46cef8a72d
3 changed files with 8 additions and 3 deletions

View File

@ -108,5 +108,6 @@ class M1_0_6 extends BaseModelMigration
{
$config = Config::getInstance()->object();
unset($config->unbound->acls);
unset($config->unbound);
}
}

View File

@ -12,6 +12,10 @@
<default>53</default>
<Required>Y</Required>
</port>
<stats type="BooleanField">
<default>0</default>
<Required>N</Required>
</stats>
<active_interface type=".\UnboundInterfaceField">
<Required>N</Required>
<Multiple>Y</Multiple>

View File

@ -36,12 +36,12 @@ require_once("system.inc");
require_once("plugins.inc.d/unbound.inc");
$rrdcfg = &config_read_array('rrd');
$unboundcfg = &config_read_array('unbound');
$unboundcfg = &config_read_array('OPNsense', 'unboundplus', 'general');
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = [];
$pconfig['rrdenable'] = isset($rrdcfg['enable']);
$pconfig['unboundenable'] = isset($unboundcfg['stats']);
$pconfig['unboundenable'] = !empty($unboundcfg['stats']);
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
$pconfig = $_POST;
$configure_unbound = false;
@ -60,7 +60,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
configd_run('netflow aggregate repair', true);
} elseif (!empty($pconfig['action']) && $pconfig['action'] == "SaveDNS") {
$configure_unbound = true;
$unboundcfg['stats'] = !empty($pconfig['unboundenable']);
$unboundcfg['stats'] = !empty($pconfig['unboundenable']) ? '1' : '0';
$savemsg = get_std_save_message();
write_config();
} elseif (!empty($pconfig['action']) && $pconfig['action'] == "ResetDNS") {