diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-05-28 19:05:41 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-05-28 19:05:41 -0300 |
commit | 20c3a2de73a7b7b14db90e0f40fd7075a37c6a1c (patch) | |
tree | 9384956470c197210167bd0e366107554657fa37 /config | |
parent | b86d79164acc6a0f45f187b901512255e8b21d9d (diff) | |
download | pfsense-packages-20c3a2de73a7b7b14db90e0f40fd7075a37c6a1c.tar.gz pfsense-packages-20c3a2de73a7b7b14db90e0f40fd7075a37c6a1c.tar.bz2 pfsense-packages-20c3a2de73a7b7b14db90e0f40fd7075a37c6a1c.zip |
Simplify logic
Diffstat (limited to 'config')
-rw-r--r-- | config/autoconfigbackup/autoconfigbackup.inc | 12 | ||||
-rw-r--r-- | config/autoconfigbackup/autoconfigbackup.xml | 2 | ||||
-rw-r--r-- | config/autoconfigbackup/autoconfigbackup_backup.php | 2 |
3 files changed, 7 insertions, 9 deletions
diff --git a/config/autoconfigbackup/autoconfigbackup.inc b/config/autoconfigbackup/autoconfigbackup.inc index f67191ae..0ca3ebe9 100644 --- a/config/autoconfigbackup/autoconfigbackup.inc +++ b/config/autoconfigbackup/autoconfigbackup.inc @@ -130,13 +130,11 @@ function upload_config($reasonm = "") { } // Define some needed variables - if(!file_exists("/cf/conf/lastpfSbackup.txt")) { - conf_mount_rw(); - touch("/cf/conf/lastpfSbackup.txt"); - conf_mount_ro(); - } + if(file_exists("/cf/conf/lastpfSbackup.txt")) + $last_backup_date = str_replace("\n", "", file_get_contents("/cf/conf/lastpfSbackup.txt")); + else + $last_backup_date = ""; - $last_backup_date = str_replace("\n", "", file_get_contents("/cf/conf/lastpfSbackup.txt")); $last_config_change = $config['revision']['time']; $hostname = $config['system']['hostname'] . "." . $config['system']['domain']; if($reasonm) @@ -241,4 +239,4 @@ function upload_config($reasonm = "") { } } -?>
\ No newline at end of file +?> diff --git a/config/autoconfigbackup/autoconfigbackup.xml b/config/autoconfigbackup/autoconfigbackup.xml index d712d11b..b0514e6a 100644 --- a/config/autoconfigbackup/autoconfigbackup.xml +++ b/config/autoconfigbackup/autoconfigbackup.xml @@ -145,7 +145,7 @@ <custom_php_resync_config_command> <![CDATA[ conf_mount_rw(); - file_put_contents("/cf/conf/lastpfSbackup.txt", ""); + @unlink("/cf/conf/lastpfSbackup.txt"); conf_mount_ro(); if(!function_exists("filter_configure")) require_once("filter.inc"); diff --git a/config/autoconfigbackup/autoconfigbackup_backup.php b/config/autoconfigbackup/autoconfigbackup_backup.php index 78677049..7a6b045f 100644 --- a/config/autoconfigbackup/autoconfigbackup_backup.php +++ b/config/autoconfigbackup/autoconfigbackup_backup.php @@ -49,7 +49,7 @@ if($_POST) { write_config("Backup invoked via Auto Config Backup."); $config = parse_config(true); conf_mount_rw(); - file_put_contents("/cf/conf/lastpfSbackup.txt", ""); + @unlink("/cf/conf/lastpfSbackup.txt", ""); conf_mount_ro(); upload_config($_REQUEST['reason']); $savemsg = "Backup completed successfully."; |