From 957e2f1f07201aee484bc66a834679a9d417c585 Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 3 Mar 2010 21:02:06 -0500 Subject: [PATCH] Add a config diff option to the backup history, so you can view changes between revisions. --- usr/local/www/diag_confbak.php | 53 +++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/usr/local/www/diag_confbak.php b/usr/local/www/diag_confbak.php index 304714f1d1..e164194ec3 100755 --- a/usr/local/www/diag_confbak.php +++ b/usr/local/www/diag_confbak.php @@ -3,6 +3,7 @@ /* diag_confbak.php Copyright (C) 2005 Colin Smith + Copyright (C) 2010 Jim Pingle All rights reserved. Redistribution and use in source and binary forms, with or without @@ -72,6 +73,23 @@ if($_GET['getcfg'] != "") { exit; } +if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime']) + && is_numeric($_GET['oldtime']) && (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) { + $diff = ""; + $oldfile = $g['conf_path'] . '/backup/config-' . $_GET['oldtime'] . '.xml'; + $oldtime = $_GET['oldtime']; + if ($_GET['newtime'] == 'current') { + $newfile = $g['conf_path'] . '/config.xml'; + $newtime = $config['revision']['time']; + } else { + $newfile = $g['conf_path'] . '/backup/config-' . $_GET['newtime'] . '.xml'; + $newtime = $_GET['newtime']; + } + if (file_exists($oldfile) && file_exists($newfile)) { + exec("/usr/bin/diff -u " . escapeshellarg($oldfile) . " " . escapeshellarg($newfile), $diff); + } +} + cleanup_backupcache(); $confvers = get_backups(); unset($confvers['versions']); @@ -87,6 +105,16 @@ include("head.inc"); if($savemsg) print_info_box($savemsg); ?> + + + + + + +
Configuration diff from to
+
+
+
@@ -101,18 +129,25 @@ include("head.inc");
+
+ + + - + + + + + + +
Diff Date Configuration Change
+ + CurrentCurrent
+ + + + + +   + + @@ -140,6 +186,10 @@ include("head.inc");
@@ -148,6 +198,7 @@ include("head.inc");
+