Commit 2935542e authored by Ad Schellevis's avatar Ad Schellevis

replace config_install

parent eae996e5
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require_once("script/load_phalcon.php");
/* Allow additional execution time 0 = no limit. */ /* Allow additional execution time 0 = no limit. */
ini_set('max_execution_time', '0'); ini_set('max_execution_time', '0');
...@@ -384,7 +385,8 @@ if ($_POST) { ...@@ -384,7 +385,8 @@ if ($_POST) {
} else { } else {
/* restore the entire configuration */ /* restore the entire configuration */
file_put_contents($_FILES['conffile']['tmp_name'], $data); file_put_contents($_FILES['conffile']['tmp_name'], $data);
if (config_install($_FILES['conffile']['tmp_name']) == 0) { $cnf = OPNsense\Core\Config::getInstance();
if ($cnf->restoreBackup($filename)) {
/* this will be picked up by /index.php */ /* this will be picked up by /index.php */
mark_subsystem_dirty("restore"); mark_subsystem_dirty("restore");
touch("/conf/needs_package_sync"); touch("/conf/needs_package_sync");
...@@ -543,7 +545,8 @@ if ($_POST) { ...@@ -543,7 +545,8 @@ if ($_POST) {
$input_errors[] = gettext("XXX - this feature may hose your config (do NOT backrev configs!) - billm"); $input_errors[] = gettext("XXX - this feature may hose your config (do NOT backrev configs!) - billm");
if ($ver2restore <> "") { if ($ver2restore <> "") {
$conf_file = '/conf/backup/config-' . strtotime($ver2restore) . '.xml'; $conf_file = '/conf/backup/config-' . strtotime($ver2restore) . '.xml';
if (config_install($conf_file) == 0) { $cnf = OPNsense\Core\Config::getInstance();
if ($cnf->restoreBackup($conf_file)) {
mark_subsystem_dirty("restore"); mark_subsystem_dirty("restore");
} else { } else {
$input_errors[] = gettext("The configuration could not be restored."); $input_errors[] = gettext("The configuration could not be restored.");
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
*/ */
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("script/load_phalcon.php");
header("Content-Type: text/plain"); header("Content-Type: text/plain");
...@@ -40,7 +41,8 @@ if ($_POST['config']) { ...@@ -40,7 +41,8 @@ if ($_POST['config']) {
} }
fwrite($fd, $_POST['config']); fwrite($fd, $_POST['config']);
fclose($fd); fclose($fd);
if (config_install("{$g['tmp_path']}/config.xml") == 0) { $cnf = OPNsense\Core\Config::getInstance();
if ($cnf->restoreBackup("{$g['tmp_path']}/config.xml")) {
echo gettext("OK")."\n"; echo gettext("OK")."\n";
system_reboot(); system_reboot();
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment