diff options
author | Colin Smith <colin@pfsense.org> | 2005-06-02 21:14:37 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-06-02 21:14:37 +0000 |
commit | 7cc2985563f43b2595f246ce95c38f0f2993219b (patch) | |
tree | 34b74f2c4d0d997dbd9c93b0158edb7060303ed2 | |
parent | 335978db776a55b5a2d178da15b9ba06c6f5fb65 (diff) | |
download | pfsense-7cc2985563f43b2595f246ce95c38f0f2993219b.zip pfsense-7cc2985563f43b2595f246ce95c38f0f2993219b.tar.gz |
* Only store 30 configuration revisions by default.
* Trim stored backups only when we need to.
-rw-r--r-- | etc/inc/config.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index e83f054..2f2983a 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -573,6 +573,7 @@ function write_config($desc="Unknown", $backup = true) { conf_mount_ro(); config_unlock(); + // Always reparse the config after it's written - something is getting lost in serialize(). $config = parse_config(true); return $config; } @@ -967,7 +968,7 @@ function system_start_ftp_helpers() { mwexec("/usr/local/sbin/pftpx -g 8021 -p {$ip}"); } -function cleanup_backupcache($revisions = "all") { +function cleanup_backupcache($revisions = 30) { global $g; $i = false; if(file_exists($g['cf_conf_path'] . '/backup/backup.cache')) { @@ -996,7 +997,8 @@ function cleanup_backupcache($revisions = "all") { } } foreach($newbaks as $todo) $tocache[$todo['time']] = array('description' => $todo['description']); - if(is_integer($revisions)) { + if(is_int($revisions) and (count($tocache) > $revisions)) { + print "trimming"; $toslice = array_slice(array_keys($tocache), 0, $revisions); foreach($toslice as $sliced) $newcache[$sliced] = $tocache[$sliced]; foreach($tocache as $version => $versioninfo) { |