diff --git a/sysutils/pfSense-pkg-AutoConfigBackup/Makefile b/sysutils/pfSense-pkg-AutoConfigBackup/Makefile index 84f5aea6cc86..e40b89e947f7 100644 --- a/sysutils/pfSense-pkg-AutoConfigBackup/Makefile +++ b/sysutils/pfSense-pkg-AutoConfigBackup/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= pfSense-pkg-AutoConfigBackup -PORTVERSION= 1.45 +PORTVERSION= 1.46 CATEGORIES= sysutils MASTER_SITES= # empty DISTFILES= # empty diff --git a/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/pkg/autoconfigbackup.inc b/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/pkg/autoconfigbackup.inc index 983ebf0cc6bf..8c489386b203 100644 --- a/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/pkg/autoconfigbackup.inc +++ b/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/pkg/autoconfigbackup.inc @@ -3,7 +3,7 @@ * autoconfigbackup.inc * * part of pfSense (https://www.pfsense.org) - * Copyright (c) 2008-2015 Rubicon Communications, LLC (Netgate) + * Copyright (c) 2008-2016 Rubicon Communications, LLC (Netgate) * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,10 +26,31 @@ require_once("notices.inc"); unlink_if_exists("/usr/local/pkg/parse_config/parse_config_upload.inc"); unlink_if_exists("/usr/local/pkg/parse_config/parse_config_upload.php"); +/* Check whether ACB is enabled */ +function acb_enabled() { + global $config; + $acb_enabled = false; + + if (is_array($config['installedpackages']['autoconfigbackup']['config'])) { + if ($config['installedpackages']['autoconfigbackup']['config'][0]['enable_acb'] != "disabled") { + $acb_enabled = true; + } + } + return $acb_enabled; +} + // Ensures patches match function acb_custom_php_validation_command($post, &$input_errors) { global $_POST, $savemsg, $config; + // Do nothing when ACB is disabled in configuration + // This also makes it possible to delete the credentials from config.xml + if (!acb_enabled()) { + // We do not need to store this value. + unset($_POST['testconnection']); + return; + } + if (!$post['username']) { $input_errors[] = "Username is required."; } @@ -62,6 +83,11 @@ function acb_custom_php_validation_command($post, &$input_errors) { } function acb_custom_php_resync_config_command() { + // Do nothing when ACB is disabled in configuration + if (!acb_enabled()) { + return; + } + if (is_file("/cf/conf/lastpfSbackup.txt")) { conf_mount_rw(); unlink("/cf/conf/lastpfSbackup.txt"); @@ -96,12 +122,8 @@ function configure_proxy() { function test_connection($post) { global $savemsg, $config, $g; - // Do nothing when booting - if (function_exists("platform_booting")) { - if (platform_booting()) { - return; - } - } elseif ($g['booting']) { + // Do nothing when booting or when not enabled + if (platform_booting() || !acb_enabled()) { return; } @@ -150,12 +172,8 @@ function test_connection($post) { function upload_config($reasonm = "") { global $config, $g, $input_errors; - // Do nothing when booting - if (function_exists("platform_booting")) { - if (platform_booting()) { - return; - } - } elseif ($g['booting']) { + // Do nothing when booting or when not enabled + if (platform_booting() || !acb_enabled()) { return; } @@ -284,4 +302,3 @@ function upload_config($reasonm = "") { } } } - diff --git a/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/pkg/autoconfigbackup.xml b/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/pkg/autoconfigbackup.xml index 0c0723844232..b4bf79096d32 100644 --- a/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/pkg/autoconfigbackup.xml +++ b/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/pkg/autoconfigbackup.xml @@ -8,7 +8,7 @@ * autoconfigbackup.xml * * part of pfSense (https://www.pfsense.org) - * Copyright (c) 2008-2015 Rubicon Communications, LLC (Netgate) + * Copyright (c) 2008-2016 Rubicon Communications, LLC (Netgate) * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -57,6 +57,17 @@ + + Enable AutoConfigBackup + enable_acb + Enable/disable configuration backups to portal.pfsense.org + select + enabled + + + + + Subscription Username username diff --git a/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/www/autoconfigbackup_backup.php b/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/www/autoconfigbackup_backup.php index 8c9dc9366a0a..5437b990b0f3 100644 --- a/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/www/autoconfigbackup_backup.php +++ b/sysutils/pfSense-pkg-AutoConfigBackup/files/usr/local/www/autoconfigbackup_backup.php @@ -32,9 +32,13 @@ touch("/tmp/acb_nooverwrite"); } if ($_REQUEST['reason']) { - write_config($_REQUEST['reason']); + if (write_config($_REQUEST['reason'])) { + $savemsg = "Backup completed successfully."; + } + } elseif (write_config("Backup invoked via Auto Config Backup.")) { + $savemsg = "Backup completed successfully."; } else { - write_config("Backup invoked via Auto Config Backup."); + $savemsg = "Backup not completed - write_config() failed."; } $config = parse_config(true); conf_mount_rw(); @@ -47,7 +51,6 @@ */ //upload_config($_REQUEST['reason']); - $savemsg = "Backup completed successfully."; $donotshowheader = true; }