mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
src: strip gettext() from log messages
It only makes debugging harder as our translations are being completed one after the other. Also has the positive side- effect of freeing a few hard-to-do translations in the process.
This commit is contained in:
parent
3d012d9613
commit
955b73fdd7
@ -636,7 +636,7 @@ function ldap_setup_caenv($authcfg)
|
||||
|
||||
$caref = lookup_ca($authcfg['ldap_caref']);
|
||||
if (!$caref) {
|
||||
log_error(sprintf(gettext("LDAP: Could not lookup CA by reference for host %s."), $authcfg['ldap_caref']));
|
||||
log_error(sprintf('LDAP: Could not lookup CA by reference for host %s.', $authcfg['ldap_caref']));
|
||||
/* XXX: Prevent for credential leaking since we cannot setup the CA env. Better way? */
|
||||
putenv('LDAPTLS_REQCERT=hard');
|
||||
return;
|
||||
|
||||
@ -197,7 +197,7 @@ function session_auth(&$Login_Error)
|
||||
$_SESSION['last_access'] = time();
|
||||
$_SESSION['protocol'] = $config['system']['webgui']['protocol'];
|
||||
if (!isset($config['system']['webgui']['quietlogin'])) {
|
||||
log_error(sprintf(gettext("Successful login for user '%1\$s' from: %2\$s"), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR']));
|
||||
log_error(sprintf("Successful login for user '%s' from: %s", $_POST['usernamefld'], $_SERVER['REMOTE_ADDR']));
|
||||
}
|
||||
header("Location: {$_SERVER['REQUEST_URI']}");
|
||||
exit;
|
||||
@ -238,9 +238,9 @@ function session_auth(&$Login_Error)
|
||||
/* user hit the logout button */
|
||||
if (isset($_GET['logout'])) {
|
||||
if (isset($_SESSION['Logout'])) {
|
||||
log_error(sprintf(gettext("Session timed out for user '%1\$s' from: %2\$s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR']));
|
||||
log_error(sprintf("Session timed out for user '%s' from: %s", $_SESSION['Username'], $_SERVER['REMOTE_ADDR']));
|
||||
} else {
|
||||
log_error(sprintf(gettext("User logged out for user '%1\$s' from: %2\$s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR']));
|
||||
log_error(sprintf("User logged out for user '%s' from: %s", $_SESSION['Username'], $_SERVER['REMOTE_ADDR']));
|
||||
}
|
||||
|
||||
/* wipe out $_SESSION */
|
||||
|
||||
@ -157,7 +157,7 @@ function write_config($desc = '', $backup = true)
|
||||
$user = getUserEntry($_SESSION['Username']);
|
||||
if (is_array($user) && userHasPrivilege($user, "user-config-readonly")) {
|
||||
// okay, it's not very nice to check permissions here, but let's make it explicit while we do...
|
||||
log_error(gettext("WARNING: User")." ".$_SESSION['Username']." ".gettext("may not write config (user-config-readonly set)"));
|
||||
log_error("WARNING: User {$_SESSION['Username']} may not write config (user-config-readonly set)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -165,7 +165,7 @@ function write_config($desc = '', $backup = true)
|
||||
|
||||
if (!isset($config['version'])) {
|
||||
// Examine config.xml, if for some strange reason the content is unexpected : exit directly.
|
||||
log_error(gettext("WARNING: Corrupt config!"));
|
||||
log_error('WARNING: Corrupt config!');
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ function write_config($desc = '', $backup = true)
|
||||
$cnf->save($revision_info, $backup);
|
||||
} catch (OPNsense\Core\ConfigException $e) {
|
||||
// write failure
|
||||
syslog(LOG_ERR, gettext('WARNING: Config contents could not be saved. Could not open file!'));
|
||||
syslog(LOG_ERR, 'WARNING: Config contents could not be saved. Could not open file!');
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ function _crypt_data($val, $pass, $opt)
|
||||
if (file_exists("{$file}.enc")) {
|
||||
$result = file_get_contents("{$file}.enc");
|
||||
} else {
|
||||
log_error(gettext('Failed to encrypt/decrypt data!'));
|
||||
log_error('Failed to encrypt/decrypt data!');
|
||||
}
|
||||
|
||||
@unlink($file);
|
||||
|
||||
@ -682,7 +682,7 @@ function filter_generate_gateways()
|
||||
}
|
||||
$foundlb++;
|
||||
} else {
|
||||
log_error(sprintf(gettext("An error occurred while trying to find the interface got %s . The rule has not been added."), $gatewayip));
|
||||
log_error(sprintf('An error occurred while trying to find the interface got %s. The rule has not been added.', $gatewayip));
|
||||
}
|
||||
}
|
||||
$route = "";
|
||||
@ -2144,7 +2144,7 @@ function filter_generate_port(& $rule, $target = "source", $isnat = false) {
|
||||
$srcport = explode("-", $rule[$target]['port']);
|
||||
$srcporta = alias_expand($srcport[0]);
|
||||
if (!$srcporta) {
|
||||
log_error(sprintf(gettext('filter_generate_port: %s is not a valid %s port.'), $srcport[0], $target));
|
||||
log_error(sprintf('filter_generate_port: %s is not a valid %s port.', $srcport[0], $target));
|
||||
} elseif (empty($srcport[1]) || $srcport[0] == $srcport[1]) {
|
||||
$src .= " port {$srcporta} ";
|
||||
} elseif (($srcport[0] == 1) && ($srcport[1] == 65535)) {
|
||||
@ -2508,7 +2508,7 @@ function filter_generate_user_rule(&$FilterIflist, $rule)
|
||||
if (is_ipaddrv4($rg)) {
|
||||
$aline['reply'] = "reply-to ( {$ifcfg['if']} {$rg} ) ";
|
||||
} elseif ($rule['interface'] <> "pptp") {
|
||||
log_error(sprintf(gettext("Could not find IPv4 gateway for interface (%s)."), $rule['interface']));
|
||||
log_error(sprintf('Could not find IPv4 gateway for interface (%s).', $rule['interface']));
|
||||
}
|
||||
}
|
||||
} elseif (!empty($rule['gateway']) && $type == "pass") {
|
||||
|
||||
@ -142,7 +142,7 @@ function parse_filter_line($line)
|
||||
list($all, $flent['time'], $host, $rule) = $log_split;
|
||||
|
||||
if (trim($flent['time']) == '') {
|
||||
log_error(sprintf(gettext('There was an error parsing a rule: no time (`%s\')'), $log_split));
|
||||
log_error(sprintf('There was an error parsing a rule: no time (%s)', $log_split));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@ -102,8 +102,8 @@ function match_wireless_interface($int)
|
||||
function interfaces_bring_up($interface)
|
||||
{
|
||||
if (!$interface) {
|
||||
log_error(gettext("interfaces_bring_up() was called but no variable defined."));
|
||||
log_error("Backtrace: " . debug_backtrace());
|
||||
log_error('interfaces_bring_up() was called but no variable defined.');
|
||||
log_error('Backtrace: ' . debug_backtrace());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -232,14 +232,14 @@ function interface_vlan_configure(&$vlan)
|
||||
global $config;
|
||||
|
||||
if (!is_array($vlan)) {
|
||||
log_error(gettext("VLAN: called with wrong options. Problems with config!"));
|
||||
log_error('VLAN: called with wrong options. Problems with config!');
|
||||
return;
|
||||
}
|
||||
$if = $vlan['if'];
|
||||
$vlanif = empty($vlan['vlanif']) ? "{$if}_vlan{$vlan['tag']}" : $vlan['vlanif'];
|
||||
|
||||
if (empty($if)) {
|
||||
log_error(gettext("interface_vlan_configure called with if undefined."));
|
||||
log_error('interface_vlan_configure called with if undefined.');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -294,19 +294,19 @@ function interface_qinq_configure(&$vlan, $fd = null)
|
||||
global $config;
|
||||
|
||||
if (!is_array($vlan)) {
|
||||
log_error(sprintf(gettext("QinQ compat VLAN: called with wrong options. Problems with config!%s"), "\n"));
|
||||
log_error(sprintf('QinQ compat VLAN: called with wrong options. Problems with config!'));
|
||||
return;
|
||||
}
|
||||
|
||||
$qinqif = $vlan['if'];
|
||||
$tag = $vlan['tag'];
|
||||
if (empty($qinqif)) {
|
||||
log_error(sprintf(gettext("interface_qinq_configure called with if undefined.%s"), "\n"));
|
||||
log_error(sprintf('interface_qinq_configure called with if undefined.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!does_interface_exist($qinqif)) {
|
||||
log_error(sprintf(gettext("interface_qinq_configure called with invalid if.%s"), "\n"));
|
||||
log_error(sprintf('interface_qinq_configure called with invalid if.'));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -388,7 +388,7 @@ function interface_qinq2_configure(&$qinq, $fd, $macaddr)
|
||||
global $config;
|
||||
|
||||
if (!is_array($qinq)) {
|
||||
log_error(sprintf(gettext("QinQ compat VLAN: called with wrong options. Problems with config!%s"), "\n"));
|
||||
log_error(sprintf('QinQ compat VLAN: called with wrong options. Problems with config!'));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -396,7 +396,7 @@ function interface_qinq2_configure(&$qinq, $fd, $macaddr)
|
||||
$tag = $qinq['tag'];
|
||||
$vlanif = "{$if}_{$tag}";
|
||||
if (empty($if)) {
|
||||
log_error(sprintf(gettext("interface_qinq2_configure called with if undefined.%s"), "\n"));
|
||||
log_error(sprintf('interface_qinq2_configure called with if undefined.'));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ function interface_bridge_configure(&$bridge, $checkmember = 0)
|
||||
}
|
||||
|
||||
if (empty($bridge['members'])) {
|
||||
log_error(sprintf(gettext("No members found on %s"), $bridge['bridgeif']));
|
||||
log_error(sprintf('No members found on %s', $bridge['bridgeif']));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -566,7 +566,7 @@ function interface_bridge_configure(&$bridge, $checkmember = 0)
|
||||
}
|
||||
$realif = get_real_interface($member);
|
||||
if (!$realif) {
|
||||
log_error(gettext("realif not defined in interfaces bridge - up"));
|
||||
log_error('realif not defined in interfaces bridge - up');
|
||||
continue;
|
||||
}
|
||||
/* make sure the parent interface is up */
|
||||
@ -688,7 +688,7 @@ function interface_bridge_configure(&$bridge, $checkmember = 0)
|
||||
if ($bridge['bridgeif']) {
|
||||
interfaces_bring_up($bridge['bridgeif']);
|
||||
} else {
|
||||
log_error(gettext("bridgeif not defined -- could not bring interface up"));
|
||||
log_error('bridgeif not defined -- could not bring interface up');
|
||||
}
|
||||
}
|
||||
|
||||
@ -954,7 +954,7 @@ function interface_gif_configure(&$gif, $gifkey = "")
|
||||
if ($realif) {
|
||||
interfaces_bring_up($realif);
|
||||
} else {
|
||||
log_error(gettext("could not bring realif up -- variable not defined -- interface_gif_configure()"));
|
||||
log_error('could not bring realif up -- variable not defined -- interface_gif_configure()');
|
||||
}
|
||||
|
||||
if (file_exists("/var/run/booting") || !(empty($gif['gifif']))) {
|
||||
@ -1214,7 +1214,7 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
|
||||
$realif = get_real_interface($interface);
|
||||
$realifv6 = get_real_interface($interface, "inet6", true);
|
||||
} elseif (!is_array($ifacecfg)) {
|
||||
log_error(gettext("Wrong parameters used during interface_bring_down"));
|
||||
log_error('Wrong parameters used during interface_bring_down()');
|
||||
$ifcfg = $config['interfaces'][$interface];
|
||||
$ppps = array();
|
||||
if (isset($config['ppps']['ppp'])) {
|
||||
@ -1543,7 +1543,7 @@ function interface_ppps_configure($interface)
|
||||
}
|
||||
}
|
||||
if (!isset($ppp) || $ifcfg['if'] != $ppp['if']) {
|
||||
log_error(sprintf(gettext("Can't find PPP config for %s in interface_ppps_configure()."), $ifcfg['if']));
|
||||
log_error(sprintf('Can\'t find PPP config for %s in interface_ppps_configure().', $ifcfg['if']));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1597,19 +1597,19 @@ function interface_ppps_configure($interface)
|
||||
$localips[$pid] = "0.0.0.0";
|
||||
}
|
||||
if (!is_ipaddr($gateways[$pid])) {
|
||||
log_error(sprintf(gettext('Could not get a PPTP/L2TP Remote IP address from %s for %s in interfaces_ppps_configure.'), $dhcp_gateway, $gway));
|
||||
log_error(sprintf('Could not get a PPTP/L2TP Remote IP address from %s for %s in interfaces_ppps_configure.', $dhcp_gateway, $gway));
|
||||
return 0;
|
||||
}
|
||||
legacy_netgraph_attach($port);
|
||||
break;
|
||||
case "ppp":
|
||||
if (!file_exists("{$port}")) {
|
||||
log_error(sprintf(gettext("Device %s does not exist. PPP link cannot start without the modem device."), $port));
|
||||
log_error(sprintf('Device %s does not exist. PPP link cannot start without the modem device.', $port));
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log_error(sprintf(gettext("Unkown %s configured as ppp interface."), $ppp['type']));
|
||||
log_error(sprintf('Unkown %s configured as ppp interface.', $ppp['type']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1810,7 +1810,7 @@ EOD;
|
||||
} else {
|
||||
$fd = fopen("/var/etc/mpd_{$interface}.conf", "w");
|
||||
if (!$fd) {
|
||||
log_error(sprintf(gettext("Error: cannot open mpd_%s.conf in interface_ppps_configure().%s"), $interface, "\n"));
|
||||
log_error(sprintf('Error: cannot open mpd_%s.conf in interface_ppps_configure().', $interface));
|
||||
return 0;
|
||||
}
|
||||
// Write out mpd_ppp.conf
|
||||
@ -2201,15 +2201,15 @@ function interface_wireless_clone($realif, $wlcfg)
|
||||
exec("/sbin/ifconfig " . escapeshellarg($realif), $output, $ret);
|
||||
$ifconfig_str = implode($output);
|
||||
if (($wlcfg_mode == "hostap") && (! preg_match("/hostap/si", $ifconfig_str))) {
|
||||
log_error(sprintf(gettext("Interface %s changed to hostap mode"), $realif));
|
||||
log_error(sprintf('Interface %s changed to hostap mode', $realif));
|
||||
$needs_clone = true;
|
||||
}
|
||||
if (($wlcfg_mode == "adhoc") && (! preg_match("/adhoc/si", $ifconfig_str))) {
|
||||
log_error(sprintf(gettext("Interface %s changed to adhoc mode"), $realif));
|
||||
log_error(sprintf('Interface %s changed to adhoc mode', $realif));
|
||||
$needs_clone = true;
|
||||
}
|
||||
if (($wlcfg_mode == "bss") && (preg_match("/hostap|adhoc/si", $ifconfig_str))) {
|
||||
log_error(sprintf(gettext("Interface %s changed to infrastructure mode"), $realif));
|
||||
log_error(sprintf('Interface %s changed to infrastructure mode', $realif));
|
||||
$needs_clone = true;
|
||||
}
|
||||
} else {
|
||||
@ -2222,12 +2222,12 @@ function interface_wireless_clone($realif, $wlcfg)
|
||||
legacy_interface_destroy($realif);
|
||||
}
|
||||
|
||||
log_error(sprintf(gettext("Cloning new wireless interface %s"), $realif));
|
||||
log_error(sprintf('Cloning new wireless interface %s', $realif));
|
||||
// Create the new wlan interface. FreeBSD returns the new interface name.
|
||||
// example: wlan2
|
||||
exec("/sbin/ifconfig wlan create wlandev {$baseif} {$mode} bssid 2>&1", $out, $ret);
|
||||
if ($ret <> 0) {
|
||||
log_error(sprintf(gettext('Failed to clone interface %s with error code %s, output %s'), $baseif, $ret, $out[0]));
|
||||
log_error(sprintf('Failed to clone interface %s with error code %s, output %s', $baseif, $ret, $out[0]));
|
||||
return false;
|
||||
}
|
||||
$newif = trim($out[0]);
|
||||
@ -3804,7 +3804,7 @@ function DHCP6_Config_File_Override($wancfg, $wanif)
|
||||
$dhcp6cconf = file_get_contents($dhcp6cfile);
|
||||
$dhcp6cconf = DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf);
|
||||
} else {
|
||||
log_error(sprintf(gettext('DHCP6 config file override does not exist: %s'), $dhcp6cfile));
|
||||
log_error(sprintf('DHCP6 config file override does not exist: %s', $dhcp6cfile));
|
||||
}
|
||||
|
||||
return $dhcp6cconf;
|
||||
@ -3845,7 +3845,7 @@ function interface_dhcp_configure($interface = 'wan')
|
||||
|
||||
$wanif = get_real_interface($interface);
|
||||
if (empty($wanif)) {
|
||||
log_error(sprintf(gettext("Invalid interface \"%s\" in interface_dhcp_configure()"), $interface));
|
||||
log_error(sprintf('Invalid interface "%s" in interface_dhcp_configure()', $interface));
|
||||
return 0;
|
||||
}
|
||||
$dhclientconf = "";
|
||||
@ -3901,7 +3901,7 @@ EOD;
|
||||
if ($wanif) {
|
||||
interfaces_bring_up($wanif);
|
||||
} else {
|
||||
log_error(printf(gettext("Could not bring up %s interface in interface_dhcp_configure()"), $wanif));
|
||||
log_error(sprintf('Could not bring up %s interface in interface_dhcp_configure()', $wanif));
|
||||
}
|
||||
|
||||
/* Make sure dhclient is not running */
|
||||
@ -3991,7 +3991,7 @@ function DHCP_Config_File_Override($wancfg, $wanif)
|
||||
$dhclientconf = file_get_contents($dhclientfile);
|
||||
$dhclientconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf);
|
||||
} else {
|
||||
log_error(sprintf(gettext('DHCP config file override does not exist: %s'), $dhclientfile));
|
||||
log_error(sprintf('DHCP config file override does not exist: %s', $dhclientfile));
|
||||
}
|
||||
|
||||
return $dhclientconf;
|
||||
|
||||
@ -746,18 +746,18 @@ EOD;
|
||||
if (isset($config['ca'])) {
|
||||
foreach ($config['ca'] as $ca) {
|
||||
if (!isset($ca['crt'])) {
|
||||
log_error(sprintf(gettext("Error: Invalid certificate info for %s"), $ca['descr']));
|
||||
log_error(sprintf('Error: Invalid certificate info for %s', $ca['descr']));
|
||||
continue;
|
||||
}
|
||||
$cert = base64_decode($ca['crt']);
|
||||
$x509cert = openssl_x509_parse(openssl_x509_read($cert));
|
||||
if (!is_array($x509cert) || !isset($x509cert['hash'])) {
|
||||
log_error(sprintf(gettext("Error: Invalid certificate hash info for %s"), $ca['descr']));
|
||||
log_error(sprintf('Error: Invalid certificate hash info for %s', $ca['descr']));
|
||||
continue;
|
||||
}
|
||||
$fname = "{$capath}/{$x509cert['hash']}.0.crt";
|
||||
if (!@file_put_contents($fname, $cert)) {
|
||||
log_error(sprintf(gettext("Error: Cannot write IPsec CA file for %s"), $ca['descr']));
|
||||
log_error(sprintf('Error: Cannot write IPsec CA file for %s', $ca['descr']));
|
||||
continue;
|
||||
}
|
||||
unset($cert);
|
||||
@ -775,7 +775,7 @@ EOD;
|
||||
$cert = lookup_cert($ph1ent['certref']);
|
||||
|
||||
if (empty($cert)) {
|
||||
log_error(sprintf(gettext("Error: Invalid phase1 certificate reference for %s"), $ph1ent['name']));
|
||||
log_error(sprintf('Error: Invalid phase1 certificate reference for %s', $ph1ent['name']));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -783,14 +783,14 @@ EOD;
|
||||
|
||||
$ph1keyfile = "{$keypath}/cert-{$ph1ent['ikeid']}.key";
|
||||
if (!file_put_contents($ph1keyfile, base64_decode($cert['prv']))) {
|
||||
log_error(sprintf(gettext("Error: Cannot write phase1 key file for %s"), $ph1ent['name']));
|
||||
log_error(sprintf('Error: Cannot write phase1 key file for %s', $ph1ent['name']));
|
||||
continue;
|
||||
}
|
||||
@chmod($ph1keyfile, 0600);
|
||||
|
||||
$ph1certfile = "{$certpath}/cert-{$ph1ent['ikeid']}.crt";
|
||||
if (!file_put_contents($ph1certfile, base64_decode($cert['crt']))) {
|
||||
log_error(sprintf(gettext("Error: Cannot write phase1 certificate file for %s"), $ph1ent['name']));
|
||||
log_error(sprintf('Error: Cannot write phase1 certificate file for %s', $ph1ent['name']));
|
||||
@unlink($ph1keyfile);
|
||||
continue;
|
||||
}
|
||||
@ -1308,14 +1308,14 @@ function ipsec_force_reload($interface = '')
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
log_error(sprintf(gettext("Ignoring IPsec reload since there are no tunnels on interface %s"), $interface));
|
||||
log_error(sprintf('Ignoring IPsec reload since there are no tunnels on interface %s', $interface));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* if ipsec is enabled, start up again */
|
||||
if (isset($ipseccfg['enable'])) {
|
||||
log_error(gettext("Forcefully reloading IPsec"));
|
||||
log_error('Forcefully reloading IPsec');
|
||||
ipsec_configure();
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ function file_notice($id, $notice, $category = "General", $url = "", $priority =
|
||||
$queue[$queuekey] = $toqueue;
|
||||
$queueout = fopen('/tmp/notices', 'w');
|
||||
if(!$queueout) {
|
||||
log_error(printf(gettext("Could not open %s for writing"), '/tmp/notices'));
|
||||
log_error(sprintf('Could not open %s for writing', '/tmp/notices'));
|
||||
return;
|
||||
}
|
||||
fwrite($queueout, serialize($queue));
|
||||
@ -290,10 +290,10 @@ function send_smtp_message($message, $subject = "(no subject)") {
|
||||
);
|
||||
|
||||
if($smtp->SendMessage($from, preg_split('/\s*,\s*/', trim($to)), $headers, $message)) {
|
||||
log_error(sprintf(gettext("Message sent to %s OK"), $to));
|
||||
log_error(sprintf('Message sent to %s OK', $to));
|
||||
return;
|
||||
} else {
|
||||
$msg = sprintf(gettext('Could not send the message to %s -- Error: %s'), $to, $smtp->error);
|
||||
$msg = sprintf('Could not send the message to %s -- Error: %s', $to, $smtp->error);
|
||||
log_error($msg);
|
||||
return ($msg);
|
||||
}
|
||||
|
||||
@ -340,12 +340,12 @@ function load_crypto_module()
|
||||
global $config;
|
||||
|
||||
if (!empty($config['system']['crypto_hardware'])) {
|
||||
log_error(sprintf(gettext('Loading %s cryptographic accelerator module.'), $config['system']['crypto_hardware']));
|
||||
log_error(sprintf('Loading %s cryptographic accelerator module.', $config['system']['crypto_hardware']));
|
||||
mwexecf('/sbin/kldload %s', $config['system']['crypto_hardware'], true);
|
||||
}
|
||||
|
||||
if (isset($config['system']['cryptodev_enable'])) {
|
||||
log_error(gettext('Loading cryptodev kernel module.'));
|
||||
log_error('Loading cryptodev kernel module.');
|
||||
mwexecf('/sbin/kldload %s', 'cryptodev', true);
|
||||
}
|
||||
}
|
||||
@ -355,7 +355,7 @@ function load_thermal_module()
|
||||
global $config;
|
||||
|
||||
if (!empty($config['system']['thermal_hardware'])) {
|
||||
log_error(sprintf(gettext('Loading %s thermal monitor module.'), $config['system']['thermal_hardware']));
|
||||
log_error(sprintf('Loading %s thermal monitor module.', $config['system']['thermal_hardware']));
|
||||
mwexecf('/sbin/kldload %s', $config['system']['thermal_hardware'], true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ function create_new_rrd($rrdcreatecmd)
|
||||
$_gb = exec("$rrdcreatecmd 2>&1", $rrdcreateoutput, $rrdcreatereturn);
|
||||
if ($rrdcreatereturn <> 0) {
|
||||
$rrdcreateoutput = implode(" ", $rrdcreateoutput);
|
||||
log_error(sprintf(gettext('RRD create failed exited with %s, the error is: %s'), $rrdcreatereturn, $rrdcreateoutput));
|
||||
log_error(sprintf('RRD create failed exited with %s, the error is: %s', $rrdcreatereturn, $rrdcreateoutput));
|
||||
}
|
||||
unset($rrdcreateoutput);
|
||||
return $rrdcreatereturn;
|
||||
@ -526,7 +526,7 @@ function enable_rrd_graphing()
|
||||
|
||||
$rrdupdatesh .= "sleep 60\n";
|
||||
$rrdupdatesh .= "done\n";
|
||||
log_error(gettext("Creating rrd update script"));
|
||||
|
||||
/* write the rrd update script */
|
||||
$updaterrdscript = '/var/db/rrd/updaterrd.sh';
|
||||
$fd = fopen("$updaterrdscript", "w");
|
||||
|
||||
@ -530,7 +530,7 @@ EOD;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log_error(gettext("Warning! DHCP Failover setup and no CARP virtual IPs defined!"));
|
||||
log_error('Warning! DHCP Failover setup and no CARP virtual IPs defined!');
|
||||
}
|
||||
$dhcpdconf_pri = "";
|
||||
if ($skew > 10) {
|
||||
@ -1459,7 +1459,7 @@ EOD;
|
||||
|
||||
$igmpfl = fopen('/usr/local/etc/igmpproxy.conf', 'w');
|
||||
if (!$igmpfl) {
|
||||
log_error(gettext("Could not write Igmpproxy configuration file!"));
|
||||
log_error('Could not write Igmpproxy configuration file!');
|
||||
return;
|
||||
}
|
||||
fwrite($igmpfl, $igmpconf);
|
||||
@ -1467,7 +1467,7 @@ EOD;
|
||||
unset($igmpconf);
|
||||
|
||||
mwexec('/usr/local/etc/rc.d/igmpproxy onestart');
|
||||
log_error(gettext("Started IGMP proxy service."));
|
||||
log_error('Started IGMP proxy service.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -644,7 +644,7 @@ function compare_hostname_to_dnscache($hostname) {
|
||||
}
|
||||
|
||||
if(trim($oldcontents) != trim($contents)) {
|
||||
log_error(sprintf(gettext('DNSCACHE: Found old IP %s and new IP %s'), $oldcontents, $contents));
|
||||
log_error(sprintf('DNSCACHE: Found old IP %s and new IP %s', $oldcontents, $contents));
|
||||
return ($oldcontents);
|
||||
} else {
|
||||
return false;
|
||||
@ -663,7 +663,7 @@ function system_staticroutes_configure($interface = '', $update_dns = false)
|
||||
|
||||
foreach ($static_routes as $rtent) {
|
||||
if (empty($gateways_arr[$rtent['gateway']])) {
|
||||
log_error(sprintf(gettext("Static Routes: Gateway IP could not be found for %s"), $rtent['network']));
|
||||
log_error(sprintf('Static Routes: Gateway IP could not be found for %s', $rtent['network']));
|
||||
continue;
|
||||
}
|
||||
$gateway = $gateways_arr[$rtent['gateway']];
|
||||
|
||||
@ -27,7 +27,6 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
function dump_rrd_to_xml($rrddatabase, $xmldumpfile)
|
||||
{
|
||||
$rrdtool = '/usr/local/bin/rrdtool';
|
||||
@ -37,13 +36,12 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile)
|
||||
exec("$rrdtool dump " . escapeshellarg($rrddatabase) . " {$xmldumpfile} 2>&1", $dumpout, $dumpret);
|
||||
if ($dumpret <> 0) {
|
||||
$dumpout = implode(" ", $dumpout);
|
||||
log_error(sprintf(gettext('RRD dump failed exited with %s, the error is: %s'), $dumpret, $dumpout));
|
||||
log_error(sprintf('RRD dump failed exited with %s, the error is: %s', $dumpret, $dumpout));
|
||||
}
|
||||
|
||||
return($dumpret);
|
||||
}
|
||||
|
||||
|
||||
function migrate_rrd_format($rrdoldxml, $rrdnewxml) {
|
||||
if(!file_exists("/tmp/rrd_notice_sent.txt")) {
|
||||
$_gb = exec("echo 'Converting RRD configuration to new format. This might take a bit...' | wall");
|
||||
@ -53,7 +51,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) {
|
||||
$numrranew = count($rrdnewxml['rra']);
|
||||
$numdsold = count($rrdoldxml['ds']);
|
||||
$numdsnew = count($rrdnewxml['ds']);
|
||||
log_error(sprintf(gettext('Import RRD has %s DS values and %s RRA databases, new format RRD has %s DS values and %s RRA databases'), $numdsold, $numrraold, $numdsnew ,$numrranew));
|
||||
log_error(sprintf('Import RRD has %s DS values and %s RRA databases, new format RRD has %s DS values and %s RRA databases', $numdsold, $numrraold, $numdsnew ,$numrranew));
|
||||
|
||||
/* add data sources not found in the old array from the new array */
|
||||
$i = 0;
|
||||
@ -137,7 +135,9 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) {
|
||||
|
||||
$numrranew = count($rrdoldxml['rra']);
|
||||
$numdsnew = count($rrdoldxml['ds']);
|
||||
log_error(sprintf(gettext('The new RRD now has %s DS values and %s RRA databases'), $numdsnew, $numrranew));
|
||||
|
||||
log_error(sprintf('The new RRD now has %s DS values and %s RRA databases', $numdsnew, $numrranew));
|
||||
|
||||
return $rrdoldxml;
|
||||
}
|
||||
|
||||
|
||||
@ -1010,7 +1010,7 @@ function mwexec($command, $mute = false)
|
||||
|
||||
if ($retval != 0 && $mute == false) {
|
||||
$output = implode(' ', $oarr);
|
||||
log_error(sprintf(gettext("The command '%s' returned exit code '%d', the output was '%s'"), $command, $retval, $output));
|
||||
log_error(sprintf("The command '%s' returned exit code '%d', the output was '%s'", $command, $retval, $output));
|
||||
unset($output);
|
||||
}
|
||||
|
||||
|
||||
@ -155,13 +155,13 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false")
|
||||
xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE, 1);
|
||||
|
||||
if (!($fp = fopen($cffile, "r"))) {
|
||||
log_error(gettext("Error: could not open XML input") . "\n");
|
||||
log_error('Error: could not open XML input');
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ($data = fread($fp, 4096)) {
|
||||
if (!xml_parse($xml_parser, $data, feof($fp))) {
|
||||
log_error(sprintf(gettext('XML error: %s at line %d in %s') . "\n",
|
||||
log_error(sprintf('XML error: %s at line %d in %s' . "\n",
|
||||
xml_error_string(xml_get_error_code($xml_parser)),
|
||||
xml_get_current_line_number($xml_parser),
|
||||
$cffile));
|
||||
@ -180,7 +180,7 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false")
|
||||
}
|
||||
}
|
||||
if (!$parsedcfg[$rootobj_name]) {
|
||||
log_error(sprintf(gettext("XML error: no %s object found!") . "\n", implode(" or ", $rootobj)));
|
||||
log_error(sprintf('XML error: no %s object found!' . "\n", implode(" or ", $rootobj)));
|
||||
return -1;
|
||||
}
|
||||
return $parsedcfg[$rootobj_name];
|
||||
|
||||
@ -140,7 +140,7 @@ if (isset($config['openvpn']['openvpn-server']) || isset($config['openvpn']['ope
|
||||
|
||||
$openvpnlck = try_lock('openvpn', 10);
|
||||
if (!$openvpnlck) {
|
||||
log_error(gettext("Could not obtain openvpn lock for executing rc.openvpn for more than 10 seconds continuing..."));
|
||||
log_error('Could not obtain openvpn lock for executing rc.openvpn for more than 10 seconds continuing...');
|
||||
@unlink("/tmp/openvpn.lock");
|
||||
$openvpnlck = lock('openvpn', LOCK_EX);
|
||||
}
|
||||
|
||||
@ -128,14 +128,14 @@ foreach ($keys as $name) {
|
||||
}
|
||||
|
||||
if ($generate_keys) {
|
||||
log_error(gettext('Started creating your SSH keys. SSH startup is being delayed a wee bit.'));
|
||||
log_error('Started creating your SSH keys. SSH startup is being delayed a wee bit.');
|
||||
mark_subsystem_dirty('sshdkeys');
|
||||
mwexec("/bin/rm -f {$etc_ssh}/ssh_host_*");
|
||||
foreach ($keys as $type => $name) {
|
||||
mwexec(sprintf('%s -t %s -N "" -f %s/%s', $bin_ssh_keygen, $type, $etc_ssh, $name));
|
||||
}
|
||||
clear_subsystem_dirty('sshdkeys');
|
||||
log_error(gettext('Completed creating your SSH keys. SSH will now be started.'));
|
||||
log_error('Completed creating your SSH keys. SSH will now be started.');
|
||||
}
|
||||
|
||||
/* Launch new server process */
|
||||
|
||||
@ -55,7 +55,7 @@ function update_alias_url_data()
|
||||
if (file_exists("{$temp_filename}/aliases")) {
|
||||
$fd = @fopen("{$temp_filename}/aliases", 'r');
|
||||
if (!$fd) {
|
||||
log_error(sprintf(gettext('Could not process aliases from alias: %s'), $alias_url));
|
||||
log_error(sprintf('Could not process aliases from alias: %s', $alias_url));
|
||||
continue;
|
||||
}
|
||||
/* NOTE: fgetss() is not a typo RTFM before being smart */
|
||||
|
||||
@ -102,8 +102,6 @@ class Shell
|
||||
exec("$command 2>&1", $output, $retval);
|
||||
|
||||
if (($retval <> 0) && ($mute === false)) {
|
||||
//log_error(sprintf(gettext("The command '%1\$s'
|
||||
// returned exit code '%2\$d', the output was '%3\$s' "), implode(" ", $output);
|
||||
// TODO: log
|
||||
unset($output);
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
|
||||
$data = file_get_contents($_FILES['conffile']['tmp_name']);
|
||||
if(empty($data)) {
|
||||
log_error(sprintf(gettext("Warning, could not read file %s"), $_FILES['conffile']['tmp_name']));
|
||||
log_error(sprintf('Warning, could not read file %s', $_FILES['conffile']['tmp_name']));
|
||||
$input_errors[] = sprintf(gettext("Warning, could not read file %s"), $_FILES['conffile']['tmp_name']);
|
||||
}
|
||||
} else {
|
||||
@ -262,7 +262,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
|
||||
if (count($input_errors) == 0) {
|
||||
if(stristr($data, "<m0n0wall>")) {
|
||||
log_error(gettext("Upgrading m0n0wall configuration to OPNsense."));
|
||||
log_error('Upgrading m0n0wall configuration to OPNsense.');
|
||||
/* m0n0wall was found in config. convert it. */
|
||||
$data = str_replace("m0n0wall", "pfsense", $data);
|
||||
$m0n0wall_upgrade = true;
|
||||
|
||||
@ -197,7 +197,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$savemsg = get_std_save_message();
|
||||
|
||||
if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) {
|
||||
log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
|
||||
log_error('webConfigurator configuration has changed. Restarting webConfigurator now.');
|
||||
mwexec_bg('/usr/local/etc/rc.restart_webgui 2');
|
||||
$savemsg .= "<br />" . gettext("WebGUI process is restarting.");
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isst
|
||||
xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE, 1);
|
||||
|
||||
if (!($fp = fopen($cffile, "r"))) {
|
||||
log_error(gettext("Error: could not open XML input") . "\n");
|
||||
log_error('Error: could not open XML input');
|
||||
if (isset($parsed_attributes)) {
|
||||
$parsed_attributes = array();
|
||||
unset($parsedattrs);
|
||||
@ -208,7 +208,7 @@ function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isst
|
||||
|
||||
while ($data = fread($fp, 4096)) {
|
||||
if (!xml_parse($xml_parser, $data, feof($fp))) {
|
||||
log_error(sprintf(gettext('XML error: %s at line %d') . "\n",
|
||||
log_error(sprintf('XML error: %s at line %d' . "\n",
|
||||
xml_error_string(xml_get_error_code($xml_parser)),
|
||||
xml_get_current_line_number($xml_parser)));
|
||||
if (isset($parsed_attributes)) {
|
||||
@ -221,7 +221,7 @@ function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isst
|
||||
xml_parser_free($xml_parser);
|
||||
|
||||
if (!$parsedcfg[$rootobj]) {
|
||||
log_error(sprintf(gettext("XML error: no %s object found!") . "\n", $rootobj));
|
||||
log_error(sprintf('XML error: no %s object found!', $rootobj));
|
||||
if (isset($parsed_attributes)) {
|
||||
$parsed_attributes = array();
|
||||
unset($parsedattrs);
|
||||
|
||||
@ -242,12 +242,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
|
||||
if ($restart_sshd) {
|
||||
log_error(gettext('Secure Shell configuration has changed. Applying now...'));
|
||||
configd_run('sshd restart', true);
|
||||
}
|
||||
|
||||
if ($restart_webgui) {
|
||||
log_error(gettext('webConfigurator configuration has changed. Applying now...'));
|
||||
mwexec_bg('/usr/local/etc/rc.restart_webgui 2');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user