Commit 9b24caa4 authored by Franco Fichtner's avatar Franco Fichtner

config: don't use notices in early/low level code

parent 35cf4144
...@@ -67,12 +67,11 @@ function parse_config() ...@@ -67,12 +67,11 @@ function parse_config()
$backups = $cnf->getBackups(); $backups = $cnf->getBackups();
if (count($backups) > 0) { if (count($backups) > 0) {
// load last backup // load last backup
syslog(LOG_ERR, sprintf('parse_config(): %s', gettext('No (valid) config.xml found, attempting last known config restore.'))); syslog(LOG_ERR, gettext('No valid config.xml found, attempting last known config restore.'));
file_notice("config.xml", gettext("No (valid) config.xml found, attempting last known config restore."), "OPNsenseConfigurator", "");
$cnf->restoreBackup($backups[0]); $cnf->restoreBackup($backups[0]);
} else { } else {
// we don't have backups, try to load the default // we don't have backups, try to load the default
syslog(LOG_ERR, sprintf('parse_config(): %s', gettext('No config.xml found, attempting to restore factory config.'))); syslog(LOG_ERR, gettext('No valid config.xml found, attempting to restore factory config.'));
$cnf->restoreBackup('/usr/local/etc/config.xml'); $cnf->restoreBackup('/usr/local/etc/config.xml');
} }
} }
...@@ -195,8 +194,7 @@ function write_config($desc = 'Unknown', $backup = true) ...@@ -195,8 +194,7 @@ function write_config($desc = 'Unknown', $backup = true)
$cnf->save($revision_info, $backup); $cnf->save($revision_info, $backup);
} catch (OPNsense\Core\ConfigException $e) { } catch (OPNsense\Core\ConfigException $e) {
// write failure // write failure
log_error(gettext("WARNING: Config contents could not be saved. Could not open file!")); syslog(LOG_ERR, gettext('WARNING: Config contents could not be saved. Could not open file!'));
file_notice('config.xml', sprintf("%s\n", gettext('Unable to open /conf/config.xml for writing in write_config()')));
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment