Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unset logfilesize rather than let it be zero #1088

Merged
merged 1 commit into from Apr 14, 2014
Merged

Unset logfilesize rather than let it be zero #1088

merged 1 commit into from Apr 14, 2014

Conversation

phil-davis
Copy link
Contributor

  1. When saving Status: System logs: Settings, if the Log File Size field is left blank, it gets cast to (int) and ends up as zero "0" in config.xml. That breaks the creation of clog files in /etc/rc during boot. /etc/rc expects logfilesize to be unset, blank or a valid integer >= 5120.
    So, if the field is empty, then make sure that it is unset in config.xml
  2. For data items that are cast to (int) when putting into the config (nentries and logfilesize), copy the resulting value back to the $pconfig array. When the user enters 123.45 the in field, it is correctly truncated to (int) 123 in config.xml. By copying that back to $pconfig, the "123" also appears correctly on the GUI page after the save.
  3. Mention the units of measure of Log File Size (Bytes)
  4. Mention that the user should press Save first when changing values, then they can use "Reset Log Files" to set the log file sizes to the just-saved value.
  5. Display a message when the log files have been reset - it's a bit more user-friendly IMHO.

1) When saving Status: System logs: Settings, if the Log File Size field is left blank, it gets cast to (int) and ends pu as zero "0" in config.xml. That breaks the creation of clog files in /etc/rc during boot. /etc/rc expects logfilesize to be unset, blank or a valid integer >= 5120.
So, if the field is empty, then make sure that it is unset in config.xml
2) For data items that are cast to (int) whenputting into the config (nentries and logfilesize), copy the resulting value back to the $pconfig array. When the user enters 123.45 the in field, is correctly truncated to (int) 123 in config.xml. By copying that back to $pconfig, the "123" also appears correctly on the GUI page after the save.
3) Mention the units of measure of Log File Size (Bytes)
4) Mention that the user should press Save first when changing values, then they can use "Reset Log Files" to set the log file sizes to the just-saved value.
5) Display a message when the log files have been reset - it's a bit more user-friendly IMHO.
@@ -113,7 +114,13 @@ function is_valid_syslog_server($target) {
if (!$input_errors) {
$config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
$config['syslog']['nentries'] = (int)$_POST['nentries'];
$config['syslog']['logfilesize'] = (int)$_POST['logfilesize'];
$pconfig['nentries'] = $config['syslog']['nentries'];
if (isset($_POST['logfilesize']) && (strlen($_POST['logfilesize']) > 0)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use empty() here since it treats 0 as false as well.

@netgate-git-updates netgate-git-updates merged commit f446295 into pfsense:master Apr 14, 2014
@phil-davis phil-davis deleted the patch-11 branch April 14, 2014 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants