diff --git a/src/www/diag_backup.php b/src/www/diag_backup.php index e37130814..93bc1ada3 100644 --- a/src/www/diag_backup.php +++ b/src/www/diag_backup.php @@ -65,8 +65,8 @@ function restore_config_section($section_name, $new_contents) foreach ($xml as $xml_strip_root) { if (isset($xml_strip_root[$section])) { $section_xml = $xml_strip_root[$section]; - break; - } + break; + } } if ($section_xml = -1 && isset($xml[$section_name])) { @@ -201,6 +201,8 @@ $areas = array( 'wol' => gettext('Wake on LAN'), ); +$do_reboot = false; + if ($_SERVER['REQUEST_METHOD'] === 'GET') { $pconfig = array(); $pconfig['GDriveEnabled'] = isset($config['system']['remotebackup']['GDriveEnabled']) ? $config['system']['remotebackup']['GDriveEnabled'] : null; @@ -310,8 +312,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { write_config(); convert_config(); } - filter_configure(); - $savemsg = gettext("The configuration area has been restored. You should reboot the firewall."); + if (!empty(pconfig['rebootafterrestore'])) { + $do_reboot = true; + } + $savemsg = gettext("The configuration area has been restored."); } } else { /* restore the entire configuration */ @@ -319,8 +323,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { file_put_contents($filename, $data); $cnf = OPNsense\Core\Config::getInstance(); if ($cnf->restoreBackup($filename)) { - /* this will be picked up by /index.php */ - mark_subsystem_dirty("restore"); + if (!empty(pconfig['rebootafterrestore'])) { + $do_reboot = true; + } $config = parse_config(); /* extract out rrd items, unset from $config when done */ if($config['rrddata']) { @@ -423,11 +428,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { write_config(); convert_config(); $savemsg = gettext("The m0n0wall configuration has been restored and upgraded to OPNsense."); + } else { + $savemsg = gettext("The configuration has been restored."); } } else { $input_errors[] = gettext("The configuration could not be restored."); } } + + if ($do_reboot) { + $savemsg .= ' ' . gettext("The system is rebooting now. This may take one minute."); + } } } elseif ( $mode == "setup_gdrive" ){ if (!isset($config['system']['remotebackup'])) { @@ -518,12 +529,6 @@ $( document ).ready(function() {