diff options
author | jim-p <jimp@pfsense.org> | 2013-12-26 12:53:30 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-12-26 12:53:30 -0500 |
commit | e1ebe9e2267a20efedbc4486c72044ae99e2f2a3 (patch) | |
tree | 94eb93f2fce42f80432b881583ea2f9ade463766 /etc | |
parent | bfe615ee530b48490165319b358346ea77f8aafd (diff) | |
download | pfsense-e1ebe9e2267a20efedbc4486c72044ae99e2f2a3.zip pfsense-e1ebe9e2267a20efedbc4486c72044ae99e2f2a3.tar.gz |
Add an option for users to be able to adjust how many configuration revisions are kept in the local backup cache.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/config.lib.inc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index 0acf9c7..a515e1b 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -533,11 +533,7 @@ function write_config($desc="Unknown", $backup = true) { return -1; } - if($g['platform'] == "embedded" or $g['platform'] == "nanobsd") { - cleanup_backupcache(5, true); - } else { - cleanup_backupcache(30, true); - } + cleanup_backupcache(true); /* re-read configuration */ /* NOTE: We assume that the file can be parsed since we wrote it. */ @@ -725,10 +721,12 @@ function config_validate($conffile) { return true; } -function cleanup_backupcache($revisions = 30, $lock = false) { +function cleanup_backupcache($lock = false) { global $g; $i = false; - + + $revisions = get_config_backup_count(); + if (!$lock) $lockkey = lock('config'); @@ -909,6 +907,17 @@ function make_config_revision_entry($desc = null, $override_user = null) { return $revision; } +function get_config_backup_count() { + global $config, $g; + if (isset($config['system']['backupcount']) && is_numeric($config['system']['backupcount']) && ($config['system']['backupcount'] >= 0)) { + return intval($config['system']['backupcount']); + } elseif ($g['platform'] == "embedded" or $g['platform'] == "nanobsd") { + return 5; + } else { + return 30; + } +} + function pfSense_clear_globals() { global $config, $FilterIfList, $GatewaysList, $filterdns, $aliases, $aliastable; |